Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
🔧 Cleanup and fixes for Travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeribekker committed Jul 21, 2020
1 parent 0b00709 commit af41927
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 53 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ local.py
.env

# Static files build by gulp
src/kcc/static/css/admin/admin_overrides.css
src/kcc/static/css/screen.css
src/verzoeken/static/css/admin/admin_overrides.css
src/verzoeken/static/css/screen.css

src/kcc/static/fonts/
src/kcc/static/js/
src/verzoeken/static/fonts/
src/verzoeken/static/js/
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ jobs:
before_install: skip
install: skip
before_script: skip
script: echo "noop"
after_success: echo "trigger deploy?"
script: echo "deploying..."
deploy:
- provider: script
script: bin/release-docker-image.sh latest
script: bash bin/cicd.sh latest no
on:
branch: master

- provider: script
script: bin/release-docker-image.sh $TRAVIS_TAG
script: bash bin/cicd.sh $TRAVIS_TAG yes
on:
tags: true

Expand Down
2 changes: 1 addition & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ The easiest way to get the project started is by using `Docker Compose`_.
system you can run ``docker system prune``.

.. _Docker Compose: https://docs.docker.com/compose/install/
.. _Github: https://github.com/maykinmedia/verzoeken/
.. _Github: https://github.com/VNG-Realisatie/verzoeken/


More Docker
Expand Down
6 changes: 3 additions & 3 deletions bin/compile_dependencies.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ pip-compile^
requirements/testing.in^
requirements/dev.in

REM Jenkins/tests deps
REM ci/tests deps
pip-compile^
--no-index^
--output-file requirements/jenkins.txt^
--output-file requirements/ci.txt^
requirements/base.txt^
requirements/dev.txt^
requirements/jenkins.in
requirements/ci.in
2 changes: 1 addition & 1 deletion bin/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
volumes:
- ${WORKSPACE}/reports:/app/reports
environment:
- DJANGO_SETTINGS_MODULE=verzoeken.conf.jenkins
- DJANGO_SETTINGS_MODULE=verzoeken.conf.ci
- SECRET_KEY=jenkins
- DB_NAME=postgres
- DB_USER=postgres
Expand Down
15 changes: 3 additions & 12 deletions bin/docker_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@

set -ex

# Wait for the database container
# See: https://docs.docker.com/compose/startup-order/
export PGHOST=${DB_HOST:-db}
export PGPORT=${DB_PORT:-5432}

fixtures_dir=${FIXTURES_DIR:-/app/fixtures}

uwsgi_port=${UWSGI_PORT:-8000}

until pg_isready; do
>&2 echo "Waiting for database connection..."
sleep 1
done

>&2 echo "Database is up."
# Wait for required services
${SCRIPTPATH}/wait_for_db.sh

# Apply database migrations
>&2 echo "Apply database migrations"
Expand All @@ -29,7 +20,7 @@ if [ -d $fixtures_dir ]; then
for fixture in $(ls "$fixtures_dir/"*.json)
do
echo "Loading fixture $fixture"
src/manage.py loaddata $fixture
python src/manage.py loaddata $fixture
done
fi

Expand Down
5 changes: 3 additions & 2 deletions bin/release-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ CONTAINER_REPO=vngr/verzoeken-api

git_tag=$(git tag --points-at HEAD) &>/dev/null
git_branch=$(git rev-parse --abbrev-ref HEAD)
git_commit=$(git rev-parse HEAD)


build_image() {
tag=$1
docker build \
--build-arg COMMIT_HASH=${git_commit} \
--target production \
-t ${CONTAINER_REPO}:$tag \
-f Dockerfile .
Expand Down Expand Up @@ -47,7 +49,6 @@ if [[ -n "$git_tag" ]]; then
echo "Building image for git tag $git_tag"
fi

_release_tag=$(get_release_tag)
release_tag=${1:-$_release_tag}
release_tag=$(get_release_tag)
build_image $release_tag
push_image $release_tag
26 changes: 0 additions & 26 deletions bin/runtests.sh

This file was deleted.

17 changes: 17 additions & 0 deletions bin/wait_for_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -e

# Wait for the database container
# See: https://docs.docker.com/compose/startup-order/
db_host=${DB_HOST:-db}
db_user=${DB_USER:-postgres}
db_password=${DB_PASSWORD}
db_port=${DB_PORT:-5432}

until PGPORT=$db_port PGPASSWORD=$db_password psql -h "$db_host" -U "$db_user" -c '\q'; do
>&2 echo "Waiting for database connection..."
sleep 1
done

>&2 echo "Database is up."

0 comments on commit af41927

Please sign in to comment.