2022-02-26 00:32:30 -08:00
|
|
|
include:
|
|
|
|
- router/.gitlab-ci.yml
|
|
|
|
|
2022-02-10 09:38:14 -08:00
|
|
|
stages:
|
2022-02-25 18:47:08 -08:00
|
|
|
- test
|
2022-02-10 09:38:14 -08:00
|
|
|
- deploy
|
|
|
|
|
2022-02-10 09:25:26 -08:00
|
|
|
before_script:
|
2022-02-25 22:24:03 -08:00
|
|
|
# install git
|
2022-02-25 19:21:53 -08:00
|
|
|
- apt-get -y update
|
2022-02-25 21:49:55 -08:00
|
|
|
- apt-get -y install git
|
2022-02-25 22:24:03 -08:00
|
|
|
# install prerequisites for docker
|
2022-02-25 22:09:03 -08:00
|
|
|
- apt-get -y install ca-certificates curl gnupg lsb-release
|
2022-02-25 22:11:22 -08:00
|
|
|
- curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
2022-02-25 22:10:14 -08:00
|
|
|
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
2022-02-25 22:24:03 -08:00
|
|
|
# install docker
|
2022-02-25 22:09:03 -08:00
|
|
|
- apt-get -y update
|
|
|
|
- apt-get -y install docker-ce docker-ce-cli containerd.io
|
|
|
|
- docker --version
|
2022-02-25 22:24:03 -08:00
|
|
|
# install docker compose
|
|
|
|
- DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
|
|
|
- mkdir -p $DOCKER_CONFIG/cli-plugins
|
|
|
|
- curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
|
|
|
|
- chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
|
|
|
|
- docker compose version
|
2022-02-10 09:25:26 -08:00
|
|
|
# configure SSH keys
|
|
|
|
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
|
|
- mkdir -p ~/.ssh
|
2022-02-10 09:45:07 -08:00
|
|
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
2022-02-25 22:09:03 -08:00
|
|
|
|
2022-02-25 19:09:54 -08:00
|
|
|
docker-compose-test:
|
2022-02-25 22:09:30 -08:00
|
|
|
image: debian:bullseye
|
2022-02-25 19:09:54 -08:00
|
|
|
stage: test
|
|
|
|
rules:
|
|
|
|
- changes:
|
2022-02-25 21:12:23 -08:00
|
|
|
- seedbox/config/
|
|
|
|
- server/config/
|
|
|
|
- jafner-tools/config/
|
2022-02-25 19:09:54 -08:00
|
|
|
script:
|
2022-02-25 22:12:40 -08:00
|
|
|
- find ~+ -type f -name docker-compose.yml > composes.txt
|
|
|
|
- find ~+/server/config/minecraft/ -type f -name *.yml >> composes.txt
|
2022-02-25 21:46:32 -08:00
|
|
|
- for file in `cat composes.txt`; do docker compose -f $file config; done
|
2022-02-25 19:52:22 -08:00
|
|
|
- rm composes.txt
|
2022-02-25 18:47:08 -08:00
|
|
|
|
2022-02-10 09:25:26 -08:00
|
|
|
|
2022-02-25 13:30:41 -08:00
|
|
|
server-deploy:
|
2022-02-25 19:19:44 -08:00
|
|
|
image: debian:bullseye
|
2022-02-25 10:27:03 -08:00
|
|
|
stage: deploy
|
2022-02-25 13:30:41 -08:00
|
|
|
rules:
|
|
|
|
- changes:
|
|
|
|
- server/
|
2022-02-25 10:27:03 -08:00
|
|
|
script:
|
2022-02-25 13:30:41 -08:00
|
|
|
- ssh joey@joey-server "cd /home/joey/homelab && git pull"
|
2022-02-25 18:47:08 -08:00
|
|
|
|
|
|
|
seedbox-deploy:
|
2022-02-25 19:19:44 -08:00
|
|
|
image: debian:bullseye
|
2022-02-25 18:47:08 -08:00
|
|
|
stage: deploy
|
|
|
|
rules:
|
|
|
|
- changes:
|
|
|
|
- seedbox/
|
|
|
|
script:
|
|
|
|
- ssh joey@joey-seedbox "cd /home/joey/homelab && git pull"
|
|
|
|
|
|
|
|
jafner-tools-deploy:
|
2022-02-25 19:19:44 -08:00
|
|
|
image: debian:bullseye
|
2022-02-25 18:47:08 -08:00
|
|
|
stage: deploy
|
|
|
|
rules:
|
|
|
|
- changes:
|
|
|
|
- jafner-tools/
|
|
|
|
script:
|
|
|
|
- ssh root@jafner.tools "cd /root/homelab && git pull"
|