-
Notifications
You must be signed in to change notification settings - Fork 2
Install system services
This describes how to install VariantGrid on a server using services, a way for Unix to run programs all the time (ie not by a user logged in on a shell)
- Follow the steps from INSTALL section of the project Readme
In your settings files, be sure to set DEBUG=False
. See Django docs why to never deploy a site into production with DEBUG turned on
You will need to modify /etc/nginx/nginx.conf to work as a proxy.
There are 2 examples in the variantgrid/config dir. The one in the base directory runs on port 80 and handles static files. The one in variantgrid/config/variantgrid.com/nginx.conf uses a SSL certificate, and redirects http -> https.
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.ORIG
cp ${VARIANTGRID_DIR}/config/nginx.conf /etc/nginx/ # Or use variantgrid one for SSL example
Edit the newly copied file, you need to change at least 3 lines: the IP address, and the path to the static files eg:
server {
listen 80;
server_name 130.56.244.155; # <---------------------------------- ** Change IP **
add_header Access-Control-Allow-Origin 130.56.244.155; # <--------- ** Change IP **
location /static/{
autoindex on;
root /opt/variantgrid/variantgrid/sitestatic; # <------------------ ** Change Path **
}
}
If you're on a VM with a small root partition, change where NGINX puts temp upload files (remember to assign this write permission to the nginx user - which is probably "www-data"):
client_body_temp_path /mnt/nginx_upload_temp;
For the changes to take effect you'll need to have nginx reload the config file (simply restarting nginx will not have the same effect).
sudo nginx -s reload
There are two types of services on Linux, Upstart and SystemD.
# Check which one you're using via:
ps -p1 | grep systemd && echo systemd || echo upstart
You need to edit the services, edit each service file in config/systemd/*.service so that
WorkingDirectory=/mnt/variantgrid # Needs to match ${VG_INSTALL_DIR}
then to install them
cp config/systemd/*.service /lib/systemd/system
for i in config/systemd/*.service;
do systemctl enable $(basename ${i});
done;
If you have to change them once they've been installed, make sure to
sudo systemctl daemon-reload
sudo systemctl restart gunicorn
etc
for the changes to be picked up
You can create users using the admin tool, or allow people to create their own accounts via the registration process, which requires an email server.
Instructions to Install PostFix mail server (requires a domain name)
A VM root partition is usually quite small, so we need to move data storage onto mounted disks