-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tmp | ||
node_modules | ||
*.log | ||
/log | ||
/vendor | ||
.git | ||
.github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM ruby:2.7.6-slim-buster | ||
|
||
RUN apt-get update -yqq && \ | ||
apt-get install -yqq \ | ||
autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev \ | ||
zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev git libgdbm6 libreadline-dev \ | ||
nginx nodejs dirmngr gnupg apt-transport-https ca-certificates npm imagemagick \ | ||
postgresql postgresql-contrib libpq-dev && \ | ||
npm install --global yarn && \ | ||
gem install bundler -v 1.17.3 --no-document | ||
|
||
ADD Gemfile Gemfile.lock Rakefile config.ru .ruby-version ./ | ||
|
||
# Setting MALLOC_ARENA_MAX to 2 can greatly reduce memory usage | ||
ENV MALLOC_ARENA_MAX='2' | ||
ENV HAVEN_DEPLOY="local" | ||
ENV RAILS_ENV=production | ||
ENV RAILS_SERVE_STATIC_FILES=true | ||
|
||
RUN bundle update --bundler && \ | ||
bundle config build.bcrypt --use-system-libraries && \ | ||
bundle install --deployment --without development test | ||
|
||
ADD . . | ||
RUN bin/rails assets:precompile | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["bash", "./bin/docker-start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
bin/rails db:create db:migrate | ||
bin/rails assets:precompile | ||
|
||
bin/rails r ./deploymentscripts/lib/ruby/create_user.rb "[email protected]" ChangeMeN0W | ||
|
||
bin/rails s -e production -p 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: '3.7' | ||
services: | ||
haven: | ||
build: | ||
dockerfile: Dockerfile | ||
depends_on: | ||
- postgresql | ||
ports: | ||
- "3000:3000" | ||
volumes: | ||
- haven_storage:/storage | ||
environment: | ||
- RAILS_ENV=production | ||
- HAVEN_DB_HOST=postgresql | ||
- HAVEN_DB_NAME=haven | ||
- HAVEN_DB_ROLE=haven | ||
- HAVEN_DB_PASSWORD=supersecretrandomstring | ||
|
||
postgresql: | ||
image: postgres:13.2-alpine | ||
ports: | ||
- "5432:5432" | ||
# https://www.postgresql.org/docs/current/static/non-durability.html | ||
command: [ | ||
"postgres", | ||
"-c", "max_connections=1000", | ||
"-c", "synchronous_commit=off", | ||
"-c", "fsync=off", | ||
"-c", "full_page_writes=off", | ||
"-c", "max_wal_size=4GB", | ||
"-c", "checkpoint_timeout=30min", | ||
"-c", "wal_level=logical" | ||
] | ||
environment: | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
POSTGRES_USER: haven | ||
volumes: | ||
- postgresqldata:/var/lib/postgresql/data | ||
|
||
volumes: | ||
postgresqldata: | ||
external: false | ||
haven_storage: | ||
external: false |