-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmng-dev.sh
executable file
·68 lines (56 loc) · 1.21 KB
/
mng-dev.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
PROJECT_NAME='landings_next'
SERVER_NAME='tika7'
SERVER_PATH='/var/www/landings_next/'
CONTAINER_NAME=${PROJECT_NAME}
COMPOSE_FILE='docker-compose-dev.yml'
NGINX_FILE='landings_dev_web_nginx.conf'
function log() {
docker logs -f ${CONTAINER_NAME}
}
function bash() {
docker exec -it -w /app/${PROJECT_NAME} ${CONTAINER_NAME} sh
}
function pull() {
echo -e "\n ... pull images ... \n"
docker-compose -f ${COMPOSE_FILE} pull
}
function up() {
echo -e "\n ... up containers ... \n"
docker-compose -f ${COMPOSE_FILE} up -d
}
function remove_unused_image() {
echo -e "\n ... remove unused images ... \n"
docker image prune -af
}
function scp_conf() {
echo -e "\n ... copy conf files to server ... \n"
scp ${COMPOSE_FILE} ${NGINX_FILE} mng-web_v2.sh ${SERVER_NAME}:${SERVER_PATH}
}
function issue_https_certificate() {
sudo certbot --nginx certonly -d landings.q00p.ir
sudo ln -s ${SERVER_PATH}/${NGINX_FILE} /etc/nginx/sites-enabled/${NGINX_FILE}
sudo service nginx restart
}
case $1 in
scp_conf)
scp_conf
;;
up)
pull
up
remove_unused_image
;;
log)
log
;;
bash)
bash
;;
https)
issue_https_certificate
;;
*)
echo don\'t know
;;
esac