File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ if ! [ -x " $( command -v docker) " ]; then # checking if docker is installed or not
3
+ echo ' Docker is not installed. Installing docker' ;
4
+ # Now installing docker
5
+ sudo apt-get update;
6
+ sudo apt-get install linux-image-extra-$( uname -r) ;
7
+ sudo apt-get install linux-image-extra-virtual;
8
+ sudo apt-get install \
9
+ apt-transport-https \
10
+ ca-certificates \
11
+ curl \
12
+ software-properties-common;
13
+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -;
14
+
15
+ if [[ ` dpkg --print-architecture` == " amd64" ]]; then
16
+ sudo add-apt-repository \
17
+ " deb [arch=amd64] https://download.docker.com/linux/ubuntu \
18
+ $( lsb_release -cs) \
19
+ stable" ;
20
+ else
21
+ sudo add-apt-repository \
22
+ " deb [arch=armhf] https://download.docker.com/linux/ubuntu \
23
+ $( lsb_release -cs) \
24
+ stable" ;
25
+ fi
26
+ sudo apt-get update;
27
+ sudo apt-get install docker-ce;
28
+ fi
29
+ if docker login; then
30
+ docker pull p2pvalue/swellrt &
31
+ PID1=$!
32
+ wait $PID1
33
+ docker pull mongo &
34
+ PID2=$!
35
+ wait $PID2
36
+ docker stop swellrt # stopping and removing previous containers to avoid port conflict.
37
+ docker stop mongo
38
+ docker rm swellrt
39
+ docker rm mongo
40
+ docker run -p 27017:27017 --name mongo -d mongo;
41
+ docker run -v ~ /.swellrt/config:/usr/local/swellrt/config -v ~ /.swellrt/log:/usr/local/swellrt/log -v ~ /.swellrt/sessions:/usr/local/swellrt/sessions -v ~ /.swellrt/avatars:/usr/local/swellrt/avatars -v ~ /.swellrt/attachments:/usr/local/swellrt/attachments -p 9898:9898 -h swellrt -d p2pvalue/swellrt
42
+ if docker run -e MONGODB_HOST=mongo -e MONGODB_PORT=27017 -e MONGODB_DB=swellrt -p 9898:9898 -h swellrt --name swellrt --link mongo:mongo -d p2pvalue/swellrt; then
43
+ echo " Swellrt setup successful. checkout http://localhost:9898" ;
44
+ fi
45
+ echo " The docker image folders to be placed on the host machine are stored at ~/.swellrt" ;
46
+ fi
You can’t perform that action at this time.
0 commit comments