@@ -5,6 +5,8 @@ This project implements a generic GitLab CI template for any [S3](https://en.wik
This is a basic and very cheap solution to host static pages websites as well as [progressive web applications](https://en.wikipedia.org/wiki/Progressive_web_application).
The template uses [s3cmd](https://github.com/s3tools/s3cmd) to control the S3 API endpoint and uploading objects.
## Overview
This template implements continuous delivery/continuous deployment for projects hosted on S3 platforms.
@@ -63,13 +65,29 @@ The S3 template uses some global configuration used throughout all jobs.
| `S3_REVIEW_ENVIRONMENT_DOMAIN` | The review environment domain. | _none_ |
| `S3_REVIEW_PREFIX` | S3 prefix to use for `review` env _(only define if different from default)_ | `S3_PREFIX` |
Note: By default, review `environment.url` will be built as `${S3_REVIEW_ENVIRONMENT_SCHEME}://${$CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${S3_REVIEW_ENVIRONMENT_DOMAIN}`
@@ -131,11 +148,11 @@ Here are variables supported to configure the integration environment:
| `S3_INTEG_DISABLED` | Set to `true` to disable the `integration` environment | _none_ (enabled) |
| `S3_INTEG_ENDPOINT_HOST` | S3 endpoint hostname (and port) for `integration` env _(only define if different from default)_ | `$S3_ENDPOINT_HOST` |
| `S3_INTEG_ENDPOINT_HOST` | S3 endpoint hostname (with port) for `integration` env _(only define if different from default)_ | `$S3_ENDPOINT_HOST` |
| `S3_INTEG_REGION` | Region to create the `integration` bucket in | `$S3_REGION` |
| :lock: `S3_INTEG_ACCESS_KEY` | S3 service Access Key for `integration` env _(only define if different from default)_ | `$S3_ACCESS_KEY` |
| :lock: `S3_INTEG_SECRET_KEY` | S3 service Secret Key for `integration` env _(only define if different from default)_ | `$S3_SECRET_KEY` |
| `S3_INTEG_BUCKET_NAME` | Bucket name for `integration` env | `${S3_BASE_BUCKET_NAME}-integration` |
| `S3_INTEG_ENVIRONMENT_URL` | The integration environment url **including scheme** (ex: `https://my-project-integration.s3-website.nonpublic.domain.com`). Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |
| `S3_INTEG_PREFIX` | S3 prefix to use for `integration` env _(only define if different from default)_ | `S3_PREFIX` |
#### Staging environment
@@ -150,11 +167,11 @@ Here are variables supported to configure the staging environment:
| `S3_STAGING_DISABLED` | Set to `true` to disable the `staging` environment | _none_ (enabled) |
| `S3_STAGING_ENDPOINT_HOST`| S3 endpoint hostname (and port) for `staging` env _(only define if different from default)_ | `$S3_ENDPOINT_HOST` |
| `S3_STAGING_ENDPOINT_HOST`| S3 endpoint hostname (with port) for `staging` env _(only define if different from default)_ | `$S3_ENDPOINT_HOST` |
| `S3_STAGING_REGION` | Region to create the `staging` bucket in | `$S3_REGION` |
| :lock: `S3_STAGING_ACCESS_KEY` | S3 service Access Key for `staging` env _(only define if different from default)_ | `$S3_ACCESS_KEY` |
| :lock: `S3_STAGING_SECRET_KEY` | S3 service Secret Key for `staging` env _(only define if different from default)_ | `$S3_SECRET_KEY` |
| `S3_STAGING_BUCKET_NAME` | Bucket name for `staging` env | `${S3_BASE_BUCKET_NAME}-staging` |
| `S3_STAGING_ENVIRONMENT_URL` | The staging environment url **including scheme** (ex: `https://my-project-staging.s3-website.nonpublic.domain`). Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |
| `S3_STAGING_PREFIX` | S3 prefix to use for `staging` env _(only define if different from default)_ | `S3_PREFIX` |
#### Production environment
@@ -168,11 +185,11 @@ Here are variables supported to configure the production environment:
| `S3_PROD_DISABLED` | Set to `true` to disable the `production` environment | _none_ (enabled) |
| `S3_PROD_ENDPOINT_HOST` | S3 endpoint hostname (and port) for `production` env _(only define if different from default)_| `$S3_ENDPOINT_HOST` |
| `S3_PROD_ENDPOINT_HOST` | S3 endpoint hostname (with port) for `production` env _(only define if different from default)_| `$S3_ENDPOINT_HOST` |
| `S3_PROD_REGION` | Region to create the `production` bucket in | `$S3_REGION` |
| :lock: `S3_PROD_ACCESS_KEY` | S3 service Access Key for `production` env _(only define if different from default)_ | `$S3_ACCESS_KEY` |
| :lock: `S3_PROD_SECRET_KEY` | S3 service Secret Key for `production` env _(only define if different from default)_ | `$S3_SECRET_KEY` |
| `S3_PROD_BUCKET_NAME` | Bucket name for `production` env | `$S3_BASE_BUCKET_NAME` |
| `S3_PROD_ENVIRONMENT_URL`| The production environment url **including scheme** (ex: `https://my-project.s3-website.public.domain.com`) Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |
| `AUTODEPLOY_TO_PROD` | Set this variable to auto-deploy to production. If not set deployment to production will be `manual` (default behaviour). | _none_ (disabled) |
| `S3_PROD_PREFIX` | S3 prefix to use for `production` env _(only define if different from default)_ | `S3_PREFIX` |
@@ -234,6 +251,7 @@ It uses the following variables:
| `S3_DEPLOY_FILES` | Pattern(s) of files to deploy to the S3 bucket| `public/` _(all files from `public` directory)_ |
| `S3_WEBSITE_DISABLED` | Set to `true` to disable WebSite hosting by your S3 bucket | _none_ (enabled by default) |
| `S3_WEBSITE_ARGS` | [s3cmd](https://s3tools.org/usage) command and options to enable WebSite hosting on the bucket | `ws-create --ws-index=index.html` |
| `S3_WEBSITE_ENDPOINT` | Default WebSite endpoint url pattern (supports `%(bucket)s` and `%(location)s` placeholders).<br/>_only required when website hosting is not disabled_ | `http://%(bucket)s.s3-website.%(location)s.amazonaws.com` |
If need be you could add your own hook script `s3-pre-deploy.sh` that will be triggered right before deploying files to
"description":"The review environment domain (ex: `s3-website.nonpublic.domain`).\n\nBy default review `environment.url` will be built as `${S3_REVIEW_ENVIRONMENT_SCHEME}://${$CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${S3_REVIEW_ENVIRONMENT_DOMAIN}`",
"mandatory":true
},
{
"name":"CLEANUP_ALL_REVIEW",
"description":"Enables a **manual** job to cleanup all review envs at once.\n\nYou may also use it to [schedule](https://docs.gitlab.com/ee/ci/pipelines/schedules.html) cloud resources cleanup. See documentation.",
@@ -124,7 +127,11 @@
"variables":[
{
"name":"S3_INTEG_ENDPOINT_HOST",
"description":"S3 endpoint hostname (and port) for `integration` env _(only define if different from default)_"
"description":"S3 endpoint hostname (with port) for `integration` env _(only define if different from default)_"
},
{
"name":"S3_INTEG_REGION",
"description":"Region to create the `integration` bucket in"
},
{
"name":"S3_INTEG_ACCESS_KEY",
@@ -142,12 +149,6 @@
"default":"${S3_BASE_BUCKET_NAME}-integration",
"advanced":true
},
{
"name":"S3_INTEG_ENVIRONMENT_URL",
"type":"url",
"description":"The integration environment url including scheme (ex: `https://my-project-integration.s3-website.nonpublic.domain`).\n\nDo not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that.",
"mandatory":true
},
{
"name":"S3_INTEG_PREFIX",
"description":"S3 prefix to use for `integration` env _(only define if different from default)_",
@@ -163,7 +164,11 @@
"variables":[
{
"name":"S3_STAGING_ENDPOINT_HOST",
"description":"S3 endpoint hostname (and port) for `staging` env _(only define if different from default)_"
"description":"S3 endpoint hostname (with port) for `staging` env _(only define if different from default)_"
},
{
"name":"S3_STAGING_REGION",
"description":"Region to create the `staging` bucket in"
},
{
"name":"S3_STAGING_ACCESS_KEY",
@@ -181,12 +186,6 @@
"default":"${S3_BASE_BUCKET_NAME}-staging",
"advanced":true
},
{
"name":"S3_STAGING_ENVIRONMENT_URL",
"type":"url",
"description":"The staging environment url including scheme (ex: `https://my-project-staging.s3-website.nonpublic.domain`).\n\nDo not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that.",
"mandatory":true
},
{
"name":"S3_STAGING_PREFIX",
"description":"S3 prefix to use for `staging` env _(only define if different from default)_",
@@ -202,7 +201,11 @@
"variables":[
{
"name":"S3_PROD_ENDPOINT_HOST",
"description":"S3 endpoint hostname (and port) for `production` env _(only define if different from default)_"
"description":"S3 endpoint hostname (with port) for `production` env _(only define if different from default)_"
},
{
"name":"S3_PROD_REGION",
"description":"Region to create the `production` bucket in"
},
{
"name":"S3_PROD_ACCESS_KEY",
@@ -220,12 +223,6 @@
"default":"${S3_BASE_BUCKET_NAME}",
"advanced":true
},
{
"name":"S3_PROD_ENVIRONMENT_URL",
"type":"url",
"description":"The production environment url including scheme (ex: `https://my-project.s3-website.public.domain.com`).\n\nDo not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that.",