Skip to content

Commit 31ffca4

Browse files
committed
Merge branch 'develop' into release
2 parents 2910255 + 92015ac commit 31ffca4

6 files changed

Lines changed: 145 additions & 17 deletions

File tree

auto_deployment.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
if [ $# = 2 ]
4+
then
5+
ssh $1@$2 'bash -s' < deployment.sh
6+
else
7+
echo "Usage : auto_deployment @user @IP"
8+
fi

config/mysql/docker-entrypoint-initdb.d/CREATE_ALL.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ CREATE TABLE assets (
163163
INSERT INTO themes VALUES (1, 'Light', now(), now());
164164
INSERT INTO themes VALUES (2, 'Dark', now(), now());
165165

166-
INSERT INTO currencies VALUES (1, 'Dollar des États-Unis', 'USD', now(), now());
166+
INSERT INTO currencies VALUES (1, 'Dollar des Etats-Unis', 'USD', now(), now());
167167
INSERT INTO currencies VALUES (2, 'Euro', 'EUR', now(), now());
168168
INSERT INTO currencies VALUES (3, 'Franc suisse', 'CHF', now(), now());
169169

deployment.sh

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/bin/bash
2+
3+
echo "##############################################################################"
4+
echo "# DOCKER #"
5+
echo "##############################################################################"
6+
7+
echo "Updating the apt package index"
8+
apt-get update
9+
echo ""
10+
11+
echo "Removing old versions of docker if exists"
12+
apt-get remove docker docker-engine docker.io
13+
echo ""
14+
15+
echo "Removing current version of docker if exists"
16+
apt-get --assume-yes purge docker-ce
17+
echo ""
18+
19+
echo "Remove old containers, images and networks if exists"
20+
rm -Rf /var/lib/docker
21+
echo ""
22+
23+
echo "Updating the apt package index"
24+
apt-get update
25+
echo ""
26+
27+
echo "Installing some packages for Docker"
28+
apt-get --assume-yes install \
29+
apt-transport-https \
30+
ca-certificates \
31+
curl \
32+
software-properties-common
33+
echo ""
34+
35+
echo "Adding Docker’s official GPG key"
36+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
37+
echo ""
38+
39+
echo "Checking fingerprint"
40+
echo "YOU SHOULD HAVE 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 fingerprint"
41+
apt-key fingerprint 0EBFCD88
42+
echo ""
43+
44+
echo "Adding stable repository"
45+
add-apt-repository \
46+
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
47+
$(lsb_release -cs) \
48+
stable"
49+
echo ""
50+
51+
echo "Updating the apt package index"
52+
apt-get update
53+
echo ""
54+
55+
echo "Installing Docker"
56+
apt-get --assume-yes install docker-ce
57+
echo ""
58+
59+
echo "Listing all installed versions of Docker"
60+
apt-cache madison docker-ce
61+
echo ""
62+
63+
echo "##############################################################################"
64+
echo "# DOCKER COMPOSE #"
65+
echo "##############################################################################"
66+
67+
echo "Removing old versions of docker-compose if exists"
68+
rm -f /usr/local/bin/docker-compose
69+
echo ""
70+
71+
echo "Downloading last version of docker-compose"
72+
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
73+
echo ""
74+
75+
echo "Making docker-compose script executable"
76+
chmod +x /usr/local/bin/docker-compose
77+
echo ""
78+
79+
echo "Checking docker-compose version"
80+
docker-compose --version
81+
echo ""
82+
83+
echo "##############################################################################"
84+
echo "# SCRIPTS DEPLOYMENT #"
85+
echo "##############################################################################"
86+
87+
echo "Creating folders"
88+
mkdir -p ./config/mysql/docker-entrypoint-initdb.d
89+
mkdir -p ./data/mysql
90+
echo ""
91+
92+
echo "Downloading CREATE_ALL.sql"
93+
curl -L https://raw.githubusercontent.com/LoicDelorme/Polytech-CryptoWallet-Backend/master/config/mysql/docker-entrypoint-initdb.d/CREATE_ALL.sql?token=AMTU8StN5WZfte3tZsc4sLobvavR7S_Yks5abbHawA%3D%3D -o ./config/mysql/docker-entrypoint-initdb.d/CREATE_ALL.sql
94+
echo ""
95+
96+
echo "Downloading docker-compose.yml"
97+
curl -L https://raw.githubusercontent.com/LoicDelorme/Polytech-CryptoWallet-Backend/master/docker-compose.yml?token=AMTU8UWaO3fULAlb-B8XcqnKtiaXS2Hbks5abd1DwA%3D%3D -o docker-compose.yml
98+
echo ""
99+
100+
echo "Deploying all containers"
101+
docker-compose up -d mysql-db-container
102+
sleep 10
103+
docker-compose up -d cryptowallet-backend-container
104+
echo ""
105+
106+
echo "##############################################################################"
107+
echo "# RUNNING? #"
108+
echo "##############################################################################"
109+
110+
echo "Listing all downloaded images"
111+
docker images
112+
echo ""
113+
114+
echo "Listing all running containers"
115+
docker ps -a
116+
echo ""
117+
118+
echo "##############################################################################"
119+
echo "# NETWORK #"
120+
echo "##############################################################################"
121+
122+
echo "Listing all network interfaces"
123+
netstat -ntlp | grep LISTEN
124+
echo ""

docker-compose.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.1'
1+
version: '2.1'
22
services:
33
mysql-db-container:
44
container_name: mysql-db-container
@@ -9,33 +9,30 @@ services:
99
volumes:
1010
- ./data/mysql:/var/lib/mysql
1111
- ./config/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
12-
ports:
13-
- "3306:3306"
1412

1513
cryptowallet-backend-container:
1614
container_name: cryptowallet-backend-container
1715
depends_on:
1816
- mysql-db-container
19-
image: delormeloic26/cryptowallet-backend
17+
image: delormeloic26/cryptowallet-backend:latest
2018
links:
2119
- mysql-db-container
2220
restart: always
2321
environment:
2422
- VIRTUAL_PORT=8090
2523
- VIRTUAL_HOST=cryptowallet.loic-delorme.fr
26-
- VIRTUAL_PROTO=https
24+
- VIRTUAL_PROTO=http
2725
- LETSENCRYPT_HOST=cryptowallet.loic-delorme.fr
2826
- LETSENCRYPT_EMAIL=loic.delorme.pro@gmail.com
2927

30-
cryptowallet-nginx-proxy-container:
31-
container_name: cryptowallet-nginx-proxy-container
28+
nginx-proxy-container:
29+
container_name: nginx-proxy-container
3230
depends_on:
3331
- cryptowallet-backend-container
3432
image: jwilder/nginx-proxy:alpine
3533
restart: always
3634
environment:
3735
- ENABLE_IPV6=true
38-
- HTTPS_METHOD=nohttp
3936
ports:
4037
- "80:80"
4138
- "443:443"
@@ -45,14 +42,13 @@ services:
4542
- /usr/share/nginx/html
4643
- /var/run/docker.sock:/tmp/docker.sock:ro
4744

48-
cryptowallet-nginx-proxy-companion-container:
49-
container_name: cryptowallet-nginx-proxy-companion-container
45+
nginx-proxy-companion-container:
46+
container_name: nginx-proxy-companion-container
5047
depends_on:
51-
- cryptowallet-backend-container
52-
image: jrcs/letsencrypt-nginx-proxy-companion
53-
restart: always
48+
- nginx-proxy-container
49+
image: jrcs/letsencrypt-nginx-proxy-companion:lates
5450
volumes:
5551
- ./config/nginx/certs:/etc/nginx/certs:rw
5652
- /var/run/docker.sock:/var/run/docker.sock:ro
5753
volumes_from:
58-
- cryptowallet-nginx-proxy-container
54+
- nginx-proxy-container

scripts/sql/CREATE_ALL.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ CREATE TABLE assets (
163163
INSERT INTO themes VALUES (1, 'Light', now(), now());
164164
INSERT INTO themes VALUES (2, 'Dark', now(), now());
165165

166-
INSERT INTO currencies VALUES (1, 'Dollar des États-Unis', 'USD', now(), now());
166+
INSERT INTO currencies VALUES (1, 'Dollar des Etats-Unis', 'USD', now(), now());
167167
INSERT INTO currencies VALUES (2, 'Euro', 'EUR', now(), now());
168168
INSERT INTO currencies VALUES (3, 'Franc suisse', 'CHF', now(), now());
169169

scripts/sql/CREATE_DATA.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ USE CryptoWallet;
33
INSERT INTO themes VALUES (1, 'Light', now(), now());
44
INSERT INTO themes VALUES (2, 'Dark', now(), now());
55

6-
INSERT INTO currencies VALUES (1, 'Dollar des États-Unis', 'USD', now(), now());
6+
INSERT INTO currencies VALUES (1, 'Dollar des Etats-Unis', 'USD', now(), now());
77
INSERT INTO currencies VALUES (2, 'Euro', 'EUR', now(), now());
88
INSERT INTO currencies VALUES (3, 'Franc suisse', 'CHF', now(), now());
99

0 commit comments

Comments
 (0)