diff --git a/infra/deployment/config/groestlcoin-backend.env b/infra/deployment/config/groestlcoin-backend.env new file mode 100644 index 0000000..6a8d883 --- /dev/null +++ b/infra/deployment/config/groestlcoin-backend.env @@ -0,0 +1,31 @@ +$ANSIBLE_VAULT;1.1;AES256 +33356531616562353366613834393135646165383332333435663065383133613735653333633066 +3130333966613933656165636131363839346430333831350a306339653832393935656537396638 +64663134366535633261376238333136346436653063336535376365333439353034633862333962 +6666386239343735650a376265616334663632323262613034326330353139636439623831353866 +39643065336532613734373461316237353636323666303131376332353838663633613262373430 +31353930333934383664633335656564303739396166393330373536373566653766626565333936 +61306439356232396366366335346165316139363337656232643761313564646331613137383965 +38393861633633326634306333613530633635386435376339393337656362633435656264626165 +32633136653866366236373035613961336238363230333330346635353234623236326535373430 +30326163613136616462626264626664326438616632663361303138303537306464383830376335 +63343965653763363963303361626136626561653136626538353163626236383830366537346638 +37643633306437323661383034616132633662333234393435656333343836393238633361643737 +35326231353136373731323065636436393639646163623337353662346338666133356635316631 +37383533363033373237303363326363376164373237316632306631646461303638373733383535 +64623638653163363435343762626131643136313935393137613636666437616664343933336333 +39366333666436396433613139653633663337336135396563383264653961303134653664656566 +38333439643831373163613334316136613737323339376330313539383138616663383136343933 +36623361346439336438326639336634346566653337316338636362613562306562653666363165 +64646134336232613965643237633737303136613863343235646330396263306131643334396364 +62356332653735303138646638313337313038366634353736363138343939656262326665333831 +37353939613833613832393766316332623233383863613832646630613432353135383566353065 +61376661393537326563376462323761656161336664363064356236363137616136313565336534 +34653565663335663039303534323030656538653838316637313266643661336230363439326535 +30616363383631316639643738396661336438646239303663626231343139616134653661376433 +64663632303237613566333336326263646432343164316461366430616535366461623863633139 +34306433616365323262653831616435316339646564386631316563333263633038616435363038 +66623932663466313039646564643265646230333230613633613861396464636665626333653836 +33633937333530333866303435643131646461666237613535316233376633663433346137623533 +32646339383161653466643939393531306634363962663530323663323530336364333035623965 +6439376633666239363236326361613231646266373862636362 diff --git a/infra/deployment/config/groestlcoin.conf b/infra/deployment/config/groestlcoin.conf new file mode 100644 index 0000000..1989691 --- /dev/null +++ b/infra/deployment/config/groestlcoin.conf @@ -0,0 +1,13 @@ +$ANSIBLE_VAULT;1.1;AES256 +63376432313036666339393065663430336461663565623766653138333031363235383331636662 +3063643164313465343166663362313464656533396239350a636165383838633731386230386537 +34653235373634303030333564386134353665346430303730303734383362636337343934343932 +6635626661393336390a383663613566336635323661366565336139623164626231333630396234 +66356531363061376130386139316437313931343133626665386164373264633666656436333961 +36643236333834636338393634333464666531643863626462653036636631363930306363636365 +38346334663939326439626665613838393033393431353937633830663362373663393832653062 +34313531663837316136346230383532666235386166363962613531383131303539326532633562 +63393436383363646533376232633166383239666234383930653430633864613136623337663362 +30633663636532396532653134316638343734636636313334613538373736343632343266366536 +32313961333265343532343932386332633463643363653731646237343339383131643565366537 +30633832333138653663 diff --git a/infra/deployment/config/sentry-groestlcoin.properties b/infra/deployment/config/sentry-groestlcoin.properties new file mode 100644 index 0000000..ed660ca --- /dev/null +++ b/infra/deployment/config/sentry-groestlcoin.properties @@ -0,0 +1,2 @@ +stacktrace.app.packages=com.xsn,com.alexitc +servername=groestlcoin diff --git a/infra/deployment/config/xsnexplorer.io b/infra/deployment/config/xsnexplorer.io index 867850a..bf8971f 100644 --- a/infra/deployment/config/xsnexplorer.io +++ b/infra/deployment/config/xsnexplorer.io @@ -24,6 +24,11 @@ server { proxy_pass http://10.136.151.203:9000; } + location /api/grs { + rewrite ^/api/grs/(.*) /$1 break; + proxy_pass http://10.136.164.36:9000; + } + location /api/xsn { rewrite ^/api/xsn/(.*) /$1 break; proxy_pass http://10.136.160.52:9000; diff --git a/infra/deployment/groestlcoin-backend.yml b/infra/deployment/groestlcoin-backend.yml new file mode 100644 index 0000000..beacc3c --- /dev/null +++ b/infra/deployment/groestlcoin-backend.yml @@ -0,0 +1,104 @@ +--- +- 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 routes + become: yes + copy: + src: config/ltc-routes + dest: /home/play/app/xsn-block-explorer-0.1.0-SNAPSHOT/conf/routes + owner: play + group: play + + - name: Set the application config + become: yes + copy: + src: config/groestlcoin-backend.env + dest: /home/play/app/.env + owner: play + group: play + + - name: Set the sentry config + become: yes + copy: + src: config/sentry-groestlcoin.properties + dest: /home/play/app/xsn-block-explorer-0.1.0-SNAPSHOT/conf/sentry.properties + 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/groestlcoin-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: groestlcoin-backend + state: restarted + + - name: Enable the application to run on system startup + become: yes + systemd: + name: groestlcoin-backend + enabled: yes diff --git a/infra/deployment/groestlcoind.yml b/infra/deployment/groestlcoind.yml new file mode 100644 index 0000000..e845768 --- /dev/null +++ b/infra/deployment/groestlcoind.yml @@ -0,0 +1,112 @@ +--- +- hosts: groestlcoind + gather_facts: no + roles: + - ubuntu-16-04 + + vars: + - x_user: groestlcoin + - x_group: groestlcoin + - x_home: /home/groestlcoin + - x_config_dir: /home/groestlcoin/.groestlcoin + - x_download_url: https://github.com/Groestlcoin/groestlcoin/releases/download/v2.17.2/groestlcoin-2.17.2-x86_64-linux-gnu.tar.gz + - x_download_dest: /home/ubuntu/groestlcoin.tar.gz + - x_download_checksum: sha1:3f9e18082e89d0e73b0f2c4e1c8305052c7c8f77 + - x_unarchive_dest: /home/groestlcoin/app + + tasks: + - name: Create the groestlcoin group + become: yes + group: + name={{ x_group }} + state=present + + - name: Create the groestlcoin user + become: yes + user: + name={{ x_user }} + group={{ x_group }} + state=present + system=yes + + - name: Create the app directory + become: yes + file: + path={{ x_home }}/app + state=directory + owner={{ x_user }} + group={{ x_group }} + + - name: Create the config directory + become: yes + file: + path={{ x_config_dir }} + state=directory + owner={{ x_user }} + group={{ x_group }} + + - name: Download the groestlcoind + get_url: + url={{ x_download_url }} + dest={{ x_download_dest }} + checksum={{ x_download_checksum }} + + - name: Unpack the application + become: yes + unarchive: + remote_src=yes + src={{ x_download_dest }} + dest={{ x_unarchive_dest }} + owner={{ x_user }} + group={{ x_group }} + + - name: Move the application to the right folder + become: yes + command: mv {{ x_unarchive_dest }}/groestlcoin-2.17.2/bin/groestlcoind {{ x_unarchive_dest }} + + - name: Set the application as executable + become: yes + file: + path: "{{ x_unarchive_dest }}/groestlcoind" + mode: "u=rwx" + + - name: Set the application config + become: yes + copy: + src=config/groestlcoin.conf + dest={{ x_config_dir }}/groestlcoin.conf + owner={{ x_user }} + group={{ x_group }} + + - name: Set the application files permissions + become: yes + file: + dest={{ x_home }} + owner={{ x_user }} + group={{ x_group }} + recurse=yes + + - name: Add the systemd service + become: yes + copy: + src: systemd-services/groestlcoin-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: groestlcoin-rpc + state: restarted + + - name: Enable the application to run on system startup + become: yes + systemd: + name: groestlcoin-rpc + enabled: yes diff --git a/infra/deployment/production-groestlcoin.ini b/infra/deployment/production-groestlcoin.ini new file mode 100644 index 0000000..dd89682 --- /dev/null +++ b/infra/deployment/production-groestlcoin.ini @@ -0,0 +1,8 @@ +[server] +groestlcoin-explorer + +[groestlcoind] +groestlcoin-explorer + +[postgres] +groestlcoin-explorer diff --git a/infra/deployment/systemd-services/groestlcoin-backend.service b/infra/deployment/systemd-services/groestlcoin-backend.service new file mode 100644 index 0000000..16e96c9 --- /dev/null +++ b/infra/deployment/systemd-services/groestlcoin-backend.service @@ -0,0 +1,16 @@ +[Unit] +Description=GRS 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 +LimitNOFILE=65535 +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 diff --git a/infra/deployment/systemd-services/groestlcoin-rpc.service b/infra/deployment/systemd-services/groestlcoin-rpc.service new file mode 100644 index 0000000..62dd8f9 --- /dev/null +++ b/infra/deployment/systemd-services/groestlcoin-rpc.service @@ -0,0 +1,16 @@ +[Unit] +Description=GRS RPC Server + +[Service] +Type=simple +WorkingDirectory=/home/groestlcoin/ +StandardOutput=tty +StandardError=tty +User=groestlcoin +LimitNOFILE=65535 +ExecStart=/home/groestlcoin/app/groestlcoind + +Restart=on-failure + +[Install] +WantedBy=multi-user.target