Commit b73a5e4a authored by Aleksander Piotrowski's avatar Aleksander Piotrowski
Browse files

bugfix v1 add relase

parent 3639edc3
......@@ -2,51 +2,52 @@ stages:
- test
- build
- deploy
- release
variables:
WEB_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_NAME}/web
WEB_CONTAINER_NAME: 'geoankieta_${CI_COMMIT_REF_NAME}_web'
WEB_VIRTUAL_HOST: api.${CI_COMMIT_REF_NAME}.thebitbybit.com
WEB_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/web
WEB_CONTAINER_NAME: api.${CI_COMMIT_REF_SLUG}.thebitbybit.com
WEB_VIRTUAL_HOST: api.${CI_COMMIT_REF_SLUG}.thebitbybit.com
GEOFORMS_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_NAME}/geoforms
GEOFORMS_CONTAINER_NAME: 'geoankieta_${CI_COMMIT_REF_NAME}_geoforms'
GEOFORMS_VIRTUAL_HOST: geoforms.${CI_COMMIT_REF_NAME}.thebitbybit.com
GEOFORMS_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/geoforms
GEOFORMS_CONTAINER_NAME: geoforms.${CI_COMMIT_REF_SLUG}.thebitbybit.com
GEOFORMS_VIRTUAL_HOST: geoforms.${CI_COMMIT_REF_SLUG}.thebitbybit.com
PANEL_FORMS_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_NAME}/panel_forms
PANEL_FORMS_CONTAINER_NAME: 'geoankieta_${CI_COMMIT_REF_NAME}_panel_forms'
PANEL_FORMS_VIRTUAL_HOST: panel.forms.${CI_COMMIT_REF_NAME}.thebitbybit.com
PANEL_FORMS_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/panel_forms
PANEL_FORMS_CONTAINER_NAME: panel.forms.${CI_COMMIT_REF_SLUG}.thebitbybit.com
PANEL_FORMS_VIRTUAL_HOST: panel.forms.${CI_COMMIT_REF_SLUG}.thebitbybit.com
PANEL_DISCUSS_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_NAME}/panel_discuss
PANEL_DISCUSS_CONTAINER_NAME: 'geoankieta_${CI_COMMIT_REF_NAME}_panel_discuss'
PANEL_DISCUSS_VIRTUAL_HOST: panel.discuss.${CI_COMMIT_REF_NAME}.thebitbybit.com
PANEL_DISCUSS_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/panel_discuss
PANEL_DISCUSS_CONTAINER_NAME: panel.discuss.${CI_COMMIT_REF_SLUG}.thebitbybit.com
PANEL_DISCUSS_VIRTUAL_HOST: panel.discuss.${CI_COMMIT_REF_SLUG}.thebitbybit.com
API_URL: "http://api.${CI_COMMIT_REF_NAME}.thebitbybit.com/"
MEDIA_URL: "http://api.${CI_COMMIT_REF_NAME}.thebitbybit.com"
LOGIN_URL: "http://api.${CI_COMMIT_REF_NAME}.thebitbybit.com/accounts/"
GEOFORMS_URL: "http://geoforms.${CI_COMMIT_REF_NAME}.thebitbybit.com/"
DISCUSS_URL: "http://api.${CI_COMMIT_REF_NAME}.thebitbybit.com/"
API_URL: "https://api.${CI_COMMIT_REF_SLUG}.thebitbybit.com/"
MEDIA_URL: "https://api.${CI_COMMIT_REF_SLUG}.thebitbybit.com"
LOGIN_URL: "https://api.${CI_COMMIT_REF_SLUG}.thebitbybit.com/accounts/"
GEOFORMS_URL: "https://geoforms.${CI_COMMIT_REF_SLUG}.thebitbybit.com/"
DISCUSS_URL: "https://api.${CI_COMMIT_REF_SLUG}.thebitbybit.com/"
GEOPINE_IMAGE_BACKEND: "registry.recoded.co/geoplan/geoankieta/geopine:backend"
GEOPINE_IMAGE_FRONTEND: "registry.recoded.co/geoplan/geoankieta/geopine:frontend"
GEO_VOLUME: 'geoankieta_${CI_COMMIT_REF_NAME}'
GEO_VOLUME: 'geoankieta_${CI_COMMIT_REF_SLUG}'
DB_URL: "${DATABASE}${CI_COMMIT_REF_NAME}"
ENABLE_HTTPS: "True"
DB_URL: "${DATABASE}${CI_COMMIT_REF_SLUG}"
DEBUG: "on"
SECRET_KEY: "%zhtwec#e&1x=@*vgl&@)tj1x(8kf4)w3g#c)tj#vk*x&f^z@0"
ENV: "development"
MINIFY: "true"
MINIFY: "True"
test_web:
stage: test
image: registry.recoded.co/geoplan/geoankieta/geopine
image: $GEOPINE_IMAGE_BACKEND
services:
- name: mdillon/postgis:9.6-alpine
alias: test
tags:
- test
except:
- tags
- develop
- staging
- master
......@@ -65,10 +66,11 @@ test_web:
test_geoforms:
stage: test
image: registry.recoded.co/geoplan/geoankieta/geopine
image: $GEOPINE_IMAGE_FRONTEND
tags:
- test
except:
- tags
- develop
- staging
- master
......@@ -83,10 +85,11 @@ test_geoforms:
test_panel_forms:
stage: test
image: registry.recoded.co/geoplan/geoankieta/geopine
image: $GEOPINE_IMAGE_FRONTEND
tags:
- test
except:
- tags
- develop
- staging
- master
......@@ -101,10 +104,11 @@ test_panel_forms:
test_panel_discuss:
stage: test
image: registry.recoded.co/geoplan/geoankieta/geopine
image: $GEOPINE_IMAGE_FRONTEND
tags:
- test
except:
- tags
- develop
- staging
- master
......@@ -129,11 +133,10 @@ build_web:
- schedules
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $GEOPINE_IMAGE_BACKEND
- docker build -t $WEB_IMAGE_NAME:${VERSION} -f web/Dockerfile.release web/
- docker push $WEB_IMAGE_NAME:${VERSION}
- docker build -t $WEB_IMAGE_NAME:${CI_COMMIT_REF_SLUG} -f web/Dockerfile.release web/
- docker push $WEB_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
build_geoforms:
stage: build
......@@ -147,11 +150,10 @@ build_geoforms:
- schedules
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $GEOPINE_IMAGE_FRONTEND
- docker build -t $GEOFORMS_IMAGE_NAME:${VERSION} -f geoforms/Dockerfile.release geoforms/
- docker push $GEOFORMS_IMAGE_NAME:${VERSION}
- docker build -t $GEOFORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG} -f geoforms/Dockerfile.release geoforms/
- docker push $GEOFORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
build_admin:
stage: build
......@@ -167,11 +169,10 @@ build_admin:
HASH: $REACT_APP_HASH
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $GEOPINE_IMAGE_FRONTEND
- docker build --build-arg REACT_APP_HASH=$HASH -t $PANEL_FORMS_IMAGE_NAME:${VERSION} -f admin/Dockerfile.release admin/
- docker push $PANEL_FORMS_IMAGE_NAME:${VERSION}
- docker build --build-arg REACT_APP_HASH=$HASH -t $PANEL_FORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG} -f admin/Dockerfile.release admin/
- docker push $PANEL_FORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
build_panel_discuss:
stage: build
......@@ -187,11 +188,10 @@ build_panel_discuss:
HASH: $REACT_APP_HASH
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $GEOPINE_IMAGE_FRONTEND
- docker build --build-arg REACT_APP_HASH=$HASH -t $PANEL_DISCUSS_IMAGE_NAME:${VERSION} -f panel_discuss/Dockerfile.release panel_discuss/
- docker push $PANEL_DISCUSS_IMAGE_NAME:${VERSION}
- docker build --build-arg REACT_APP_HASH=$HASH -t $PANEL_DISCUSS_IMAGE_NAME:${CI_COMMIT_REF_SLUG} -f panel_discuss/Dockerfile.release panel_discuss/
- docker push $PANEL_DISCUSS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
deploy_web:
stage: deploy
......@@ -206,13 +206,12 @@ deploy_web:
environment: develop
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
- docker volume create $GEO_VOLUME
script:
- docker pull $WEB_IMAGE_NAME:${VERSION}
- docker pull $WEB_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
- docker stop $WEB_CONTAINER_NAME || true
- docker rm $WEB_CONTAINER_NAME || true
- docker run --name $WEB_CONTAINER_NAME -d -v $GEO_VOLUME:/srv/app/media/ -e MINIFY=$MINIFY --restart always -e VIRTUAL_HOST=$WEB_VIRTUAL_HOST -e DEBUG=$DEBUG -e SECRET_KEY=$SECRET_KEY -e DATABASE_URL=$DB_URL -e GOOGLE_API_KEY=$GOOGLE_API_KEY -e EMAIL_URL=$EMAIL_URL --link postgis:db $WEB_IMAGE_NAME:${VERSION}
- docker run --name $WEB_CONTAINER_NAME -d -v $GEO_VOLUME:/srv/app/media/ -e MINIFY=$MINIFY -e VIRTUAL_HOST=$WEB_VIRTUAL_HOST -e LETSENCRYPT_HOST=$WEB_VIRTUAL_HOST -e DEBUG=$DEBUG -e ENABLE_HTTPS=$ENABLE_HTTPS -e SECRET_KEY=$SECRET_KEY -e DATABASE_URL=$DB_URL -e GOOGLE_API_KEY=$GOOGLE_API_KEY -e EMAIL_URL=$EMAIL_URL --link postgis:db $WEB_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
after_script:
- docker exec $WEB_CONTAINER_NAME python manage.py migrate
- docker exec $WEB_CONTAINER_NAME python manage.py add_local_host_site
......@@ -232,12 +231,11 @@ deploy_geoforms:
environment: develop
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $GEOFORMS_IMAGE_NAME:${VERSION}
- docker pull $GEOFORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
- docker stop $GEOFORMS_CONTAINER_NAME || true
- docker rm $GEOFORMS_CONTAINER_NAME || true
- docker run --name $GEOFORMS_CONTAINER_NAME -d --restart always -e VIRTUAL_HOST=$GEOFORMS_VIRTUAL_HOST -e REACT_APP_ENV=$ENV -e REACT_APP_API_URL=$API_URL -e REACT_APP_MEDIA_URL=$MEDIA_URL -e REACT_APP_GOOGLE_ANALYTICS_ID=$GOOGLE_ANALYTICS_ID $GEOFORMS_IMAGE_NAME:${VERSION}
- docker run --name $GEOFORMS_CONTAINER_NAME -d -e VIRTUAL_HOST=$GEOFORMS_VIRTUAL_HOST -e LETSENCRYPT_HOST=$GEOFORMS_VIRTUAL_HOST -e REACT_APP_ENV=$ENV -e REACT_APP_API_URL=$API_URL -e REACT_APP_MEDIA_URL=$MEDIA_URL -e REACT_APP_GOOGLE_ANALYTICS_ID=$GOOGLE_ANALYTICS_ID $GEOFORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
deploy_admin:
stage: deploy
......@@ -252,12 +250,11 @@ deploy_admin:
environment: develop
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $PANEL_FORMS_IMAGE_NAME:${VERSION}
- docker pull $PANEL_FORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
- docker stop $PANEL_FORMS_CONTAINER_NAME || true
- docker rm $PANEL_FORMS_CONTAINER_NAME || true
- docker run --name $PANEL_FORMS_CONTAINER_NAME -d --restart always -e VIRTUAL_HOST=$PANEL_FORMS_VIRTUAL_HOST -e REACT_APP_GEOFORMS_URL=$GEOFORMS_URL -e REACT_APP_LOGIN_URL=$LOGIN_URL -e REACT_APP_ENV=$ENV -e REACT_APP_API_URL=$API_URL -e REACT_APP_MEDIA_URL=$MEDIA_URL $PANEL_FORMS_IMAGE_NAME:${VERSION}
- docker run --name $PANEL_FORMS_CONTAINER_NAME -d -e VIRTUAL_HOST=$PANEL_FORMS_VIRTUAL_HOST -e LETSENCRYPT_HOST=$PANEL_FORMS_VIRTUAL_HOST -e REACT_APP_GEOFORMS_URL=$GEOFORMS_URL -e REACT_APP_LOGIN_URL=$LOGIN_URL -e REACT_APP_ENV=$ENV -e REACT_APP_API_URL=$API_URL -e REACT_APP_MEDIA_URL=$MEDIA_URL $PANEL_FORMS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
deploy_panel_discuss:
stage: deploy
......@@ -272,12 +269,37 @@ deploy_panel_discuss:
environment: develop
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
- if [ $CI_COMMIT_REF_NAME = "master" ]; then VERSION=`date +"%y.%m"`; else VERSION="latest"; fi
script:
- docker pull $PANEL_DISCUSS_IMAGE_NAME:${VERSION}
- docker pull $PANEL_DISCUSS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
- docker stop $PANEL_DISCUSS_CONTAINER_NAME || true
- docker rm $PANEL_DISCUSS_CONTAINER_NAME || true
- docker run --name $PANEL_DISCUSS_CONTAINER_NAME -d --restart always -e VIRTUAL_HOST=$PANEL_DISCUSS_VIRTUAL_HOST -e REACT_APP_DISCUSS_URL=$DISCUSS_URL -e REACT_APP_LOGIN_URL=$LOGIN_URL -e REACT_APP_ENV=$ENV -e REACT_APP_API_URL=$API_URL -e REACT_APP_MEDIA_URL=$MEDIA_URL $PANEL_DISCUSS_IMAGE_NAME:${VERSION}
- docker run --name $PANEL_DISCUSS_CONTAINER_NAME -d -e VIRTUAL_HOST=$PANEL_DISCUSS_VIRTUAL_HOST -e LETSENCRYPT_HOST=$PANEL_DISCUSS_VIRTUAL_HOST -e REACT_APP_DISCUSS_URL=$DISCUSS_URL -e REACT_APP_LOGIN_URL=$LOGIN_URL -e REACT_APP_ENV=$ENV -e REACT_APP_API_URL=$API_URL -e REACT_APP_MEDIA_URL=$MEDIA_URL $PANEL_DISCUSS_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
release:
stage: release
only:
- tags
tags:
- build
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.recoded.co
script:
# - WEB
- docker pull $WEB_IMAGE_NAME:staging
- docker tag $WEB_IMAGE_NAME:staging $WEB_IMAGE_NAME:${CI_COMMIT_TAG}
- docker push $WEB_IMAGE_NAME:${CI_COMMIT_TAG}
# - GEOFORMS
- docker pull $GEOFORMS_IMAGE_NAME:staging
- docker tag $GEOFORMS_IMAGE_NAME:staging $GEOFORMS_IMAGE_NAME:${CI_COMMIT_TAG}
- docker push
# - PANEL_FORMS
- docker pull $PANEL_FORMS_IMAGE_NAME:staging
- docker tag $PANEL_FORMS_IMAGE_NAME:staging $PANEL_FORMS_IMAGE_NAME:${CI_COMMIT_TAG}
- docker push $PANEL_FORMS_IMAGE_NAME:${CI_COMMIT_TAG}
# - PANEL_DISCUSS
- docker pull $PANEL_DISCUSS_IMAGE_NAME:staging
- docker tag $PANEL_DISCUSS_IMAGE_NAME:staging $PANEL_DISCUSS_IMAGE_NAME:${CI_COMMIT_TAG}
- docker push $PANEL_DISCUSS_IMAGE_NAME:${CI_COMMIT_TAG}
build_geopine:
stage: build
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment