Browse Source

infra: Add deployment scripts for litecoin

prometheus-integration
Alexis Hernandez 6 years ago
parent
commit
cf3fd0f044
  1. 13
      infra/deployment/config/litecoin.conf
  2. 26
      infra/deployment/config/ltc-backend.env
  3. 88
      infra/deployment/ltc-backend.yml
  4. 106
      infra/deployment/ltcd.yml
  5. 15
      infra/deployment/systemd-services/ltc-backend.service
  6. 15
      infra/deployment/systemd-services/ltc-rpc.service
  7. 3
      infra/deployment/test-hosts.ini

13
infra/deployment/config/litecoin.conf

@ -0,0 +1,13 @@
$ANSIBLE_VAULT;1.1;AES256
37376338643038356261626533613434623136656366336438396561326637373131653332376333
3539643539363039663634336335626662323539326536630a366436383734313832643733313864
66633565393661623934393537373766313035616366646435353464633561336466613361343439
3662616136383335350a336261386437343237343539643862356436366562373631626338353432
32383965633739303831366438623465646563366465386432656666306334613134613934386135
39666463396235383133323866396136656564373561323837346238313965313133316233373533
63633437303961643466323162653764316361373039343432663736653132393238393365323437
32393334363466396533633033623465613533613430383931346136613338636462376235376637
61316638333632353631396436636561663561373831656532666261326539383231623037303362
30366164613332383139373132333836333964306363323339323230643732366366383438333831
31346330666434373963616334633534306532373137306638393438373438313730643331383562
64613363353264373164

26
infra/deployment/config/ltc-backend.env

@ -0,0 +1,26 @@
$ANSIBLE_VAULT;1.1;AES256
63623063373232393934636336316662363739616532333233643561306432376430316534373263
6537343661346138303365323061383561633864643835650a396665613961363433383631333466
33326233663863333432393737656435636565313332653335363263663935663537396163323965
3632373662666561610a386236343663333263306432363531356331626434323462323730366339
34393230616664623665643530636233646565343533333865353532663135343933666433326138
35356561323537396539356263313966326664353564396661643339656366393630363134313233
37386262313731636132386365343536613565616534316232333463656266313764346464633865
64623365336633616630306132326364363534353666633330313439376338386662396464633435
62326363643765613663653037346633633636633738633233643162613839363439373664363834
63363435336639643539633232336237303463376334363230313731363065383134383663356261
64366439373735663233333563303035643364653166396566346437626463326432363039396466
66653736643036383836613431656230363130613732646361336537366639303532393532373463
37633764313937653731656463303763303538656434373266383863656634653635633266623237
39633564663132666264323861306133373062663962663834333565643835613837393735373637
37663939303164383365383066653066643066383433383966656131393537633930326461393635
30643865376565353736363562613364623865656564353832666266313130306537373565366431
61633464303164376361646232333063653232656234353866633264303161326135353263343535
66633362326165343538623962386662653830346436383032386363613761333631373966336435
31623562386363623932373166323635616434366135353066623333356562336333343665666664
61663161383733373366663361663161366539323364356261343037623761643563663561373636
66303930376361383033343462663535336132663331333863313331373638613562626637653565
33393531373164303733333833353234326361643336353637316232626564303662303236646633
35663535396336663735653034373634376530616163343664353366636564303831356562656438
65383861636336633737616534326462323932316230633162386131373238646664366264316437
3764

88
infra/deployment/ltc-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/ltc-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/ltc-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: ltc-backend
state: restarted
- name: Enable the application to run on system startup
become: yes
systemd:
name: ltc-backend
enabled: yes

106
infra/deployment/ltcd.yml

@ -0,0 +1,106 @@
---
- hosts: ltcd
gather_facts: no
roles:
- ubuntu-16-04
vars:
- ltc_user: ltc
- ltc_group: ltc
- ltc_home: /home/ltc
- ltc_config_dir: /home/ltc/.litecoin
- ltc_download_url: https://download.litecoin.org/litecoin-0.16.3/linux/litecoin-0.16.3-x86_64-linux-gnu.tar.gz
- ltc_download_dest: /home/dummy/ltc.tar.gz
- ltc_download_checksum: sha1:963e958bf5dd045fd70d787d6830f64962ae977d
- ltc_unarchive_dest: /home/ltc/app
tasks:
- name: Create the ltc group
become: yes
group:
name={{ ltc_group }}
state=present
- name: Create the ltc user
become: yes
user:
name={{ ltc_user }}
group={{ ltc_group }}
state=present
system=yes
- name: Create the app directory
become: yes
file:
path={{ ltc_home }}/app
state=directory
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Create the config directory
become: yes
file:
path={{ ltc_config_dir }}
state=directory
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Download the ltcd
get_url:
url={{ ltc_download_url }}
dest={{ ltc_download_dest }}
checksum={{ ltc_download_checksum }}
- name: Unpack the application
become: yes
unarchive:
remote_src=yes
src={{ ltc_download_dest }}
dest={{ ltc_unarchive_dest }}
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Move the application to the right folder
become: yes
command: mv {{ ltc_unarchive_dest }}/litecoin-0.16.3/bin/litecoind {{ ltc_unarchive_dest }}
- name: Set the application config
become: yes
copy:
src=config/litecoin.conf
dest={{ ltc_config_dir }}/litecoin.conf
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Set the application files permissions
become: yes
file:
dest={{ ltc_home }}
owner={{ ltc_user }}
group={{ ltc_group }}
recurse=yes
- name: Add the systemd service
become: yes
copy:
src: systemd-services/ltc-rpc.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: ltc-rpc
state: restarted
- name: Enable the application to run on system startup
become: yes
systemd:
name: ltc-rpc
enabled: yes

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

@ -0,0 +1,15 @@
[Unit]
Description=LTC 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

15
infra/deployment/systemd-services/ltc-rpc.service

@ -0,0 +1,15 @@
[Unit]
Description=LTC RPC Server
[Service]
Type=simple
WorkingDirectory=/home/ltc/
StandardOutput=tty
StandardError=tty
User=ltc
ExecStart=/home/ltc/app/litecoind
Restart=on-failure
[Install]
WantedBy=multi-user.target

3
infra/deployment/test-hosts.ini

@ -4,5 +4,8 @@ test-server
[xsnd] [xsnd]
test-server test-server
[ltcd]
test-server
[postgres] [postgres]
test-server test-server

Loading…
Cancel
Save