File tree 5 files changed +110
-0
lines changed
5 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 4
4
matrix :
5
5
- SPRING_PROFILES_ACTIVE=test
6
6
- SPRING_PROFILES_ACTIVE=travis
7
+ global :
8
+ - secure : " fBav56BzY+A+Vs1g9YSfo1oLDCO1rFrXl49lJkOA5/XpnsKEEs4lI2RcOzz0wiJKXFNgcliiAJWoYMI8Esqz+lkyFWan4ij5Co0UzJcytDuY+2o+jaqwx45DuDYPogABzT+hWjLCxQLLG46gUkChzT8kcvOOn6JxC7Ff8q5MnoM="
7
9
8
10
before_script :
9
11
- if [ "$SPRING_PROFILES_ACTIVE" = 'travis' ]; then
10
12
mysql -u travis -e 'CREATE DATABASE mystamps CHARACTER SET utf8;';
13
+ if [ "$TRAVIS_BRANCH" = 'prod' ]; then
14
+ pip install --user ansible;
15
+ fi;
11
16
else
12
17
npm install -g bootlint;
13
18
pip install --user html5validator;
@@ -25,6 +30,14 @@ after_success:
25
30
./src/main/scripts/ci/publish-code-coverage.sh;
26
31
fi
27
32
33
+ deploy :
34
+ provider : script
35
+ script : ./src/main/scripts/ci/deploy.sh
36
+ on :
37
+ branch : prod
38
+ condition : $SPRING_PROFILES_ACTIVE = 'travis'
39
+ skip_cleanup : true
40
+
28
41
jdk :
29
42
- oraclejdk8
30
43
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - hosts : all
4
+ gather_facts : no
5
+ remote_user : mystamps
6
+ vars :
7
+ remote_war_dir : /data/mystamps
8
+ uptimerobot :
9
+ monitorid : ' MyStamps'
10
+ apikey : " {{ lookup('env', 'UPTIMEROBOT_APIKEY') }}"
11
+ tasks :
12
+
13
+ - name : Getting info about WAR file
14
+ stat :
15
+ path : ' target/mystamps.war'
16
+ get_checksum : no
17
+ get_md5 : no
18
+ register : war_file
19
+ become : no
20
+ delegate_to : 127.0.0.1
21
+
22
+ - name : Ensuring that WAR file exists
23
+ assert :
24
+ that :
25
+ war_file.stat.exists
26
+ become : no
27
+ delegate_to : 127.0.0.1
28
+
29
+ - name : Stopping monitoring
30
+ uptimerobot :
31
+ monitorid : " {{ uptimerobot.monitorid }}"
32
+ apikey : " {{ uptimerobot.apikey }}"
33
+ state : paused
34
+ when : uptimerobot is defined and uptimerobot.monitorid != '' and uptimerobot.apikey != ''
35
+
36
+ - name : Stopping service
37
+ service :
38
+ name : mystamps
39
+ state : stopped
40
+
41
+ - name : Copying WAR file
42
+ copy :
43
+ src : ' ../../../../../target/mystamps.war'
44
+ dest : " {{ remote_war_dir }}/mystamps.war"
45
+ owner : mystamps
46
+ group : mystamps
47
+ mode : ' 0755'
48
+ backup : yes
49
+
50
+ - name : Starting service
51
+ service :
52
+ name : mystamps
53
+ enabled : yes
54
+ state : started
55
+
56
+ - name : Starting monitoring
57
+ uptimerobot :
58
+ monitorid : " {{ uptimerobot.monitorid }}"
59
+ apikey : " {{ uptimerobot.apikey }}"
60
+ state : started
61
+ when : uptimerobot is defined and uptimerobot.monitorid != '' and uptimerobot.apikey != ''
62
+
Original file line number Diff line number Diff line change
1
+ my-stamps.ru
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Treat unset variables and parameters as an error when performing parameter expansion
4
+ set -o nounset
5
+
6
+ # Exit immediately if command returns a non-zero status
7
+ set -e errexit
8
+
9
+ # Return value of a pipeline is the value of the last command to exit with a non-zero status
10
+ set -o pipefail
11
+
12
+
13
+ CURRENT_DIR=" $( dirname " ${0:- .} " ) "
14
+ INVENTORY=" $CURRENT_DIR /ansible/mystamps.inventory"
15
+ PLAYBOOK=" $CURRENT_DIR /ansible/deploy.yml"
16
+ PRIVATE_KEY=" $CURRENT_DIR /ansible/mystamps_rsa"
17
+
18
+ cleanup () {
19
+ rm -f " $PRIVATE_KEY "
20
+ exit
21
+ }
22
+ trap ' cleanup' EXIT SIGHUP SIGINT SIGTERM
23
+
24
+ # Disable host key checking to suppress interactive prompt.
25
+ # See: http://docs.ansible.com/ansible/intro_getting_started.html#host-key-checking
26
+ export ANSIBLE_HOST_KEY_CHECKING=False
27
+
28
+ # Decrypt private key
29
+ openssl aes-256-cbc -K $encrypted_bf07cb25089f_key -iv $encrypted_bf07cb25089f_iv -in " $PRIVATE_KEY .enc" -out " $PRIVATE_KEY " -d
30
+ chmod 600 " $PRIVATE_KEY "
31
+
32
+ ansible-playbook --inventory-file=" $INVENTORY " " $PLAYBOOK " --syntax-check
33
+
34
+ exec ansible-playbook --inventory-file=" $INVENTORY " " $PLAYBOOK " --private-key=" $PRIVATE_KEY "
You can’t perform that action at this time.
0 commit comments