coopdevs / timeoverflow

🏦 ⌛ A time banking system
https://www.timeoverflow.org
GNU Affero General Public License v3.0
145 stars 67 forks source link

Adds a production ready docker environment #730

Closed microstudi closed 7 months ago

microstudi commented 7 months ago

This PR optimizes the application for its use in Docker images:

Testing

Run

docker compose up

Visit http:/localhost:3000/

Env vars summary:

ENV Description Default
RAILS_ENV Define the rails environment (not necessary to setup unless you have some special requirements) production
SECRET_KEY_BASE Secret key for the application, generate a new one with the command rails secret
DATABASE_URL Database URL, the format is postgresql://user:password@host:port/database
RAILS_SERVE_STATIC_FILES Tell the application to serve static files (you might want to turn this off if you are using an external web server to serve files from the public folder) true
RAILS_LOG_TO_STDOUT Tell the application to log to STDOUT (useful for Docker) true
RAILS_LOG_LEVEL Log level for the application (use debug for maximum information) info
RAILS_MAX_THREADS Maximum number of threads to use in the application (use 1 if multithreading is not desired) 5
RAILS_MIN_THREADS Minimum number of threads to use in the application RAILS_MAX_THREADS value
WEB_CONCURRENCY Number of web server processes to use 2
RUN_SIDEKIQ Run Sidekiq worker process in the docker instance (you might want to change this if want to run different docker instances for Sidekiq and Rails) true
RUN_RAILS Run Rails web server process in the docker instance true
QUEUE_ADAPTER Adapter to use for background jobs (currently the application is using exclusively Sidekiq, so no other options here right now) sidekiq
SIDEKIQ_CONCURRENCY Number of threads to use in Sidekiq 5
STORAGE_PROVIDER Storage provider for the application (currently the application supports local and amazon) local
FORCE_SSL Force SSL connections false
MAIL_LINK_HOST Host to use in the links sent by email (use your domain without protocol mydomain.tld)
MAIL_LINK_PROTOCOL Protocol to use in the previous host defined for links sent by email https
SMTP_ADDRESS SMTP server address (ie: smtp.mailgun.org)
SMTP_PORT SMTP server port (ie: 587)
SMTP_DOMAIN SMTP domain (usually the application's domain)
SMTP_USER_NAME SMTP username
SMTP_PASSWORD SMTP password
SMTP_AUTHENTICATION SMTP authentication method plain
SMTP_ENABLE_STARTTLS_AUTO Enable STARTTLS true
SMTP_OPENSSL_VERIFY_MODE OpenSSL verify mode none
AWS_ACCESS_KEY_ID AWS access key ID (only if STORAGE_PROVIDER is amazon)
AWS_SECRET_ACCESS_KEY AWS secret access key (only if STORAGE_PROVIDER is amazon)
AWS_BUCKET AWS bucket name (only if STORAGE_PROVIDER is amazon)
AWS_REGION AWS region (only if STORAGE_PROVIDER is amazon)
ADMINS Space separated list of emails for the superadmins (ie: admin@timeoverflow.org
markets commented 7 months ago

@microstudi I added some small comments 🙏🏼 and I see there is also 1 failing test: https://github.com/coopdevs/timeoverflow/actions/runs/7800180296/job/21272472836?pr=730#step:5:25. The rest seems good to me 👌🏼.

microstudi commented 7 months ago

@markets the failing test is due the update of the imagemagik library. I've fixed it but something happened with the upload coverage. The rest is applied!