FossilRepo

fossilrepo / deploy.sh
Blame History Raw 39 lines
1
#!/bin/bash
2
# deploy.sh — push local changes to fossilrepo.io
3
#
4
# Flow:
5
# 1. Fossil commit + push (writes to /data/repos/fossilrepo.fossil on server)
6
# 2. SSM runs fossilrepo-deploy (fossil update + pip + migrate + collectstatic + restart)
7
#
8
# Requires .env.deploy with FOSSIL_REMOTE_URL and EC2_INSTANCE_ID
9
10
set -euo pipefail
11
12
if [[ ! -f .env.deploy ]]; then
13
echo "Missing .env.deploy -- copy .env.deploy.example and fill in your values"
14
exit 1
15
fi
16
17
source .env.deploy
18
19
MSG="${1:-Deploy $(date +%Y-%m-%d-%H%M)}"
20
21
echo "=== Fossil commit ==="
22
fossil addremove 2>/dev/null || true
23
fossil commit --no-warnings -m "$MSG" 2>&1 || echo "Nothing to commit"
24
25
echo "=== Fossil push ==="
26
fossil push "$FOSSIL_REMOTE_URL"
27
28
echo "=== Deploy to server ==="
29
AWS_PROFILE=fossiladmin aws ssm send-command \
30
--instance-ids "$EC2_INSTANCE_ID" \
31
--document-name "AWS-RunShellScript" \
32
--timeout-seconds 120 \
33
--parameters '{"commands":["export HOME=/root && fossilrepo-deploy 2>&1"]}' \
34
--region "${AWS_REGION:-us-west-2}" \
35
--query "Command.CommandId" \
36
--output text
37
38
echo "=== Deployed ==="
39

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button