File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
- # whatever name you want to ssh it from your local machine
1
+ # whatever name you want to ssh it from your local machine, can be anything call it foo
2
2
Host prod.backend.marsplay
3
3
4
4
# use the ip address of the remote server, using dns in this case
Original file line number Diff line number Diff line change
1
+ # service file for autostarting your docker builds on system reboot
2
+ # I wrote this file so that in case of server crashes anyone can simply reboot the system and get the system running again
3
+ # I paired this up with aws system checks, In case of failed system check I applied the restart policy. So your system never goes
4
+ # out for more than 2 minutes even in case of seve crashes.
5
+
6
+ # /etc/systemd/system/docker-compose-app.service
7
+
8
+ [Unit]
9
+ Description =Docker Compose Application Service
10
+ Requires =docker.service # This will start docker service, equivalent of calling sudo service start docker, yes it runs on root priviledges
11
+ After =docker.service # once the docker service has started we run the remaining
12
+
13
+ [Service]
14
+ WorkingDirectory =/home/ec2-user/marsplay-api/docker/prod #The location of docker-compose file
15
+ ExecStart =/usr/local/bin/docker-compose up #start script,
16
+ ExecStop =/usr/local/bin/docker-compose down #before system shutdown
17
+ TimeoutStartSec =0
18
+ Restart =on-failure #restart policy in case it was shutdown
19
+ StartLimitIntervalSec =60
20
+ StartLimitBurst =3
21
+
22
+ [Install]
23
+ WantedBy =multi-user.target
You can’t perform that action at this time.
0 commit comments