diff --git a/Dockerfile b/Dockerfile index d024cc4a..b945e48d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,16 +13,4 @@ RUN bundle install COPY . /usr/src/app EXPOSE 3000 - -# install s6overlay so that we can run cron inside this container as well. -ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/ -RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / \ - && mkdir /config \ - && apt-get update \ - && apt-get install -y cron \ - && rm -rf /var/lib/apt/lists/* - -COPY rootfs/ / -VOLUME ["/config"] - -ENTRYPOINT ["/init"] +CMD ["./entrypoint.sh"] diff --git a/Gemfile.lock b/Gemfile.lock index ff87f8c4..e806f8cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,7 +56,7 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) aws-eventstream (1.1.1) aws-partitions (1.444.0) @@ -151,7 +151,7 @@ GEM listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.9.1) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -163,7 +163,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) mini_mime (1.1.0) - mini_portile2 (2.5.0) + mini_portile2 (2.8.0) mini_racer (0.4.0) libv8-node (~> 15.14.0.0) minitest (5.14.4) @@ -172,9 +172,9 @@ GEM mustermann (1.1.1) ruby2_keywords (~> 0.0.1) nenv (0.3.0) - nio4r (2.5.7) - nokogiri (1.11.3) - mini_portile2 (~> 2.5.0) + nio4r (2.5.8) + nokogiri (1.13.10) + mini_portile2 (~> 2.8.0) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -191,9 +191,9 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) - puma (4.3.7) + puma (4.3.9) nio4r (~> 2.0) - racc (1.5.2) + racc (1.6.1) rack (2.2.3) rack-cache (1.12.1) rack (>= 0.4) @@ -223,8 +223,8 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging @@ -240,7 +240,7 @@ GEM rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.3.0) + rdoc (6.3.2) rexml (3.2.5) rspec (3.10.0) rspec-core (~> 3.10.0) diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f733720a --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +GCLOUD_PROJECT:=$(shell gcloud config list project --format="value(core.project)") +PROJECT_NAME:=klaxon + +build: + docker build -t us.gcr.io/$(GCLOUD_PROJECT)/$(PROJECT_NAME) . + +push: build + docker push us.gcr.io/$(GCLOUD_PROJECT)/$(PROJECT_NAME) \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index fa346664..6abf5c07 100644 --- a/config/database.yml +++ b/config/database.yml @@ -16,4 +16,8 @@ test: production: <<: *default - url: <%= ENV['DATABASE_URL'] %> + database: <%= ENV.fetch('DB_NAME') %> + username: <%= ENV.fetch('DB_USER') %> + password: <%= ENV.fetch('DB_PASSWORD') %> + host: <%= ENV.fetch('DB_HOST', 'localhost') %> + port: 5432 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..a0531777 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Precompile files +bundle exec rake assets:precompile + +# Run the server +bundle exec puma -C config/puma.rb diff --git a/rootfs/etc/services.d/cron/finish b/rootfs/etc/services.d/cron/finish deleted file mode 100644 index 8eebbb53..00000000 --- a/rootfs/etc/services.d/cron/finish +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/execlineb -S0 - -echo "crond exiting" -s6-svscanctl -t /var/run/s6/services \ No newline at end of file diff --git a/rootfs/etc/services.d/cron/run b/rootfs/etc/services.d/cron/run deleted file mode 100644 index 1c9533ac..00000000 --- a/rootfs/etc/services.d/cron/run +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/with-contenv bash - -echo "starting cron" - -#fix link-count, as cron is being a pain, and docker is making hardlink count >0 (very high) -touch /etc/crontab /etc/cron.*/* - -exec cron -L 8 -f diff --git a/rootfs/etc/services.d/klaxon/finish b/rootfs/etc/services.d/klaxon/finish deleted file mode 100644 index 572c8464..00000000 --- a/rootfs/etc/services.d/klaxon/finish +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/execlineb -S0 - -echo "klaxon exiting" -s6-svscanctl -t /var/run/s6/services \ No newline at end of file diff --git a/rootfs/etc/services.d/klaxon/run b/rootfs/etc/services.d/klaxon/run deleted file mode 100644 index 345ad83b..00000000 --- a/rootfs/etc/services.d/klaxon/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -echo "starting klaxon" -cd /usr/src/app -bundle exec puma -C "config/puma.rb"