-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Thomas Howe edited this page Jun 15, 2016
·
2 revisions
Start with a generic Ubuntu image, we normally use Digital Ocean: 4 GB Memory / 60 GB Disk / NYC3 - Ubuntu 14.04.4 x64
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' >> /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-get install linux-image-extra-$(uname -r)
apt-get install -y docker-engine apparmor make build-essential mongodb mongodb-server mongodb-clients g++ gcc git mosh coffeescript memcached unzip htop libicu-dev redis-server zlib1g-dev mosh libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev python-setuptools supervisor apt-transport-https ca-certificates
wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar -xzvf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure
make
make install
gem install bundler airbrake
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
apt-get install -y nodejs
npm install clone-org-repos coffee-script n -g
We add our SSH key into the org to make this easier.
mkdir code
cd ~/code
ssh-keygen
cat ~/.ssh/id_rsa.pub
read 'Now go and put this key in the repo. Quick!'
cloneorg green-bot
cd ~/code/greenbot-core && npm install
cd ~/code/kisst && npm install
cd ~/code
npm install keyword-bot
npm install not-available-bot
Use this sample in /etc/supervisor/supervisord.conf or whatever you use. Setting TSG keys here, but use the correct ones for your environment.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[inet_http_server] ; inet (TCP) server disabled by default
port=*:9001 ; (ip_address:port specifier, *:port for all iface)
username=xxxx ; (default is no username (open server))
password=xxxx ; (default is no password (open server))
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:greenbot-core]
command=node /root/code/greenbot-core/node_modules/.bin/coffee server/greenbot.coffee
directory=/root/code/greenbot-core ; directory to cwd to before exec (def no cwd)
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/greenbot-core ; stdout log path, NONE for none; default AUTO
environment=DEBUG=*, TRACE_MESSAGES=shua ; process environment additions (def no adds)
[program:kisst]
command=node /root/code/kisst/node_modules/.bin/coffee app.coffee
directory=/root/code/kisst
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/kisst ; stdout log path, NONE for none; default AUTO
environment=DEBUG=*
This .env file goes in ~/code/greenbot-core
MONGO_URL="mongodb://127.0.0.1:27017/greenbot"
DOMAIN="104.236.89.xxx"
ROOT_URL="http://104.236.89.xxx"
GREENBOT_IO_URL="http://104.236.89.xxx:3003"
TSG_CALLBACK_HOST="http://104.236.89.xxx:3001"
TSG_COBRA_KEY="xxxxxx"
TSG_SECRET="xxxxxxx"
Start supervisord, then go and make sure the stuff is running with a 'status' command
supervisord
supervisorctl
docker run --net="host" -e "MONGO_URL=mongodb://localhost:27017/greenbot" -e "ROOT_URL=http://104.236.6.xxx:3000" -e "GREENBOT_IO_URL=http://104.236.6.xxx:3003" --restart=always -d greenbot/greenbot-admin