Skip to content

Commit

Permalink
ready files ecs transition
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnIckler committed Sep 19, 2023
1 parent 8c0c5aa commit 2430db3
Show file tree
Hide file tree
Showing 45 changed files with 387 additions and 1,614 deletions.
19 changes: 19 additions & 0 deletions WcaOnRails/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore bundler config.
/.bundle

# Ignore all default key files
config/master.key
config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
3 changes: 3 additions & 0 deletions WcaOnRails/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ yarn-debug.log*

# Healthcheck flag for our Rails docker container
.db-inited

# GCE secrets file
**/application_default_credentials.json
30 changes: 29 additions & 1 deletion WcaOnRails/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ ENV DEBIAN_FRONTEND noninteractive
WORKDIR /app
ARG NODE_MAJOR=16

# Set production environment
ENV RAILS_LOG_TO_STDOUT="1" \
RAILS_SERVE_STATIC_FILES="true" \
RAILS_ENV="production" \
BUNDLE_WITHOUT="development:test"

# Add PPA needed to install nodejs.
# From: https://github.com/nodesource/distributions#debian-and-ubuntu-based-distributions
RUN apt-get update && apt-get install -y ca-certificates curl gnupg
Expand All @@ -25,6 +31,28 @@ RUN apt-get update && apt-get install -y \
mariadb-client \
libssl-dev \
libyaml-dev \
python3-pip \
fonts-unfonts-core \
fonts-wqy-microhei \
fonts-ipafont \
lmodern \
libxrender1 \
pipx \
tzdata
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -O wkhtml.tar.xz && tar -xf wkhtml.tar.xz --strip-components=1 -C /usr/local
# Using pipx because PEP668 doesn't allow installing systemwide packages anymore
RUN pipx install wrc

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Install node dependencies
COPY package.json ./
RUN yarn install

RUN gem update --system && gem install bundler
COPY . .

# Entrypoint prepares database and starts app on 0.0.0.0:3000 by default,
# but can also take a rails command, like "console" or "runner" to start instead.
ENTRYPOINT ["/app/bin/docker-entrypoint"]
EXPOSE 3000
30 changes: 30 additions & 0 deletions WcaOnRails/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ruby:3.2.2
EXPOSE 3000

ENV DEBIAN_FRONTEND noninteractive
WORKDIR /app
ARG NODE_MAJOR=16

# Add PPA needed to install nodejs.
# From: https://github.com/nodesource/distributions#debian-and-ubuntu-based-distributions
RUN apt-get update && apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

# Add PPA needed to install yarn.
# From: https://yarnpkg.com/en/docs/install#debian-stable
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list

RUN apt-get update && apt-get install -y \
git \
yarn \
build-essential \
nodejs \
mariadb-client \
libssl-dev \
libyaml-dev \
tzdata

RUN gem update --system && gem install bundler
2 changes: 1 addition & 1 deletion WcaOnRails/app_secrets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def vault_file(secret_name, file_path)
vault :NEW_RELIC_LICENSE_KEY
vault :SMTP_USERNAME
vault :SMTP_PASSWORD
vault_file :GOOGLE_APPLICATION_CREDENTIALS, "../secrets/application_default_credentials.json"
vault_file :GOOGLE_APPLICATION_CREDENTIALS, "./application_default_credentials.json"
else
mandatory :DATABASE_PASSWORD, :string
mandatory :GOOGLE_MAPS_API_KEY, :string
Expand Down
16 changes: 16 additions & 0 deletions WcaOnRails/bin/docker-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

if [ $# -eq 0 ]; then

# We need all the environment variables to be there to precompile assets
./bin/bundle exec i18n export
./bin/bundle exec rails assets:precompile
# Create new or migrate existing database
./bin/rails db:prepare

# Start the server by default
exec bin/rails server
else
# Allow other commands, like console or runner, to be called
exec bin/rails "$@"
fi
1 change: 0 additions & 1 deletion WcaOnRails/public/uploads

This file was deleted.

4 changes: 0 additions & 4 deletions chef/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions chef/Berksfile

This file was deleted.

45 changes: 0 additions & 45 deletions chef/Berksfile.lock

This file was deleted.

Empty file.
Empty file removed chef/environments/development.rb
Empty file.
Empty file removed chef/environments/production.rb
Empty file.
Empty file removed chef/environments/staging.rb
Empty file.
46 changes: 0 additions & 46 deletions chef/roles/wca.json

This file was deleted.

1 change: 0 additions & 1 deletion chef/site-cookbooks/wca/README.md

This file was deleted.

90 changes: 0 additions & 90 deletions chef/site-cookbooks/wca/chefignore

This file was deleted.

22 changes: 0 additions & 22 deletions chef/site-cookbooks/wca/libraries/wca_helper.rb

This file was deleted.

9 changes: 0 additions & 9 deletions chef/site-cookbooks/wca/metadata.rb

This file was deleted.

7 changes: 0 additions & 7 deletions chef/site-cookbooks/wca/recipes/base.rb

This file was deleted.

Loading

0 comments on commit 2430db3

Please sign in to comment.