Skip to content

Instantly share code, notes, and snippets.

@chrisparnin
Created September 30, 2020 17:39
Show Gist options
  • Save chrisparnin/454e799f73697cad16a51e12662bd4fc to your computer and use it in GitHub Desktop.
Save chrisparnin/454e799f73697cad16a51e12662bd4fc to your computer and use it in GitHub Desktop.
bakerx run so.io focal --ip 192.168.100.120
whoami

Install prereqs.

sudo apt-get update
sudo apt install python3-pip -y
sudo apt install postgresql postgresql-client -y
cd /opt
sudo git clone https://bitbucket.org/laserllama/sourceoptics.git
cd /opt/sourceoptics
sudo mkdir -p /etc/source_optics/conf.d/
sudo pip3 install -r requirements.txt

Database Setup

Once PostgreSQL is installed, make a new user and database:

sudo -u postgres createuser {{user}} -s
sudo -u postgres createdb source_optics
sudo -u postgres psql << 'END_DOC'
ALTER DATABASE source_optics OWNER TO {{user}};
END_DOC
sudo -u postgres psql << 'END_DOC'
CREATE ROLE sourceoptics WITH LOGIN;
ALTER ROLE vagrant PASSWORD '{{pass}}';
END_DOC

Create database file.

DATABASES = {
            'default': {
                        'ENGINE': 'django.db.backends.postgresql',
                        'USER': '{{user}}',
                        'NAME': 'source_optics',
                        'HOST': '127.0.0.1',
                        'PASSWORD' : '{{pass}}',
                    }
            }

Continue Setup

Allow all addresses as valid server hosts.

ALLOWED_HOSTS = ['*']
cd /opt/sourceoptics
sudo python3 manage.py migrate
sudo python3 manage.py createsuperuser
sudo python3 manage.py generate_secret
cd /opt/sourceoptics
python3 manage.py runserver 0:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment