Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy and release scripts #79

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions .rultor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,38 @@ architect:
docker:
image: l3r8y/rultor-image:1.0.3
assets:
ghcr.txt: tracehubpm/secrets#assets/ghcr.txt
ghcr.txt: tracehubpm/secrets#assets/ghcr-hanna.txt
ssh.txt: tracehubpm/secrets#assets/ssh.txt
pmo.env: tracehubpm/secrets#assets/pmo.env
keycloak.env: tracehubpm/secrets#assets/keycloak.env
realm-export.json: tracehubpm/secrets#assets/realm-export.json
merge:
script: |
mvn clean install --errors
release:
sensitive:
- ghcr.txt
script: |
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9_]+)?$ ]] || exit -1
mvn versions:set "-DnewVersion=${tag}"
git commit -am "${tag}"
[[ "${TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9_]+)?$ ]] || exit -1
dukris marked this conversation as resolved.
Show resolved Hide resolved
mvn versions:set "-DnewVersion=${TAG}"
git commit -am "${TAG}"
mvn clean install
docker build -t ghcr.io/tracehubpm/pmo:${tag} .
cat ../ghcr.txt | docker login ghcr.io --username h1alexbel --password-stdin
docker push ghcr.io/tracehubpm/pmo:${tag}
# @todo #2:90min Create deploy script for rultor configuration.
# We should create deploy script that will deliver our Java software
# into some target platform. For now, we assuming that it will be
# Cloud VM with public IP, and SSH connection.
docker build -t ghcr.io/tracehubpm/pmo:${TAG} .
cat ../ghcr.txt | docker login ghcr.io --username hizmailovich --password-stdin
docker push ghcr.io/tracehubpm/pmo:${TAG}
sudo apt-get -y install sshpass
echo ${TAG} >> /home/r/repo/scripts/release/tag.txt
sshpass -f ../ssh.txt scp -r /home/r/repo/scripts/release root@${IP}:~/
sshpass -f ../ssh.txt scp ../pmo.env root@${IP}:~/release/pmo.env
sshpass -f ../ssh.txt scp ../keycloak.env root@${IP}:~/release/keycloak.env
sshpass -f ../ssh.txt scp ../realm-export.json root@${IP}:~/release/realm-export.json
sshpass -f ../ssh.txt ssh -o StrictHostKeyChecking=no root@${IP}
cd release
sh ${SCRIPT}
deploy:
script: |
sudo apt-get -y install sshpass
sshpass -f ../ssh.txt scp -r /home/r/repo/scripts/deploy root@${IP}:~/
sshpass -f ../ssh.txt ssh -o StrictHostKeyChecking=no root@${IP}
cd deploy
sh setup.sh
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ it can be found here: `/swagger-ui/index.html`.
* Allows to log in using login and password.
* Allows to log in using such social coding platforms as GitHub, GitLab, and Bitbucket.
* Allows to create a project.
* Creates and queries tickets.
* Creates and queries tickets.
* Creates and manages [secrets](https://en.wikipedia.org/wiki/Environment_variable), represented as simple `key = value`
pair, where value will be encrypted using [jasypt](http://www.jasypt.org).
pair, where value will be encrypted using [jasypt](http://www.jasypt.org).

After project creation bot [@tracehubgit](https://github.com/tracehubgit) will be invited
to the repository and a `new` label for issues will be added. Moreover, a webhook for `push` events will be
Expand Down Expand Up @@ -75,3 +75,20 @@ If you test it locally, you can use [Docker Desktop](https://www.docker.com/prod

All the things above will be run by [Rultor.com](http://rultor.com/)
and CI [gate](https://github.com/tracehub/pmo/actions).

### How to deploy?

The instance can be configured from GitHub Issue using bot [@rultor](https://github.com/yegor256/rultor) and command:

`@rultor deploy, IP=<IP of the instance>`

### How to release?

The updated artifact can be released from GitHub Issue using bot [@rultor](https://github.com/yegor256/rultor) and
command:

`@rultor release, IP=<IP of the instance>, TAG=<Tag name>, SCRIPT=<Shell script name>`

Script name should be `up.sh` to run the [green](https://en.wikipedia.org/wiki/Blue%E2%80%93green_deployment) instance.
This version of the app can be tested using `/api-test` prefix.
After testing, the blue instance can be switched to the green one using `swap.sh` script.
Loading
Loading