Skip to content

Setting up backend server

Rison Simon edited this page Apr 4, 2019 · 15 revisions

To setup backend server, follow the steps below.

  1. Create a new server with Ubuntu 18.04 on any cloud platform. Create a new user called ubuntu as non root user.
  2. Run the following commands
sudo apt update
sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools zlib1g-dev
  1. Install pyenv curl https://pyenv.run | bash
  2. Install python 3.6.4 pyenv install 3.6.4
  3. Use python 3.6.4 pyenv global 3.6.4
  4. Install virtualenv pip install virtualenv
  5. Create new folder called remixvr mkdir remixvr
  6. Setup virtualenv
cd remixvr
virtualenv env
source env/bin/activate
  1. Copy remixvr content to server and install requirements using pip install -r requirements/dev.txt.
  2. Install uwsgi pip install uwsgi
  3. Setup a new service sudo vi /etc/systemd/system/remixvr.service
  4. Copy the following contents in the file. (Reference). If you're setting up staging and production on the same server make sure to update remixvr.sock value in remixvr.ini and setup appropriate nginx setting.
[Unit]
Description=uWSGI instance to serve remixvR
After=network.target

[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/remixvr
Environment="PATH=/home/ubuntu/remixvr/env/bin"
ExecStart=/home/ubuntu/remixvr/env/bin/uwsgi --ini remixvr.ini

[Install]
WantedBy=multi-user.target
  1. Run the following commands.
sudo systemctl start remixvr
sudo systemctl enable remixvr
  1. Check if it's running by sudo systemctl status remixvr
  2. Setup nginx to run with uwsgi. And setup letsencrypt (Reference - from step 6) To install nginx use the following.
sudo apt update
sudo apt install nginx

Setting up database

  1. Install postgres and create a new database named remixvr.
  2. Create a new user with with password as mentioned in the above article.Make sure the password is also set inside psql by using ALTER USER db_username PASSWORD 'new_password' command
  3. We'll use this user to access our database
  4. Create a .env file in remixvr parent directory and add DATABASE_URL with database connection url with the format mentioned here.
  5. Restart remixvr service sudo systemctl restart remixvr
  6. Setup database flask db upgrade
  7. Test everything is working propertly by accessing the api
Clone this wiki locally