Skip to content

Commit

Permalink
Added unicorn config and made upgrade scripts check for it as well. (#…
Browse files Browse the repository at this point in the history
…723)

* Added unicorn config fixed the cypress upgrade script to check for the config file and add it to the startup script if it exists.

* Ignore contrib/ directory since none of the files in it are required for building and it only slows down the build (significantly if you have built any ova files using the packer scripts)

* Moved away from the rails Dockerfile and over to the ruby one, since the rails one is depreciated and rails is automatically installed by bundler anyway.

* Move over to directly calling unicorn and passing in a config file.
  • Loading branch information
rbclark authored and Michael O'Keefe committed Sep 28, 2016
1 parent 7da81c6 commit b7da683
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tmp/*
uploads/*
bundles/*
log/*
contrib/*
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM rails:4.2.5
FROM ruby:2.2

RUN apt-get update \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*

ENV RAILS_ENV production
ENV RAILS_SERVE_STATIC_FILES 1
Expand Down
2 changes: 2 additions & 0 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
timeout 120
worker_processes 4
8 changes: 8 additions & 0 deletions contrib/upgrade_cypress_300_to_latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ function cypress_cvu_shared_upgrade_commands() {
sudo -E -u cypress env PATH=$PATH bundle exec rake tmp:clear
sudo -E -u cypress env PATH=$PATH bundle exec rake assets:clobber
sudo -E -u cypress env PATH=$PATH bundle exec rake assets:precompile
# If there is a unicorn config file available and we are using unicorn then update the unicorn
# startup script to use it.
if [ -f config/unicorn.rb ]; then
echo "Adding unicorn config to "
sed -E -i '/(--config-file|-c)/!s/unicorn --port ([0-9]{1,5})/unicorn --port \1 --config-file config\/unicorn.rb/' /etc/systemd/system/`basename "$PWD"`.service
fi
}

function upgrade_cypress() {
Expand Down Expand Up @@ -80,6 +86,7 @@ if [ "$CYPRESS_FOUND" = "true" ]; then
upgrade_cypress

echo "Restarting Cypress service..."
systemctl daemon-reload
systemctl restart cypress

echo "Restarting Cypress Delayed Worker service..."
Expand Down Expand Up @@ -108,6 +115,7 @@ if [ "$CVU_FOUND" = "true" ]; then
upgrade_cvu

echo "Restarting Cypress Validation Utility service..."
systemctl daemon-reload
systemctl restart cypress-validation-utility
fi

Expand Down
2 changes: 1 addition & 1 deletion rails-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -e

exec bin/delayed_job start -n 3 &
exec rake assets:precompile &
exec rails s -b 0.0.0.0
exec unicorn -c config/unicorn.rb -p 3000

exec "$@"

0 comments on commit b7da683

Please sign in to comment.