furmeet-bot/.gitlab-ci.yml

62 lines
2.1 KiB
YAML

image: python:latest
cache:
paths:
stages:
# - build
- deploy
- configure
- restart
# build:
# stage: build
# tags:
# - production
# - shell
# script:
# - make depends
deploy:
stage: deploy
tags:
- production
- shell
script:
- sudo rm -rf /var/www/furmeet-bot/webproj
- sudo rm -rf /var/www/furmeet-bot/virtual_env
- sudo mkdir -p /var/www/furmeet-bot/media
- sudo mkdir -p /var/www/furmeet-bot/static
- sudo mkdir -p /var/www/furmeet-bot/webproj
- sudo cp webproj/. -R /var/www/furmeet-bot/webproj/.
- sudo cp manage.py /var/www/furmeet-bot/
- sudo cp Makefile /var/www/furmeet-bot/
- sudo cp requirements.frozen.txt /var/www/furmeet-bot/
- sudo chown http:http -R /var/www/furmeet-bot
configure:
stage: configure
tags:
- production
- shell
script:
- cat srvconfig/nginx.conf | sed -e 's/{domain}/bot.furmeet.app/g' -e 's/{port}/34891/g' -e 's/{path}/\/var\/www\/furmeet-bot/g' | sudo tee /etc/nginx/sites-available/bot-furmeet-app-http.conf > /dev/null
- cat srvconfig/nginx-nomedia.conf | sed -e 's/{domain}/test-bot.furmeet.app/g' -e 's/{port}/34892/g' | sudo tee /etc/nginx/sites-available/test-bot-furmeet-app-http.conf > /dev/null
- cat srvconfig/systemd.service | sed -e 's/{name}/furmeet-bot/g' -e 's/{path}/\/var\/www\/furmeet-bot/g' -e 's/{verb}/serve/g' | sudo tee /etc/systemd/system/furmeet-bot.service > /dev/null
- cat srvconfig/systemd.service | sed -e 's/{name}/furmeet-bot/g' -e 's/{path}/\/var\/www\/furmeet-bot/g' -e 's/{verb}/bg-tasks/g' | sudo tee /etc/systemd/system/furmeet-bot-bg-tasks.service > /dev/null
- sudo -u http make depends -C /var/www/furmeet-bot
- sudo -u http make all -C /var/www/furmeet-bot
restart:
stage: restart
tags:
- production
- shell
script:
- sudo systemctl daemon-reload
- sudo systemctl reload nginx
- sudo systemctl enable furmeet-bot.service
- sudo systemctl enable furmeet-bot-bg-tasks.service
- sudo systemctl restart furmeet-bot.service
- sudo systemctl restart furmeet-bot-bg-tasks.service