From 4835c0d249826f6b8b13e33718dba410a22fd529 Mon Sep 17 00:00:00 2001 From: Karol Bajko Date: Tue, 4 Jun 2024 23:06:45 +0200 Subject: [PATCH] Explain how to run production mode --- Dockerfile | 10 ++++------ README.md | 13 ++++++++++--- docker-compose.yaml | 3 +-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a711a8..8dbab55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,8 @@ RUN bundle install --jobs "$(nproc)" --retry 5 COPY . . -#RUN if [ "${RAILS_ENV}" != "development" ]; then \ -# SECRET_KEY_BASE=dummyvalue rake assets:precompile; fi - -RUN SECRET_KEY_BASE=dummyvalue rake assets:precompile +RUN if [ "${RAILS_ENV}" != "development" ]; then \ + SECRET_KEY_BASE=dummyvalue rails assets:precompile; fi CMD ["bash"] @@ -46,8 +44,8 @@ RUN apt-get -q update && \ USER ruby COPY --chown=ruby:ruby --from=builder /usr/local/bundle /usr/local/bundle -COPY --chown=ruby:ruby --from=builder /app/public/assets public/assets +COPY --chown=ruby:ruby --from=builder /app/public public COPY --chown=ruby:ruby . . EXPOSE 8000 -CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] +CMD ["bin/rails", "server", "-b", "0.0.0.0"] diff --git a/README.md b/README.md index 3696ec0..3eb87cf 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,14 @@ Welcome to Typerek! This application allows you and your friends to predict the export DOCKER_BUILDKIT=1 export DOCKER_RESTART_POLICY=unless-stopped export DOCKER_WEB_PORT_FORWARD=8000 - export DOCKER_WEB_VOLUME=./public:/app/public + export DOCKER_WEB_VOLUME=./log:/app/log export PORT=8000 export POSTGRES_PASSWORD=password export POSTGRES_USER=postgres export RAILS_ENV=production export RAILS_LOG_TO_STDOUT=true export RAILS_MAX_THREADS=5 + export RAILS_MIN_THREADS=1 export RAILS_SERVE_STATIC_FILES=true export SECRET_KEY_BASE=insecure_key_for_dev export TYPEREK_ADMIN_PASSWORD=password1! @@ -51,12 +52,13 @@ Welcome to Typerek! This application allows you and your friends to predict the export POSTGRES_USER=postgres export RAILS_ENV=development export RAILS_LOG_TO_STDOUT=true - export RAILS_MAX_THREADS=1 + export RAILS_MAX_THREADS=5 + export RAILS_MIN_THREADS=1 export RAILS_SERVE_STATIC_FILES=true export SECRET_KEY_BASE=insecure_key_for_dev export TYPEREK_ADMIN_PASSWORD=password1! export TYPEREK_ADMIN_USERNAME=admin - export WEB_CONCURRENCY=1 + export WEB_CONCURRENCY=0 ``` ### Running the Application @@ -74,6 +76,11 @@ Welcome to Typerek! This application allows you and your friends to predict the 3. **Access the Application** Open your browser and navigate to `http://localhost:8000` + +### Securing the Application with SSL + +You can use [Caddy](https://caddyserver.com) to secure the application with SSL. + --- If you encounter any issues or have questions, feel free to open an issue or contact the project maintainers. diff --git a/docker-compose.yaml b/docker-compose.yaml index 185d728..6e92ae2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,6 @@ x-app: &default-app build: context: "." -# target: "app" args: - "UID=${UID:-1000}" - "GID=${GID:-1000}" @@ -14,7 +13,7 @@ x-app: &default-app stop_grace_period: "3s" tty: true volumes: - - ".:/app" + - "${DOCKER_WEB_VOLUME:-./log:/app/log}" services: postgres: