-
Notifications
You must be signed in to change notification settings - Fork 156
Install Manager
Joongi Kim edited this page Dec 29, 2017
·
33 revisions
We assume that your system is configured with a sudoable admin user named devops
.
Ensure your system is up-to-date:
$ sudo apt-get update
$ sudo apt-get upgrade
Install dependencies for Backend.AI daemonization:
$ sudo apt-get install -y \
ca-certificates nginx \
redis-server redis-tools \
supervisor
Install dependencies for Python builds:
$ sudo apt-get install -y \
build-essential git-core \
libreadline-dev libsqlite3-dev libssl-dev libbz2-dev libzmq3-dev tk-dev
Here are some optional but useful packages:
$ sudo apt-get install vim tmux htop
(TODO)
Use pyenv or your favorite method to install Python 3.6 or later. Check out Install Python via pyenv for instructions on using pyenv.
Then, create a virtualenv named "venv-manager".
$ pyenv shell venv-manager
$ git clone --branch=master "https://github.com/lablup/backend.ai-manager" "backend.ai-manager"
$ cd backend.ai-manager
$ pip install -U pip setuptools
$ pip install -U -r requirements.txt
$ sudo vi /etc/nginx/sites-available/gateway
map http_connection connection_upgrade {
default upgrade;
'' close;
}
server {
server_name ENDPOINT;
charset utf-8;
client_max_body_size 32M;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
location / {
proxy_pass http://127.0.0.1:8081;
proxy_pass_request_headers on;
proxy_set_header Host "ENDPOINT";
proxy_redirect off;
proxy_buffering off;
proxy_read_timeout 600s;
}
location ~ ^/v\d+/stream/ {
proxy_pass http://127.0.0.1:8081;
proxy_pass_request_headers on;
proxy_set_header Host "ENDPOINT";
proxy_redirect off;
proxy_buffering off;
proxy_read_timeout 60s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
map http_connection connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
server_name ENDPOINT;
charset utf-8;
client_max_body_size 32M;
ssl_certificate SSLCERT;
ssl_certificate_key SSLPRIVKEY;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
location / {
proxy_pass http://127.0.0.1:8081;
proxy_pass_request_headers on;
proxy_set_header Host "ENDPOINT";
proxy_redirect off;
proxy_buffering off;
proxy_read_timeout 600s;
}
location ~ ^/v\d+/stream/ {
proxy_pass http://127.0.0.1:8081;
proxy_pass_request_headers on;
proxy_set_header Host "ENDPOINT";
proxy_redirect off;
proxy_buffering off;
proxy_read_timeout 60s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
Datadog is a 3rd-party service to monitor the server resource usage. Use of this service is completely optional.
$ DD_API_KEY=DDAPIKEY bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog-agent/source/install_agent.sh)"
$ sudo vi /etc/supervisor/conf.d/apps.conf
[program:backendai-manager]
user = devops
stopsignal = TERM
stopasgroup = true
command = /home/devops/run-manager.sh
$ sudo vi /home/devops/run-manager.sh
#!/bin/bash
source /home/devops/init-venv.sh
umask 0002
export AWS_ACCESS_KEY_ID="S3AKEY"
export AWS_SECRET_ACCESS_KEY="S3SKEY"
export DATADOG_API_KEY=DDAPIKEY
export DATADOG_APP_KEY=DDAPPKEY
export RAVEN_URI="SENTRYURL"
python -m ai.backend.gateway.server \
--db-addr=DBHOST:DBPORT \
--db-user=DBUSER \
--db-password='DBPASS' \
--db-name=backend \
--etcd-addr ETCDHOST:ETCDPORT\
--namespace NS \
--redis-addr REDISHOST:REDISPORT \
--events-port 5002 \
--service-ip 127.0.0.1 \
--service-port 8081
See the Prepare Databases for Manager guide.
$ sudo cp /etc/nginx/sites-enabled/default ../nginx.site-enabled.default
$ sudo rm /etc/nginx/sites-enabled/default
$ ln -s ../sites-available/gateway /etc/nginx/sites-enabled/gateway
$ sudo systemctl restart nginx
$ sudo supervisorctl start backendai-manager
$ sudo service nginx restart