Alexis Hernandez
6 years ago
9 changed files with 318 additions and 0 deletions
@ -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 config |
|||
become: yes |
|||
copy: |
|||
src: config/bitcoin-backend.env |
|||
dest: /home/play/app/.env |
|||
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 sentry config |
|||
become: yes |
|||
copy: |
|||
src: config/sentry-bitcoin.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/bitcoin-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: bitcoin-backend |
|||
state: restarted |
|||
|
|||
- name: Enable the application to run on system startup |
|||
become: yes |
|||
systemd: |
|||
name: bitcoin-backend |
|||
enabled: yes |
@ -0,0 +1,120 @@ |
|||
--- |
|||
- hosts: bitcoind |
|||
gather_facts: no |
|||
roles: |
|||
- ubuntu-16-04 |
|||
|
|||
vars: |
|||
- x_user: bitcoin |
|||
- x_group: bitcoin |
|||
- x_home: /home/bitcoin |
|||
- x_config_dir: /home/bitcoin/.bitcoin |
|||
- x_download_url: https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz |
|||
- x_download_dest: /home/ubuntu/bitcoin.tar.gz |
|||
- x_download_checksum: sha1:546ee35d4089c7ccc040a01cdff3362599b8bc53 |
|||
- x_unarchive_dest: /home/bitcoin/app |
|||
|
|||
tasks: |
|||
- name: Create the bitcoin group |
|||
become: yes |
|||
group: |
|||
name={{ x_group }} |
|||
state=present |
|||
|
|||
- name: Create the bitcoin 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 bitcoind |
|||
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 }}/bitcoin-0.17.1/bin/bitcoind {{ x_unarchive_dest }} |
|||
|
|||
- name: Set the application as executable |
|||
become: yes |
|||
file: |
|||
path: "{{ x_unarchive_dest }}/bitcoind" |
|||
mode: "u=rwx" |
|||
|
|||
- name: Set the application config |
|||
become: yes |
|||
copy: |
|||
src=config/bitcoin.conf |
|||
dest={{ x_config_dir }}/bitcoin.conf |
|||
owner={{ x_user }} |
|||
group={{ x_group }} |
|||
|
|||
- name: Set the application files permissions |
|||
become: yes |
|||
file: |
|||
dest={{ x_config_dir }} |
|||
owner={{ x_user }} |
|||
group={{ x_group }} |
|||
recurse=yes |
|||
|
|||
- name: Set the application files permissions |
|||
become: yes |
|||
file: |
|||
dest={{ x_unarchive_dest }} |
|||
owner={{ x_user }} |
|||
group={{ x_group }} |
|||
recurse=yes |
|||
|
|||
- name: Add the systemd service |
|||
become: yes |
|||
copy: |
|||
src: systemd-services/bitcoin-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: bitcoin-rpc |
|||
state: restarted |
|||
|
|||
- name: Enable the application to run on system startup |
|||
become: yes |
|||
systemd: |
|||
name: bitcoin-rpc |
|||
enabled: yes |
@ -0,0 +1,33 @@ |
|||
$ANSIBLE_VAULT;1.1;AES256 |
|||
66656364376563393138616665336465313966343061656238386537366437663033323931323434 |
|||
6133633432333231333835643964363738333435363863340a643239613634643037373335373130 |
|||
36326362373839616330653738303134396439636239353533356536343734353531623962626339 |
|||
3330356335313361360a663561363435333637663436646135323666323466303832623135353934 |
|||
62396330323234656637343134653963373030336235343738623664663134623832316661333037 |
|||
33636137356134663366623639376230656436383534623335656637626265613865393532373238 |
|||
39346363306337366636393136613961343963383639346563366631306261393735303764613232 |
|||
65366663373034303837643566323936613263376138666533346164616534343261613461313133 |
|||
36656333343062663661393735633232663162663834363632353835623463336431363832396338 |
|||
65343065333834376635363762393038316462346435373763373563646433316132353562666236 |
|||
64396235633866626537323430626533343464656438376332393561373365646134363539386435 |
|||
39663961386165303666356435346362366334323962363664633839643832306535616337366662 |
|||
36366533636538386238393361313632376235633230343065633531383433653663666230663132 |
|||
39646434343733313834666131383638336362623339656566616361396131643232616633393866 |
|||
63623766336332383763303462393931373833303861663235653238353639336236316134333366 |
|||
31643166656635346664376233363266623061373539376331326130623762363266646632666264 |
|||
38613935613564656130313337303637656332363562363534326463323765383563313634363131 |
|||
37343339363737643939653763366566386631666464326131643638313766386632336664313162 |
|||
37656632613637393063616164653031643934613234393832363862363764316530663033323136 |
|||
39336366656531316166636166303865313436636664623239343138386234326638313232353263 |
|||
32613532386431326638396533343265626330383235376363623534303465623161343230636535 |
|||
66306362663435636464323430393730663036363864343834626464636635636164363662626333 |
|||
63303433393932636336653064333937613433303763333134623965656138623530626132383233 |
|||
61656533323738313935643634393233666565643762363566646261353638393761623765623430 |
|||
35353830336263343364653261383861333461313164363936316134313233613736653665383933 |
|||
37303630613332396663663838313239323039633030363439343631303038656535396535646365 |
|||
64646431646137666330356337656535663737643964616661386234316132333930643863303837 |
|||
63313239663138313332383730343439316537616332646435616131373830616463376234396239 |
|||
61343633323639393764333339626663363435336365663565363535643165393639623564316335 |
|||
61663238356537333065373661356335653035323964313935333636646330646631366234396534 |
|||
31623862353633303963616337306364383165323165343562663032393366643463313965616564 |
|||
31366630313833633630 |
@ -0,0 +1,14 @@ |
|||
$ANSIBLE_VAULT;1.1;AES256 |
|||
37376630346661363663626239636365653765653338613864366139373961363236396166366237 |
|||
6434326365356432333131643731663332333964306339310a343830633831616433316339653037 |
|||
63343136656132323963333436306230663266323035383637666463343162373436363839336631 |
|||
6234393930353930630a333934613539353861613736616439336530653037623464653133616137 |
|||
32333163666435326637636331313032386534653566396463393966313838346462333761346138 |
|||
34653233343435333736666539303763643038663436383466316631633363363838393562373835 |
|||
39666232613166383838663239363865663234396538366131343032396462646237653639356336 |
|||
32373166633461306563323331363964326338376265353230623238386233366335663064313162 |
|||
35303663333131383034393362613233656133333565316335373562333437646639323335616464 |
|||
61316131373138303361666265376264653463393566363134663636656566613066643033666236 |
|||
61666362356633616135366236623963313234663766636235623135333139646665383331346163 |
|||
66666134636634633566653561363231646137376263663161393062646631343332396165323161 |
|||
6635 |
@ -0,0 +1,2 @@ |
|||
stacktrace.app.packages=com.xsn,com.alexitc |
|||
servername=bitcoin |
@ -0,0 +1,8 @@ |
|||
[server] |
|||
bitcoin-explorer |
|||
|
|||
[bitcoind] |
|||
bitcoind |
|||
|
|||
[postgres] |
|||
bitcoin-explorer |
@ -0,0 +1,16 @@ |
|||
[Unit] |
|||
Description=BTC 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 |
@ -0,0 +1,16 @@ |
|||
[Unit] |
|||
Description=BTC RPC Server |
|||
|
|||
[Service] |
|||
Type=simple |
|||
WorkingDirectory=/home/bitcoin/ |
|||
StandardOutput=tty |
|||
StandardError=tty |
|||
User=bitcoin |
|||
LimitNOFILE=65535 |
|||
ExecStart=/home/bitcoin/app/bitcoind |
|||
|
|||
Restart=on-failure |
|||
|
|||
[Install] |
|||
WantedBy=multi-user.target |
Loading…
Reference in new issue