Skip to content

Commit

Permalink
Explain how to run production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
qarol committed Jun 4, 2024
1 parent fb11bdc commit 4835c0d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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"]
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand All @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
x-app: &default-app
build:
context: "."
# target: "app"
args:
- "UID=${UID:-1000}"
- "GID=${GID:-1000}"
Expand All @@ -14,7 +13,7 @@ x-app: &default-app
stop_grace_period: "3s"
tty: true
volumes:
- ".:/app"
- "${DOCKER_WEB_VOLUME:-./log:/app/log}"

services:
postgres:
Expand Down

0 comments on commit 4835c0d

Please sign in to comment.