furmeet-bot/.gitlab-ci.yml

55 lines
1.4 KiB
YAML
Raw Normal View History

2020-07-08 01:03:31 +00:00
image: python:latest
cache:
paths:
- virtual_env/
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
- sudo mkdir -p /var/www/furmeet-bot/static
- sudo mkdir -p /var/www/furmeet-bot/webproj
- sudo cp webproj/. /var/www/furmeet-bot/webproj/.
- sudo cp manage.py /var/www/furmeet-bot/
- sudo cp Makefile /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' | sudo tee /etc/nginx/sites-available/bot-furmeet-app-http.conf > /dev/null
- cat srvconfig/nginx.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' | sudo tee /etc/systemd/system/furmeet-bot.service > /dev/null
- 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 restart furmeet-bot.service