Browse Source

infra: Add script to deploy the xsn-backend

prometheus-integration
Alexis Hernandez 6 years ago
parent
commit
0f39c55630
  1. 22
      infra/deployment/config/xsn-backend.env
  2. 4
      infra/deployment/scripts/build-server.sh
  3. 15
      infra/deployment/systemd-services/xsn-backend.service
  4. 88
      infra/deployment/xsn-backend.yml

22
infra/deployment/config/xsn-backend.env

@ -0,0 +1,22 @@
$ANSIBLE_VAULT;1.1;AES256
62623336613966643032386435616665653265363462623531326332366164393133376663613832
3034353430613737376630653362306366386337356532360a306566353363343138656635363937
62643432386661346230353633643165316537656461643065663033363437636464396439326363
3130633364313561300a303839646536636537333735313061373931336633326333633031326662
30326635303138366564623737313539353538303330613532323835623464313532303637363033
31623432633635383134653033313431623661353032383838656630323537666239383962373637
62343863383966346338643461306433623535646138356264393863353638633533373862326433
63623038666264333531656531623261336335663138343462636134386137613530323434643136
36333530613566643935383336656235373135616437366566653966316132363362336434626162
37653430343537653434366234626137643763333432383732333738613435383033623731633465
62393139373734316564623634333830643136313861333461333738636233653263303234646430
66313630326238393062656466363031623533666363623861633633333964346433613665353061
31363438643265356538613666636238643264356661386263343430643638303530663836653834
39383461666336616332313237626266653937656465636664623734353035336263323231653233
62623539376232613939663033306331656663646466333334366236613236396135663236333261
35393436653637663265343430653538663836383630346566346165366133613336646533323665
34396163303034653261373231653537326533643966386532353337343232636134313266393462
63333239373038326464376466326232633433343262633733356562656436356561353432306461
39353537306663623463323537616530636564663763386362383730363434376366623530383232
35633262333764343163363466366535373830396139653166356536623162663362626436336233
3039

4
infra/deployment/scripts/build-server.sh

@ -0,0 +1,4 @@
#!/bin/bash
set -e
cd ../../server/ && sbt dist && cd -
cp ../../server/target/universal/xsn-block-explorer-0.1.0-SNAPSHOT.zip app.zip

15
infra/deployment/systemd-services/xsn-backend.service

@ -0,0 +1,15 @@
[Unit]
Description=XSN Backend Server
[Service]
Type=simple
WorkingDirectory=/home/play/app/xsn-block-explorer-0.1.0-SNAPSHOT
StandardOutput=tty
StandardError=tty
EnvironmentFile=/home/play/app/.env
User=play
ExecStart=/home/play/app/xsn-block-explorer-0.1.0-SNAPSHOT/bin/xsn-block-explorer -Dhttp.port=9000 -Dpidfile.path=/dev/null
Restart=on-failure
[Install]
WantedBy=multi-user.target

88
infra/deployment/xsn-backend.yml

@ -0,0 +1,88 @@
---
- hosts: server
gather_facts: no
roles:
- ubuntu-16-04
- java8-oracle
tasks:
- name: Build the application
shell: ./scripts/build-server.sh
delegate_to: 127.0.0.1
- name: Upload the application
synchronize:
src: app.zip
dest: app.zip
- name: Create the play group
become: yes
group:
name: play
state: present
- name: Create the play user
become: yes
user:
name: play
group: play
state: present
system: yes
- name: Create the app directory
become: yes
file:
path: /home/play/app
state: directory
owner: play
group: play
- name: Unpack the application
become: yes
unarchive:
remote_src: yes
src: app.zip
dest: /home/play/app
owner: play
group: play
- name: Set the application config
become: yes
copy:
src: config/xsn-backend.env
dest: /home/play/app/.env
owner: play
group: play
- name: Set the application files permissions
become: yes
file:
dest: /home/play/app
owner: play
group: play
recurse: yes
- name: Add the systemd service
become: yes
copy:
src: systemd-services/xsn-backend.service
dest: /etc/systemd/system/
owner: root
group: root
- name: Pick up systemd changes
become: yes
systemd:
daemon_reload: yes
- name: Restart the application
become: yes
systemd:
name: xsn-backend
state: restarted
- name: Enable the application to run on system startup
become: yes
systemd:
name: xsn-backend
enabled: yes
Loading…
Cancel
Save