Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nvhoc/gitlab-jobs
Auto deploy a service
https://github.com/nvhoc/gitlab-jobs
cicd deploy deployment docker fastdeploy gitlab gstore s3-sync
Last synced: 7 days ago
JSON representation
Auto deploy a service
- Host: GitHub
- URL: https://github.com/nvhoc/gitlab-jobs
- Owner: nvhoc
- Created: 2020-03-15T10:50:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-07T22:29:38.000Z (almost 4 years ago)
- Last Synced: 2024-10-28T14:24:32.328Z (about 2 months ago)
- Topics: cicd, deploy, deployment, docker, fastdeploy, gitlab, gstore, s3-sync
- Language: Dockerfile
- Homepage:
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GITLAB JOBS
## Background
In Microservice Architecture, we have many small services as repositories and the released time is very short. It's very high-load if we do all thing manually.The jobs including:
- autotag a repo when there are new code in the master branch
- docker auto push image with new version
- deploy the service in ec2 using docker## How to use
1. add .gitlab-ci.yaml in a service's repo
2. add code
```
stages:
- tag
- build
- deploy
include:
- remote: https://github.com/nvhoc/gitlab-jobs/releases/download/v1.0.0/default.gitlab-ci.tag.yml
- remote: https://github.com/nvhoc/gitlab-jobs/releases/download/v1.0.0/default.gitlab-ci.docker.yml
- remote: https://github.com/nvhoc/gitlab-jobs/releases/download/v1.0.0/default.gitlab-ci.ec2-deploy.yml```
3. define CI&CD variables:3.1. to include .gitlab-ci.tag.yml:
+ generate a pair of key ssh by ssh-keygen => private_key && public_key
+ set SSH_PRIVATE_KEY=${private_key} (text)
+ add public key in "Deploy Keys" at "CI&CD settings"
+ set GITHUB_EMAIL=${your bot email}
+ set GITHUB_USER=${your username}3.2. to include .gitlab-ci.docker.yml:
+ set DOCKER_USER_NAME=${your bot username in your docker registry}
+ set DOCKER_PASSWORD=${your bot password in your docker registry}3.3. to include .gitlab-ci.ec2-deploy.yml:
+ note: the file support for simple deployment with docker-compose. I will add new file for k8s later.
+ set EC2_PEM_KEY=${content of pem file}
+ set EC2_USER=${ec2 username}
+ set EC2_HOST=${ec2 public address}
+ set EC2_DEPLOY_PATH=${ec2 path store docker-compose deployment} find a example at ./example/docker-compose3.4. to include .gitlab-ci.yarn-build.yml:
+ set BUILD_PATH=${path of folder from building process}3.5. to include .gitlab-ci.s3-sync.yml:
+ set BUILD_PATH=${path of folder that you want to sync to s3}
+ set S3_DEPLOY_BUCKET=${s3 bucket}
+ set AWS_ACCESS_KEY_ID=${aws access key}
+ set AWS_SECRET_ACCESS_KEY=${aws secret key}