Deployment of www.deployctl.com with Gitlab and deployctl.
gitlab-ci.yml
This examples is how this webpage is deployed.
The Jekyll source is located under the directory web and the build stage
produces the output in the directory web/_site
,
which is then uploaded to the artifacts
, to be used for deployment for review/staging and/or production.
Every commit on a branch produces a review/branch_slug
web-deployment, where as a commit/merge to master results in a staging environment for final review, if ok, it needs a manual interaction to be deployed to the production environment.
Only production environment is deployed to www.deployctl.com
and only production environment can have https if DEPLOY_CONFIG_HTTPS: "True"
.
stages:
- build
- review
- staging
- production
variables:
# define the project path slug,
# build will fail if not correct with suggestion how to fix!
CI_PROJECT_PATH_SLUG: "deployctl-www-deployctl-com"
#
# Domain name of our deployment server
DEPLOY_DOMAIN_APP: "gioxapp.com"
#
# Production Domain Name
DEPLOY_DOMAIN : "www.deployctl.com"
#
# For production only, request https
DEPLOY_CONFIG_HTTPS: "True"
#
# Define where the `content` can be found, and where to copy it too
DEPLOY_PUBLISH_PATH: '["/":"/web/_site/"]'
# Build the web-site
build:
stage: build
image: ruby:2.3
script:
- cd web
- bundle install
- bundle exec jekyll build
artifacts:
paths:
- web/site
tags:
- jekyll
# Review of branches
review:
stage: review
variables:
GIT_STRATEGY: none
script:
- deployctl static
environment:
name: review/$CI_BUILD_REF_NAME
url: |-
http://
$CI_ENVIRONMENT_SLUG.
$CI_PROJECT_PATH_SLUG.
$DEPLOY_DOMAIN_APP
on_stop: stop_review
only:
- branches
except:
- master
tags:
- deployctl-gioxapp.com
stop_review:
stage: review
dependencies: []
script:
- deployctl delete
variables:
GIT_STRATEGY: none
when: manual
environment:
name: review/$CI_BUILD_REF_NAME
action: stop
only:
- branches
except:
- master
tags:
- deployctl-gioxapp.com
# Review of the Master
staging:
stage: staging
variables:
GIT_STRATEGY: none
script:
- deployctl static
environment:
name: staging
url: |-
http://staging.
$CI_PROJECT_PATH_SLUG.
$DEPLOY_DOMAIN_APP
on_stop: stop_staging
only:
- master
tags:
- deployctl-gioxapp.com
stop_staging:
stage: staging
variables:
GIT_STRATEGY: none
dependencies: []
script:
- deployctl delete
when: manual
environment:
name: staging
action: stop
only:
- master
tags:
- deployctl-gioxapp.com
# Production Output, needs Manual trigger
production:
stage: production
variables:
GIT_STRATEGY: none
script:
- deployctl static
environment:
name: production
url: http://$DEPLOY_DOMAIN
when: manual
only:
- master
tags:
- deployctl-gioxapp.com
If you fork the project, make sure to change the
tags:
- deployctl-gioxapp.com
to your deployment -server!!! (deployctl-<$DEPLOY_DOMAIN_APP>
)