saasforge / open-source-saas-boilerpate

Free SaaS boilerplate (Python/PostgreSQL/ReactJS/Webpack)
https://www.saasforge.dev
MIT License
816 stars 120 forks source link

Add Dockerfile and docker-compose #6

Closed mandrews closed 4 years ago

mandrews commented 4 years ago

Overview

Allows developers to start the application using docker-compose up. Fixes #1.

Demo

% docker-compose up 
Creating network "open-source-saas-boilerpate_default" with the default driver
Creating open-source-saas-boilerpate_db_1 ... done
Creating open-source-saas-boilerpate_app_1 ... done
Attaching to open-source-saas-boilerpate_db_1, open-source-saas-boilerpate_app_1
db_1   | 2020-01-10 01:41:55.909 UTC [1] LOG:  starting PostgreSQL 12.0 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit
db_1   | 2020-01-10 01:41:55.909 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2020-01-10 01:41:55.909 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2020-01-10 01:41:55.917 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2020-01-10 01:41:55.933 UTC [18] LOG:  database system was shut down at 2020-01-10 01:34:24 UTC
db_1   | 2020-01-10 01:41:55.937 UTC [1] LOG:  database system is ready to accept connections
app_1  | INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
app_1  | INFO  [alembic.runtime.migration] Will assume transactional DDL.
app_1  |  * Serving Flask app "application"
app_1  |  * Environment: dev
app_1  |  * Debug mode: off
app_1  |  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
saasforge commented 4 years ago

Great! Can you please remove .env file? If you need to specify additional keys please add them (as an example + descriptions) into Readme.md file in the root. Also, it would be great to add instructions on how to use this functionality. Thanks!

mandrews commented 4 years ago

@saasforge no problem!

saasforge commented 4 years ago

Sounds good to me! The only thing is I don't know if "flask db upgrade" would work or not. I use "flask dbupdate" for this purpose.

mandrews commented 4 years ago

@saasforge Thanks for merging!

The flask db update command in the entrypoint.sh is meant to initialize the database and/or run the Alembic migrations so that a single command can start the app in an idempotent fashion.

I tried to get similar behavior working with a combination of flask dbcreate and flask dbupdate, but I couldn't get it to be idempotent across runs without modifying the commands since flask dbcreate drops the database.

saasforge commented 4 years ago

Ok, no problem as soon as it works :) Thanks for your contribution! :heart: :heart: :heart: