-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
42 lines (40 loc) · 1.05 KB
/
deploy.sh
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
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# ARGUMENTS
# $1 : Docker hub username
# $2 : Application port
# $3 : Database name
# $4 : Database port
# $5 : Database password
# $6 : Database user
# $7 : Database host
# $8 : Session key
# $9 : Gin mode
# $10 : Loki username
# $11 : Loki password
# $12 : Loki host
# $13 : Loki port
echo "Installing loki driver"
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions || true
echo "Pulling latest version"
docker pull $1/minitwit:latest
echo "Stopping current minitwit"
docker stop minitwit || true
docker rm minitwit || true
echo "Deploying $DOCKER_USERNAME/minitwit:latest to $PORT"
docker run -d \
-p $2:$2 \
--env PORT=$2 \
--env DB_NAME=$3 \
--env DB_PORT=$4 \
--env DB_PASSWORD=$5 \
--env DB_USER=$6 \
--env DB_HOST=$7 \
--env SESSION_KEY=$8 \
--env GIN_MODE=$9 \
--name minitwit \
--log-driver=loki \
--log-opt loki-url="http://${10}:${11}@${12}:${13}/loki/api/v1/push" \
--log-opt loki-retries=5 \
--log-opt loki-batch-size=400 \
--name minitwit \
$1/minitwit