-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
ffa75ff
commit 4043e76
Showing
17 changed files
with
164 additions
and
60 deletions.
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 |
---|---|---|
|
@@ -9,3 +9,4 @@ postgres-data | |
redis-data | ||
# Required for puma to have a place to put the pid file | ||
!tmp/pids/.keep | ||
public/assets |
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
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
server 'sul-h2-qa.stanford.edu', user: 'h2', roles: %w[web app db] | ||
# Roles are passed to docker-compose as profiles. | ||
server 'h2-docker-qa.stanford.edu', user: 'h2', roles: %w[web app db cron worker] | ||
|
||
Capistrano::OneTimeKey.generate_one_time_key! |
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
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,66 @@ | ||
version: '3.6' | ||
|
||
services: | ||
app: | ||
build: &build | ||
context: . | ||
dockerfile: docker/app-prod/Dockerfile | ||
args: | ||
- GID=${H2_GID-1000} | ||
- UID=${H2_UID-1000} | ||
- SECRET_KEY_BASE | ||
environment: &environment | ||
- DATABASE_NAME=h2 | ||
- DATABASE_USERNAME | ||
- DATABASE_PASSWORD | ||
- DATABASE_HOSTNAME=host.docker.internal | ||
# for ActionCable | ||
- REDIS_URL=redis://host.docker.internal:6379/ | ||
- SMTP_HOST=host.docker.internal | ||
- HOST | ||
- HONEYBADGER_API_KEY | ||
- SETTINGS__RABBITMQ__PASSWORD | ||
- SETTINGS__RABBITMQ__QUEUES__DEPOSIT_COMPLETE | ||
- SETTINGS__RABBITMQ__QUEUES__DRUID_ASSIGNED | ||
- SETTINGS__RABBITMQ__QUEUES__EMBARGO_LIFTED | ||
- SETTINGS__SDR_API__PASSWORD | ||
- SETTINGS__PRESERVATION_CATALOG__TOKEN | ||
volumes: &volumes | ||
- /opt/app/h2/happy-heron/shared/log:/app/log | ||
- /data/h2-files:/data/h2-files | ||
ports: | ||
- 3000:3000 | ||
extra_hosts: &extra-hosts | ||
- host.docker.internal:host-gateway | ||
profiles: | ||
- web | ||
# restart: on-failure | ||
sneakers: | ||
build: *build | ||
environment: *environment | ||
volumes: *volumes | ||
extra_hosts: *extra-hosts | ||
profiles: | ||
- web | ||
command: bin/bundle exec rake sneakers:run 2>&1 | tee -a log/sneakers.log | ||
# restart: on-failure | ||
sidekiq: | ||
build: *build | ||
environment: *environment | ||
volumes: *volumes | ||
extra_hosts: *extra-hosts | ||
command: bin/bundle exec sidekiq 2>&1 | tee -a log/sidekiq.log | ||
profiles: | ||
- worker | ||
deploy: | ||
replicas: ${SIDEKIQ_COUNT-1} | ||
# restart: on-failure | ||
cron: | ||
build: *build | ||
environment: *environment | ||
volumes: *volumes | ||
extra_hosts: *extra-hosts | ||
profiles: | ||
- cron | ||
command: supercronic /app/config/crontab 2>&1 | tee -a log/cron.log | ||
# restart: on-failure |
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,53 @@ | ||
FROM ruby:3.1-alpine | ||
|
||
# curl is to install supercronic | ||
RUN apk add --update --no-cache \ | ||
build-base \ | ||
postgresql-dev \ | ||
tzdata \ | ||
yarn \ | ||
git \ | ||
curl | ||
|
||
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.1/supercronic-linux-amd64 | ||
ENV SUPERCRONIC=supercronic-linux-amd64 | ||
ENV SUPERCRONIC_SHA1SUM=d7f4c0886eb85249ad05ed592902fa6865bb9d70 | ||
|
||
# Cron replacement, since cron must be run as root | ||
RUN curl -fsSLO "$SUPERCRONIC_URL" \ | ||
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ | ||
&& chmod +x "$SUPERCRONIC" \ | ||
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ | ||
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic | ||
|
||
# Get bundler 2.0 | ||
RUN gem install bundler | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
ARG SECRET_KEY_BASE | ||
ENV SECRET_KEY_BASE=${SECRET_KEY_BASE} | ||
|
||
RUN addgroup -g $GID h2 | ||
RUN adduser -G h2 -u $UID -D h2 | ||
|
||
WORKDIR /app | ||
|
||
COPY Gemfile Gemfile.lock package.json yarn.lock ./ | ||
|
||
ENV RAILS_ENV=production | ||
ENV RAILS_LOG_TO_STDOUT=true | ||
ENV BUNDLE_WITHOUT="test:development:deployment" | ||
ENV NODE_ENV=production | ||
|
||
RUN bundle install | ||
RUN yarn install | ||
|
||
COPY --chown=h2:h2 . . | ||
USER h2:h2 | ||
|
||
RUN bin/rails assets:precompile | ||
# Write out the crontab file | ||
RUN sh -c 'bundle exec whenever . | tee -a config/crontab' | ||
|
||
CMD bin/puma -C config/puma.rb config.ru 2>&1 | tee -a log/production.log |
Oops, something went wrong.