-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
33 lines (29 loc) · 1.36 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
branches:
only:
- master
language: minimal
env:
- SERVER_USER=ec2-user SERVER_DNS=ec2-35-180-69-65.eu-west-3.compute.amazonaws.com
before_install:
- openssl aes-256-cbc -K $encrypted_2c430460807a_key -iv $encrypted_2c430460807a_iv -in travis.pem.enc -out ./travis.pem -d
script:
- chmod 400 travis.pem
# Build container with application
- docker build . -t bot:latest
# Save images to targ
- docker save -o ./bot.tar bot:latest
# Send tar to EC2 instances
- scp -o StrictHostKeyChecking=no -i "travis.pem" ./bot.tar $SERVER_USER@$SERVER_DNS:~/bot.tar
# Process env file
- ssh -i "travis.pem" -t $SERVER_USER@$SERVER_DNS "mkdir -p ~/postgresql/migrations"
- scp -o StrictHostKeyChecking=no -i "travis.pem" ./postgresql/.env $SERVER_USER@$SERVER_DNS:~/postgresql/.env
# Copy migrations
- scp -o StrictHostKeyChecking=no -i "travis.pem" -r ./postgresql/migrations $SERVER_USER@$SERVER_DNS:~/postgresql
# Copy docker compose
- scp -o StrictHostKeyChecking=no -i "travis.pem" ./docker-compose.yml $SERVER_USER@$SERVER_DNS:~/docker-compose.yml
- scp -o StrictHostKeyChecking=no -i "travis.pem" ./docker-compose.production.yml $SERVER_USER@$SERVER_DNS:~/docker-compose.production.yml
# Upload images
- ssh -i "travis.pem" -t $SERVER_USER@$SERVER_DNS "docker load -i bot.tar"
# Run updater
- chmod 555 ./deploy/updater.sh
- ./deploy/updater.sh