Skip to content

Commit 4e8574c

Browse files
committed
add update script
1 parent 4004823 commit 4e8574c

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: '3'
22
services:
3-
nginx:
3+
nginx-web:
44
image: nginx
55
labels:
66
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"

update.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
#
4+
# This scrip update the web proxy without downtime
5+
#
6+
# Source: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
7+
#
8+
9+
# 1. Check if .env file exists
10+
if [ -e .env ]; then
11+
source .env
12+
else
13+
echo
14+
echo "Please set up your .env file before starting your enviornment."
15+
echo
16+
exit 1
17+
fi
18+
19+
# 2. Update your repo
20+
git pull
21+
git checkout master
22+
23+
# 3. Check if your env files has the same line numbers
24+
if [ "$(wc -l .env | cut -f1 -d' ')" != "$(wc -l .env.sample | cut -f1 -d' ')" ]; then
25+
echo
26+
echo "The sample .env are different from the your current .env file."
27+
echo "Please update your .env file to continue."
28+
echo "It must has the same lines of the sample env file."
29+
echo
30+
echo "If you keep receiving this message please check the number of line of both files"
31+
echo
32+
fi
33+
34+
# 3. Download the latest version of nginx.tmpl
35+
curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > nginx.tmpl
36+
37+
# 4. Update containers without downtime
38+
docker-compose up -d --no-deps --build nginx-web
39+
docker-compose up -d --no-deps --build nginx-gen
40+
docker-compose up -d --no-deps --build nginx-letsencrypt
41+
42+
exit 0

0 commit comments

Comments
 (0)