Skip to content

Commit c6ca00a

Browse files
authored
Merge pull request #10 from Kalgoc/continuous_deploy
Continuous deploy
2 parents 0d07579 + 6263c06 commit c6ca00a

5 files changed

+56
-0
lines changed

appspec.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 0.0
2+
os: linux
3+
4+
# In this case we copy all the files of the project to the EC2
5+
files:
6+
- source: /
7+
destination: /home/ubuntu/api
8+
9+
# If a file already exists in the destination, it will be OVERWRITTEN
10+
file_exists_behavior: OVERWRITE
11+
12+
#
13+
hooks:
14+
# First the CodeDeploy agent stops the application
15+
ApplicationStop:
16+
- location: scripts/application_stop.sh
17+
timeout: 100
18+
runas: ubuntu
19+
overwrite: true
20+
# The isntall the service (Copy the revision files to the EC2)
21+
# So we can run after install scripts for example for configuration
22+
AfterInstall:
23+
- location: scripts/after_install.sh
24+
timeout: 100
25+
runas: ubuntu
26+
overwrite: true
27+
# Then Start the service
28+
ApplicationStart:
29+
- location: scripts/application_start.sh
30+
timeout: 100
31+
runas: ubuntu
32+
overwrite: true
33+
# Finally we validate the deployment with a script
34+
ValidateService:
35+
- location: scripts/validate_service.sh
36+
timeout: 100
37+
runas: ubuntu
38+
overwrite: true

scripts/after_install.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# !/bin/bash
2+
cd /home/ubuntu/api
3+
4+
echo "Running After Start Script ..."

scripts/application_start.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# !/bin/bash
2+
cd /home/ubuntu/api
3+
4+
echo "Starting service ..."
5+
docker compose up -d

scripts/application_stop.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# !/bin/bash
2+
cd /home/ubuntu/api
3+
4+
echo "Stopping service ..."
5+
docker compose down

scripts/validate_service.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# !/bin/bash
2+
cd /home/ubuntu/api
3+
4+
echo "Validating service is Up ..."

0 commit comments

Comments
 (0)