Browse Source

Added auto-start

updated scalite-run.service

fixed auto-deployer.service
master
jfederico 4 years ago
parent
commit
e3683c4abd
6 changed files with 51 additions and 11 deletions
  1. 14
    5
      README.md
  2. 5
    4
      scripts/deploy.sh
  3. 2
    2
      scripts/scalelite-auto-deployer.service
  4. 18
    0
      scripts/scalelite-run.service
  5. 6
    0
      scripts/start.sh
  6. 6
    0
      scripts/stop.sh

+ 14
- 5
README.md View File

221
 <a name="initializing-pool"/>
221
 <a name="initializing-pool"/>
222
 
222
 
223
 #### 4.1. Initializing pool of servers
223
 #### 4.1. Initializing pool of servers
224
-Since there are no servers added by default, atleast 1 server must be added and enabled in order to get started. 
224
+Since there are no servers added by default, atleast 1 server must be added and enabled in order to get started.
225
 
225
 
226
 Open a new console and get the IDs of the docker containers running:
226
 Open a new console and get the IDs of the docker containers running:
227
 
227
 
266
 
266
 
267
 <a name="rolling-out-updates-automatic"/>
267
 <a name="rolling-out-updates-automatic"/>
268
 
268
 
269
-##### 4.2.2. Automatic updates and auto-start
269
+##### 4.2.2. Automatic updates
270
 
270
 
271
 Use the scripts provided.
271
 Use the scripts provided.
272
 
272
 
273
 ```
273
 ```
274
-sudo ln -s /home/ubuntu/scalelite-run/scripts/deploy.sh /usr/local/bin/scalelite-deploy
275
-sudo cp /home/ubuntu/scalelite-run/scripts/scalelite-auto-deployer.service /etc/systemd/system/scalelite-auto-deployer.service
276
-sudo cp /home/ubuntu/scalelite-run/scripts/scalelite-auto-deployer.timer /etc/systemd/system/scalelite-auto-deployer.timer
274
+sudo ln -s <YOUR ROOT>/scalelite-run/scripts/deploy.sh /usr/local/bin/scalelite-deploy
275
+sudo cp <YOUR ROOT>/scalelite-run/scripts/scalelite-auto-deployer.service /etc/systemd/system/scalelite-auto-deployer.service
276
+sudo cp <YOUR ROOT>/scalelite-run/scripts/scalelite-auto-deployer.timer /etc/systemd/system/scalelite-auto-deployer.timer
277
 sudo systemctl daemon-reload
277
 sudo systemctl daemon-reload
278
 sudo systemctl enable scalelite-auto-deployer.service
278
 sudo systemctl enable scalelite-auto-deployer.service
279
 sudo systemctl enable scalelite-auto-deployer.timer
279
 sudo systemctl enable scalelite-auto-deployer.timer
280
 sudo systemctl start scalelite-auto-deployer.timer
280
 sudo systemctl start scalelite-auto-deployer.timer
281
 ```
281
 ```
282
 
282
 
283
+<a name="starting-automatic"/>
284
+
285
+##### 4.2.3. Automatic start
286
+
287
+Use the scripts provided.
288
+
289
+```
290
+```
291
+
283
 <a name="distributed-deployment"/>
292
 <a name="distributed-deployment"/>
284
 
293
 
285
 ## II. Distributed Deployment
294
 ## II. Distributed Deployment

+ 5
- 4
scripts/deploy.sh View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
+DIR="$(cd "$(dirname "$0")" && pwd)"
3
 STATUS="Status: Downloaded newer image for blindsidenetwks/scalelite:latest"
4
 STATUS="Status: Downloaded newer image for blindsidenetwks/scalelite:latest"
4
 
5
 
5
 new_status=$(sudo docker pull blindsidenetwks/scalelite:latest | grep Status:)
6
 new_status=$(sudo docker pull blindsidenetwks/scalelite:latest | grep Status:)
8
 
9
 
9
 if [ "$STATUS" == "$new_status" ]
10
 if [ "$STATUS" == "$new_status" ]
10
 then
11
 then
11
-  cd /home/ubuntu/scalelite-run
12
-  sudo docker-compose down
13
-  sudo docker rmi $(sudo docker images -f dangling=true -q)
14
-  sudo docker-compose up -d
12
+  cd $DIR/..
13
+  docker-compose down
14
+  docker rmi $(docker images -f dangling=true -q)
15
+  docker-compose up -d
15
 fi
16
 fi
16
 
17
 
17
 exit 0
18
 exit 0

+ 2
- 2
scripts/scalelite-auto-deployer.service View File

2
 Description=ScaleLite Auto Deployer
2
 Description=ScaleLite Auto Deployer
3
 
3
 
4
 [Service]
4
 [Service]
5
-ExecStart=/bin/bash /usr/local/bin/scalelite-deploy
5
+ExecStart=/bin/bash /opt/scalelite-run/scripts/deploy.sh
6
 
6
 
7
 [Install]
7
 [Install]
8
 WantedBy=multi-user.target
8
 WantedBy=multi-user.target
9
-Alias=scalelite.service
9
+Alias=scalelite-auto-deployer

+ 18
- 0
scripts/scalelite-run.service View File

1
+[Unit]
2
+Description=ScaleLite Run
3
+After=network.target
4
+After=systemd-user-sessions.service
5
+After=network-online.target
6
+
7
+[Service]
8
+ExecStart=/bin/bash /opt/scalelite-run/scripts/start.sh
9
+ExecStop=/bin/bash /opt/scalelite-run/scripts/stop.sh
10
+TimeoutSec=30
11
+Restart=on-failure
12
+RestartSec=30
13
+StartLimitInterval=350
14
+StartLimitBurst=10
15
+
16
+[Install]
17
+WantedBy=multi-user.target
18
+Alias=scalelite-run

+ 6
- 0
scripts/start.sh View File

1
+#!/bin/bash
2
+
3
+DIR="$(cd "$(dirname "$0")" && pwd)"
4
+
5
+cd $DIR/..
6
+docker-compose up -d

+ 6
- 0
scripts/stop.sh View File

1
+#!/bin/bash
2
+
3
+DIR="$(cd "$(dirname "$0")" && pwd)"
4
+
5
+cd $DIR/..
6
+docker-compose down

Loading…
Cancel
Save