-
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
.
Also, you should already have a running etcd cluster, PostgreSQL and Redis servers as guided in previous step guides.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install -y ca-certificates git-core nginx supervisor
Here are some optional but useful packages:
$ sudo apt-get install vim tmux htop
(TODO)
Check out Install Python via pyenv for instructions.
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;
}
}
Backend.AI can use several 3rd-party monitoring and logging services. Using them is completely optional.
Datadog is a 3rd-party service to monitor the server resource usage.
$ DD_API_KEY=DDAPIKEY bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog-agent/source/install_agent.sh)"
(TODO)
supervisord eases the management of daemonization lifecycles of user-defined programs.
$ 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"
exec 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