-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1050 from 18F/develop
Fix for nginx buildpack and other issues
- Loading branch information
Showing
13 changed files
with
275 additions
and
85 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 |
---|---|---|
|
@@ -16,5 +16,3 @@ Guardfile | |
/node_modules | ||
Dockerfile | ||
Dockerfile.production | ||
|
||
nginx.conf |
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,46 +1,158 @@ | ||
version: 2 | ||
version: 2.1 | ||
jobs: | ||
build: | ||
stage_deploy: | ||
docker: | ||
- image: cimg/ruby:2.7.8-browsers | ||
steps: | ||
- image: cimg/ruby:3.1.4-browsers | ||
steps: | ||
- checkout | ||
|
||
- run: | ||
name: Replace Data URL in _config.yml file when deploying to staging | ||
command: | | ||
sed -i 's@url: https://analytics\.usa\.gov@url: https://analytics-staging.app.cloud.gov@g' _config.yml | ||
sed -i 's@ - name: analytics@ - name: analytics-staging@g' manifest.yml | ||
sed -i 's@- analytics-s3@- analytics-s3-dev@g' manifest.yml | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
- v1-dependencies- | ||
|
||
- run: | ||
name: install dependencies | ||
command: bundle install --jobs=4 --retry=3 && bundle config set --local path 'vendor/bundle' | ||
|
||
- save_cache: | ||
paths: | ||
- ./vendor/bundle | ||
key: v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
|
||
- run: | ||
name: install npm dependencies | ||
command: | | ||
npm install | ||
sudo npm install -g eslint | ||
sudo npm install -g webpack | ||
sudo npm install -g envsub | ||
- run: | ||
name: lint javascript | ||
command: npm run lint | ||
|
||
- run: | ||
name: run tests | ||
command: npm run test | ||
|
||
- run: | ||
name: bundle for production javascript | ||
command: npm run build-prod | ||
|
||
- run: | ||
name: install gems | ||
command: bundle install | ||
|
||
- run: | ||
name: build site | ||
command: bundle exec jekyll build | ||
|
||
- run: | ||
name: Run Envsubst on nginx.conf | ||
command: envsubst '${S3_BUCKET_URL}' < nginx.conf.src > nginx.conf && pwd && cat nginx.conf | ||
|
||
- run: | ||
name: Install CF CLI | ||
command: | | ||
sudo wget --user-agent "Mozilla" -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - && sudo echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list && sudo apt-get update && sudo apt-get -y install cf8-cli curl | ||
- run: | ||
name: deploy | ||
command: | | ||
set -e | ||
# Log into cloud.gov | ||
cf api api.fr.cloud.gov | ||
cf login -u $CF_USERNAME -p $CF_PASSWORD -o gsa-opp-analytics -s analytics-dev | ||
cf push -f "./manifest.yml" | ||
cf logout | ||
main_deploy: | ||
docker: | ||
- image: cimg/ruby:3.1.4-browsers | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
- v1-dependencies- | ||
|
||
- run: | ||
name: install dependencies | ||
command: bundle install --jobs=4 --retry=3 --path vendor/bundle | ||
command: bundle install --jobs=4 --retry=3 && bundle config set --local path 'vendor/bundle' | ||
|
||
- save_cache: | ||
paths: | ||
- ./vendor/bundle | ||
key: v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
|
||
- run: | ||
name: install npm dependencies | ||
command: | | ||
npm install | ||
sudo npm install -g eslint | ||
sudo npm install -g webpack | ||
sudo npm install -g envsub | ||
- run: | ||
name: lint javascript | ||
command: npm run lint | ||
|
||
- run: | ||
name: run tests | ||
command: npm run test | ||
|
||
- run: | ||
name: bundle for production javascript | ||
command: npm run build-prod | ||
|
||
- run: | ||
name: install gems | ||
command: bundle install | ||
|
||
- run: | ||
name: build site | ||
command: bundle exec jekyll build | ||
# Install Cloud Foundry cli (cf) before deploy step. cf is used to push to Cloud.gov | ||
command: bundle exec jekyll build | ||
|
||
- run: | ||
name: install-cf-cli | ||
name: Run Envsubst on nginx.conf | ||
command: envsubst '${S3_BUCKET_URL}' < nginx.conf.src > nginx.conf && pwd && cat nginx.conf | ||
|
||
- run: | ||
name: Install CF CLI | ||
command: | | ||
curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github' | ||
sudo dpkg -i cf-cli_amd64.deb | ||
cf -v | ||
sudo wget --user-agent "Mozilla" -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - && sudo echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list && sudo apt-get update && sudo apt-get -y install cf8-cli curl | ||
- run: | ||
name: deploy develop and master branches to cloud.gov | ||
command: bin/deploy-ci.sh | ||
name: deploy | ||
command: | | ||
set -e | ||
# Log into cloud.gov | ||
cf api api.fr.cloud.gov | ||
cf login -u $CF_USERNAME -p $CF_PASSWORD -o gsa-opp-analytics -s analytics-dev | ||
cf push -f "./manifest.yml" | ||
cf logout | ||
workflows: | ||
stage_workflow: | ||
jobs: | ||
- stage_deploy: | ||
filters: | ||
branches: | ||
only: | ||
- develop | ||
|
||
main_workflow: | ||
jobs: | ||
- main_deploy: | ||
filters: | ||
branches: | ||
only: | ||
- master |
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 |
---|---|---|
|
@@ -16,3 +16,4 @@ _site | |
/node_modules | ||
Dockerfile | ||
Dockerfile.production | ||
/check |
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,15 +1,16 @@ | ||
source "https://rubygems.org" | ||
|
||
ruby '2.7.8' | ||
ruby '3.1.4' | ||
|
||
gem 'jekyll', '~> 3.9.0' | ||
gem 'jekyll', '~> 4.3.2' | ||
gem 'bourbon', '~> 4.3.4' | ||
gem 'kramdown-parser-gfm' | ||
gem 'sass', '~> 3.4.24' | ||
gem 'neat', '~> 2.1.0' | ||
gem "webrick", "~> 1.8" | ||
|
||
group :jekyll_plugins do | ||
gem 'jekyll-datapage-generator' | ||
gem 'jekyll-redirect-from' | ||
gem 'jekyll-sitemap' | ||
end | ||
end |
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 was deleted.
Oops, something went wrong.
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,4 @@ | ||
--- | ||
packages: | ||
- inotify-tools | ||
- gettext-base |
This file was deleted.
Oops, something went wrong.
Empty file.
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,2 @@ | ||
#!/bin/sh | ||
nginx -p $PWD -c nginx.conf |
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,12 +1,12 @@ | ||
--- | ||
applications: | ||
- name: analytics | ||
instances: 2 | ||
memory: 128M | ||
buildpack: staticfile_buildpack | ||
stack: cflinuxfs4 | ||
- name: analytics-staging | ||
instances: 1 | ||
memory: 128M | ||
buildpack: staticfile_buildpack | ||
stack: cflinuxfs4 | ||
- name: analytics | ||
instances: 1 | ||
memory: 128M | ||
buildpacks: | ||
- https://github.com/cloudfoundry/apt-buildpack | ||
- nginx_buildpack | ||
stack: cflinuxfs4 | ||
services: | ||
- analytics-s3 | ||
command: "chmod +x ./entrypoint.sh && ./entrypoint.sh" |
Oops, something went wrong.