Преглед на файлове

Added auto-start

updated scalite-run.service

fixed auto-deployer.service
master
jfederico преди 4 години
родител
ревизия
e3683c4abd
променени са 6 файла, в които са добавени 51 реда и са изтрити 11 реда
  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 Целия файл

@@ -221,7 +221,7 @@ Note that the application can be run in the background with `docker-compose up -
221 221
 <a name="initializing-pool"/>
222 222
 
223 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 226
 Open a new console and get the IDs of the docker containers running:
227 227
 
@@ -266,20 +266,29 @@ sudo .scripts/deploy.sh
266 266
 
267 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 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 277
 sudo systemctl daemon-reload
278 278
 sudo systemctl enable scalelite-auto-deployer.service
279 279
 sudo systemctl enable scalelite-auto-deployer.timer
280 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 292
 <a name="distributed-deployment"/>
284 293
 
285 294
 ## II. Distributed Deployment

+ 5
- 4
scripts/deploy.sh Целия файл

@@ -1,5 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
+DIR="$(cd "$(dirname "$0")" && pwd)"
3 4
 STATUS="Status: Downloaded newer image for blindsidenetwks/scalelite:latest"
4 5
 
5 6
 new_status=$(sudo docker pull blindsidenetwks/scalelite:latest | grep Status:)
@@ -8,10 +9,10 @@ echo $new_status
8 9
 
9 10
 if [ "$STATUS" == "$new_status" ]
10 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 16
 fi
16 17
 
17 18
 exit 0

+ 2
- 2
scripts/scalelite-auto-deployer.service Целия файл

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

+ 18
- 0
scripts/scalelite-run.service Целия файл

@@ -0,0 +1,18 @@
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 Целия файл

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

+ 6
- 0
scripts/stop.sh Целия файл

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

Loading…
Отказ
Запис