Skip to content

mahoriR/selfattest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup Debug Environment

With Docker

Starting local server

docker-compose -f docker-compose-dev.yml build
docker-compose -f docker-compose-dev.yml up -d

This shall run your local server along with nice browsable APIs at 127.0.0.1:8000

Running Unit Tests

docker-compose -f docker-compose-dev.yml exec web_monolith /bin/bash run_tests.sh

Running Migrations

This will always be required when setting up dev env for first time

docker-compose -f docker-compose-dev.yml exec web_monolith python manage.py migrate

Stop local server

Note: Your DB will presist data across container restarts

docker-compose -f docker-compose-dev.yml  down

Without Docker

Not sure, if you need to setup with docker of without? If you need to use this, you will already know why_

Start with setting virtual environment

virtualenv --python=python3 ~/.virtualenvs/selfattest

source ~/.virtualenvs/selfattest/bin/activate

pip install -r requirements.txt

IDE setup

Make sure you are using Python 3.6.9

python --version

Install pep8 for Python formatter

PostgreSQL setup for local DEV

sudo su - postgres

psql -p <port>

CREATE DATABASE esm_platform;
CREATE USER esm_platform_user WITH PASSWORD 'esm_platform_user_pwd';
ALTER ROLE esm_platform_user SET client_encoding TO 'utf8';
ALTER ROLE esm_platform_user SET default_transaction_isolation TO 'read committed';
ALTER ROLE esm_platform_user SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE esm_platform TO esm_platform_user;

ALTER ROLE  esm_platform_user CREATEDB ; #Required only for running Unit tests locally.
\q

The DB connection string is postgres://esm_platform_user:esm_platform_user_pwd@localhost:5433/esm_platform

Udpdate your .env file's DATABASE_URL

Connect to DB from command line using psql -

psql -d postgres://esm_platform_user:esm_platform_user_pwd@localhost:5433/esm_platform

Running Tests

./run_tests.sh

Running locally

python manage.py runserver

This shall run your local server along with nice browsable APIs

How to setup a new environment

Set Domain on digital ocean

Create load balancer

HTTPS 443 - > HTTP 80 HTTP 80 -> HTTP 80

Create ceritificate and use subdomains. Subdomain must be already defined in domain config.

Create new firewall. Allow incoming in for droplet from loadbalancer only. SSH from everyone

Create new droplet

Follow https://github.com/mahoriR/ubuntu-server-setup.git

About

Simple API to self attest documents.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published