The backend for Hassah Book.
- Create a .env file
set all the required variables.
cp .env.example .env
- Using docker
docker build -t <app-tag> . docker run -it <app-tag>
- Without docker
yarn yarn start
- Docker Compose
- create a
docker-compose.yml
file and add your dependencies there (e.g. postgres) - upload to the server (e.g. using git)
- build and run using
docker-compose
- create a
- Dokku
- install the postgres plugin
- create a postgres service
NOTE: postgres version must be 12.5 or higher.
dokku postgres:create <SERVICE_NAME>
- create app
dokku apps:create <APP_NAME>
- link postgres
dokku postgres:link <POSTGRES_SERVICE_NAME> <APP_NAME> -a TYPEORM_URL
- using
dokku config
set your environment variablesdokku config:set <APP_NAME> TYPEORM_CONNECTION=postgres JWT_SECRET=mysecret ...
- push to dokku, for more details checkout the dokku docs
- run the migrations
dokku run <APP_NAME> yarn orm migration:run
- Linking to a domain (optional):
- change the app port to 80
dokku proxy:ports-add <APP_NAME> http:80:<PORT> # the port in .env
- add the domain
NOTE: make sure to remove the default domain/subdomain generated by dokku using
dokku domains:set <APP_NAME> <DOMAIN>
dokku domains:remove <APP_NAME> <DOMAIN>
- https
dokku config:set --no-restart <APP_NAME> DOKKU_LETSENCRYPT_EMAIL=<EMAIL_ADDRESS> dokku letsencrypt <APP_NAME>
- change the app port to 80