Skip to content

Commit

Permalink
Resolved #6
Browse files Browse the repository at this point in the history
  • Loading branch information
dukris committed Mar 7, 2024
1 parent 6ba5195 commit a004bd2
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 9 deletions.
33 changes: 24 additions & 9 deletions .rultor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,36 @@ docker:
image: l3r8y/rultor-image:1.0.3
assets:
ghcr.txt: tracehubpm/secrets#assets/ghcr.txt
creds.txt: tracehubpm/secrets#assets/creds.txt
pmo.env: tracehubpm/secrets#assets/pmo.env
keycloak.env: tracehubpm/secrets#assets/keycloak.env
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
mvn versions:set "-DnewVersion=${TAG}"
git commit -am "${TAG}"
mvn clean install
docker build -t ghcr.io/tracehubpm/pmo:${tag} .
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 push ghcr.io/tracehubpm/pmo:${TAG}
sudo apt-get -y install sshpass
echo ${TAG} >> /home/r/repo/scripts/release/tag.txt
sshpass -f ../creds.txt scp -r /home/r/repo/scripts/release root@${IP}:~/
sshpass -f ../creds.txt scp ../pmo.env root@${IP}:~/release/pmo.env
sshpass -f ../creds.txt scp ../keycloak.env root@${IP}:~/release/keycloak.env
sshpass -f ../creds.txt ssh -o StrictHostKeyChecking=no root@${IP}
cd release
TAG=$(cat tag.txt)
TAG=${TAG} docker-compose up -d --build
deploy:
script: |
sudo apt-get -y install sshpass
sshpass -f ../creds.txt scp -r /home/r/repo/scripts/deploy root@${IP}:~/
sshpass -f ../creds.txt ssh -o StrictHostKeyChecking=no root@${IP}
cd deploy
sh setup.sh
12 changes: 12 additions & 0 deletions scripts/deploy/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen 80;

server_name pmo.tracehub.git;

location /realms/ {
proxy_pass http://localhost:8090;
}
location / {
proxy_pass http://localhost:8080;
}
}
19 changes: 19 additions & 0 deletions scripts/deploy/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt-get -y install docker-ce
sudo systemctl status docker
sudo apt-get -y install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| sudo tee /etc/apt/preferences.d/99nginx
sudo apt-get -y install nginx
sudo mv default.conf /etc/nginx/conf.d/default.conf
sudo systemctl restart nginx
sudo systemctl status nginx
37 changes: 37 additions & 0 deletions scripts/release/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3.9'

services:
keycloak:
image: quay.io/keycloak/keycloak:23.0.2
container_name: keycloak
environment:
KC_DB: ${KC_DB}
KC_DB_URL_HOST: ${KC_DB_URL_HOST}
KC_DB_USERNAME: ${KC_DB_USERNAME}
KC_DB_PASSWORD: ${KC_DB_PASSWORD}
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
ports:
- '8090:8090'
networks:
- pmo
command: start --import-realm --http-port=8090
volumes:
- ./realm-export.json:/opt/keycloak/data/import/realm-export.json
env_file:
- keycloak.env
app:
container_name: tracehub-pmo
image: ghcr.io/tracehubpm/pmo:${TAG}
ports:
- '8080:8080'
depends_on:
- keycloak
networks:
- pmo
env_file:
- pmo.env

networks:
pmo:
driver: bridge

0 comments on commit a004bd2

Please sign in to comment.