hackmd: rename vars to hedgedoc and bump version to 1.8.2

This commit is contained in:
Markus 2021-05-13 16:19:43 +02:00
parent 66ee1f011e
commit 1aebd59435
9 changed files with 119 additions and 118 deletions

View File

@ -34,11 +34,11 @@ gitea_dbpass: "{{ vault_gitea_dbpass }}"
gitea_secret: "{{ vault_gitea_secret }}"
gitea_jwt_secret: "{{ vault_gitea_jwt_secret }}"
hackmd_domain: pad.binary-kitchen.de
hackmd_dbname: hackmd
hackmd_dbuser: hackmd
hackmd_dbpass: "{{ vault_hackmd_dbpass }}"
hackmd_secret: "{{ vault_hackmd_secret }}"
hedgedoc_domain: pad.binary-kitchen.de
hedgedoc_dbname: hackmd
hedgedoc_dbuser: hackmd
hedgedoc_dbpass: "{{ vault_hedgedoc_dbpass }}"
hedgedoc_secret: "{{ vault_hedgedoc_secret }}"
icinga_domain: icinga.binary.kitchen
icinga_dbname: icinga

View File

@ -1,63 +1,64 @@
$ANSIBLE_VAULT;1.1;AES256
33623262383731376234653937386664383037396361353362313834636537396336633639666536
3364666364333738623435623963643065353037386364300a326638303065303430373764386430
62336230366431303138633764356562373432646233353335336232623764633135646430313832
3337376266393632660a663664316131663332656334386434323865623665633132323164613664
65326432376532343833353137616161383465393637666137356334333231313564336233326132
63316137353437643261646332373539626532333738303333373131626261653433363838306566
61633234663534646665363233366630333830383834363266396465383231306562636561393934
39316637386233666261373463333935663765636466613766613736666536346363646538613862
61373638643264623537393665353464646165363261356536366564383835346664633133363733
61373965626238363461333861333766343561356436623234396334373763663162623963383335
65326433323562303938363137343137653536373437656565323631626637643463353238323665
30663831353464393334646232656465386439383064386362356666653165643566383334633731
64383963356363333765623965626637346539613461653262313239653464363638323636633235
31373936663563336433333032386134353739383131383631336136646163383038653135343635
35373362613331396662346632356565636365636430313236386339633037316531363739383034
39643033346530316164303237326462633661623766323062333433663661313166623332326332
63646434373936623630643165313435393439653839623061633663336666376464366136626338
33393333353331383837373661323236653530646438376165623130663634353562303733376536
30353235303536336639393236656438663837323131393261626561303135626631346462383638
32656435656134616439346134346564633238376235623861663735653434323637343734373262
32666231336432663830323038663331633964663334623030373264303561326366326539323536
36613732623937376162643132393733326439343438356135313138623366333762373536636337
31343062336332383238303434653863623032343261623638616561663130396630363136373665
32343633376433383331666237653338373563666133383537393465616439333161393534363861
62313965366161386437326563336435653730653837616162643433646563393335363266653935
34376538346532336637306330333034373434383032636231633339383036623466373637643730
32336461303566333461333865313634373137343534356130333461633165643364616137653336
35346132373839313536646230323635636437643630646535353535383838656461653838653031
30363833306664343632396135383730306365306466643534303133383365363331633936333738
62393066623563366264623234653036633337386234356634323133666665653866376664393962
61353736303933623439303834646630346439666236353530396566306433363937613638376162
32326635386332343161646430376663376131653536646539326561313234353566646633343464
63386230653762376134633933363733326637336135653365656665613339383838623363353130
30306165316136313039393231303939326233656333633133323934343833383632333535383362
36333265623834643634633239363962323139363666376434623465316534653762653066353930
62343662386431353830356638656534386262626130663466313937343732303338616330373632
35396637646133346336666666316665373938663031363566373036306561623234323633313433
65373133393166616366376536353731666262366163373037306433373138663131363232656563
36376162636662373865626166656664333732656464356232633866313739383362303836616630
30393430383539383735653130303530623134646436326633373233356334356439383566353630
61636465366261393564663331633336313261663539376363623636303030396465636238636561
66626465373238333931336231373738343430326361373634346463336538623433663564646665
64323733626536303637376662613434353039666366306662653739366335333631356433656262
37646664333339396236333464643436386663386532643934633730653434633731653463343464
61376265373135336234636238626434663263353366386532316236646433623530363662376361
37383963383730396334306433643731636365343935613061663739323361613962323039363534
36363934356364396464346132633737633833306336663336363231383935323363633930303631
37393534376233306335636239616330353164653232386536353966383433363134336366343738
31303136663934663234313533316535633165343065396262626162343335653066393438656137
62366666626462343839396364633261363835373461633362663139373335633165393336353834
35393864393831336166383365663834616234353431383535373139386138373130356136663161
38363936386366306437336164396262613635643037306665663035346364366439386366646231
62333430613031326662393236383565376132366133653232313230643037346438636635623837
62303434366461373130633137323038393933313230613163336532323031663434653334663338
63643330306535306466313861653833373437386636356261623662636266323165383064626539
63313563306135386235626666646561306163343736363733336139383537613031333538386362
32643562386635623231666134373636393736346631356339626564316236656263653633343266
65646562623836666136653962303534363335303233313262323235393539373563333530336363
65623662346366613631373430353833336362393865643366353663323363373566393139633364
37306361656661343031663736333465323534356439343266376464616534316439333761396666
63633537616162393863306332363734663765626639613638396434333531316237373737636135
6463623864656232343433396662323963366234653366656562
37623239353765633630353337643231343235623233303064653262333865643730663763633465
6461396231656335313364383239346532643962663661630a643262633934623265646166666635
35376235616335303335616139306136633736363332376462303839306632643438363332363065
6232376662313062310a343835363535383638613232333038636563393263363736343134343333
63633061626639623265626237323234636166323934396533356565333838373130353031323839
35326439353930383865326163323363393734633239623566383265613339653237613364356562
30666366656437633236353036663534356637643938376234616464346538393637393830666232
62303962376332323966373837376239343061393834636536316137643365376436353034393838
33346430353034663235333165333536303538396631663039353534323531393064663566366334
38623461643633373533326636393962333534336631653139383034653933356162366561386362
66313662653136333137633930346363386363346630636631623165346539376135326264333836
62333735343763353764346433323965646539656332353564313031653436353639363434643132
62616462623539303933343139313665353734313062313065316565303262393036643238636432
63323462613339353664663565373466633833343836646533353639636534393364353065393964
65663363646163663332646430653433636365343531336436343664396564343538373336666434
37633832386537383438666263303562643236313931373864333236383033653861663332383663
38396435663636643366626233366161643231386162636438613638363161396466666163356232
62373861633366363435366635323162613866643039386665303164303861626665363362653864
64653533626561313232666665613566666562623430323037623162626462323133663432356333
63393363336563346336643566356662336131393961643735646337336632363733333764346233
38333862343562616261373239343565336565663933383261656131323834633333363135623335
63326335323532326431313930643061303564653636663331663265653039653031626139356566
62616533373765386561393632306236393939316139333530356339373130326265616635623563
61366164626131613664633236366233316432653163336461306132353662313636653166643562
62636362626333643030323164323733613735376235303366633136333064393566613463653236
64653838653932653931353835663030623339653066616534633732333636636435313761623631
32393261646135626363363362366436366637303866623461396665393163363163373737396336
30623936653136396439313833373565663432636263383262333562613262613632343165633964
34383531653864393165393039333239376463633565333337646639636138376134653238626166
64616663643062373933323138326261353632323864643730313433373536373964663064383538
62666366383630386430383930343634623064633930383634393765633363313765343039663933
62383362356162356364373535383066326462373563306338316634393762633235323431626330
36313765353339613036613761363032636539363830353538633536653161636334303362633161
39393063633231323335663066373463303233373062616237366432303733653030663066626236
62643739346463396339363739306231363266366664393037343630366430626362656365656439
32323765666233353861613362663061313239353033336166346431346635383566383931313861
36333731346630663431643761366139356166656130383633303939643737663637346162306466
30303061383832383334366330326133383538633333383839353630303131333662303236656665
37356266333038386565343363346635653263393665623931313337383962343261636339363764
35643666373335613165626463363830666566303236396362346130303566323434303965366164
65353531333134646366343538623434353662393439336362353366303534616233346633363130
31393131643863303537376166343534356436313235353532646137623664376638666334363731
31323033616663613839336661333237323231623830303531343438633739326435613535366433
33306364366433383939343931393838633866363761346361663538383533653235383233393737
38663037663263383732646131356461323861393961663965336437333139363066356564373837
65373835356164643163633331343437366533316565663330313631376138343538366233663934
64373862643934663332323532663266653932366633303038353639663466306661663333646232
39613630613736306362616238653533313830326661656433373731653165616637636661393138
39623036366465346362616639633232656136656535306334646361353937663335613039303738
61613262643637633033353564326633613364353637616535313439636535353632393265313964
64626535626230373361353937323362363636353466656237613862366261626166633530383862
63366561313637386362653636333537383539326661383232613961313534386633626133363438
30343634666336316539333261653065626562613865636335383564393664333962343334663339
66383232333837323461336462333535626434383731383331613030363131366230396264363964
34646232366337356265393235623565306562323337663438383239353837393437643635633164
34376465343837633233313065653031383563356537366439306633306361613830616165633932
31663361363032353261373163666138643536353335656438356165616235313563393733396238
37343534353739366163646237303737373738623761623038313962373739353638646564396439
39346663643861653030373334363836346336643764373261393436313564343930376137396130
62356335363636333866393935316139376363623234646533363665613862366630653963613466
31376435323165653964383266323463396361383533666261346166663036656536653361666133
32376334613533353362383938643639633366636134353038643564633062663934643765613262
356330333364636633373065346138313131

View File

@ -1,4 +1,4 @@
---
hackmd_version: 1.8.1
hackmd_archive: https://github.com/hedgedoc/hedgedoc/archive/{{ hackmd_version }}.tar.gz
hedgedoc_version: 1.8.2
hedgedoc_archive: https://github.com/hedgedoc/hedgedoc/archive/{{ hedgedoc_version }}.tar.gz

View File

@ -3,8 +3,8 @@
- name: Reload systemd
systemd: daemon_reload=yes
- name: Restart hackmd
service: name=hackmd state=restarted
- name: Restart hedgedoc
service: name=hedgedoc state=restarted
- name: Restart nginx
service: name=nginx state=restarted

View File

@ -37,72 +37,72 @@
- python-psycopg2
- yarn
- name: Unpack hackmd
unarchive: src={{ hackmd_archive }} dest=/opt owner=hackmd group=hackmd remote_src=yes creates=/opt/hedgedoc-{{ hackmd_version }}
register: hackmd_unarchive
- name: Unpack hedgedoc
unarchive: src={{ hedgedoc_archive }} dest=/opt owner=hackmd group=hackmd remote_src=yes creates=/opt/hedgedoc-{{ hedgedoc_version }}
register: hedgedoc_unarchive
- name: Create hackmd upload path
- name: Create hedgedoc upload path
file: path=/opt/hedgedoc/uploads state=directory recurse=yes owner=hackmd group=hackmd
- name: Remove old hackmd upload path
file: path=/opt/hedgedoc-{{ hackmd_version }}/public/uploads state=absent force=yes
- name: Remove old hedgedoc upload path
file: path=/opt/hedgedoc-{{ hedgedoc_version }}/public/uploads state=absent force=yes
- name: Link hackmd upload path
file: path=/opt/hedgedoc-{{ hackmd_version }}/public/uploads src=/opt/hedgedoc/uploads state=link owner=hackmd group=hackmd
- name: Link hedgedoc upload path
file: path=/opt/hedgedoc-{{ hedgedoc_version }}/public/uploads src=/opt/hedgedoc/uploads state=link owner=hackmd group=hackmd
- name: Setup hackmd
command: bin/setup chdir=/opt/hedgedoc-{{ hackmd_version }} creates=/opt/hedgedoc-{{ hackmd_version }}/config.json
- name: Setup hedgedoc
command: bin/setup chdir=/opt/hedgedoc-{{ hedgedoc_version }} creates=/opt/hedgedoc-{{ hedgedoc_version }}/config.json
become: true
become_user: hackmd
- name: Configure hackmd
template: src=config.json.j2 dest=/opt/hedgedoc-{{ hackmd_version }}/config.json owner=hackmd
register: hackmd_config
notify: Restart hackmd
- name: Configure hedgedoc
template: src=config.json.j2 dest=/opt/hedgedoc-{{ hedgedoc_version }}/config.json owner=hackmd
register: hedgedoc_config
notify: Restart hedgedoc
- name: Install hackmd frontend deps
command: /usr/bin/yarn install chdir=/opt/hedgedoc-{{ hackmd_version }}
- name: Install hedgedoc frontend deps
command: /usr/bin/yarn install chdir=/opt/hedgedoc-{{ hedgedoc_version }}
become: true
become_user: hackmd
when: hackmd_unarchive.changed or hackmd_config.changed
when: hedgedoc_unarchive.changed or hedgedoc_config.changed
- name: Build hackmd frontend
command: /usr/bin/yarn build chdir=/opt/hedgedoc-{{ hackmd_version }}
- name: Build hedgedoc frontend
command: /usr/bin/yarn build chdir=/opt/hedgedoc-{{ hedgedoc_version }}
become: true
become_user: hackmd
when: hackmd_unarchive.changed or hackmd_config.changed
when: hedgedoc_unarchive.changed or hedgedoc_config.changed
- name: Configure PostgreSQL database
postgresql_db: name={{ hackmd_dbname }}
postgresql_db: name={{ hedgedoc_dbname }}
become: true
become_user: postgres
- name: Configure PostgreSQL user
postgresql_user: db={{ hackmd_dbname }} name={{ hackmd_dbuser }} password={{ hackmd_dbpass }} priv=ALL state=present
postgresql_user: db={{ hedgedoc_dbname }} name={{ hedgedoc_dbuser }} password={{ hedgedoc_dbpass }} priv=ALL state=present
become: true
become_user: postgres
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ hackmd_domain }}.key -out /etc/nginx/ssl/{{ hackmd_domain }}.crt -days 730 -subj "/CN={{ hackmd_domain }}" creates=/etc/nginx/ssl/{{ hackmd_domain }}.crt
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ hedgedoc_domain }}.key -out /etc/nginx/ssl/{{ hedgedoc_domain }}.crt -days 730 -subj "/CN={{ hedgedoc_domain }}" creates=/etc/nginx/ssl/{{ hedgedoc_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager for hackmd
template: src=certs.j2 dest=/etc/acertmgr/{{ hackmd_domain }}.conf
- name: Configure certificate manager for hedgedoc
template: src=certs.j2 dest=/etc/acertmgr/{{ hedgedoc_domain }}.conf
notify: Run acertmgr
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/hackmd
template: src=vhost.j2 dest=/etc/nginx/sites-available/hedgedoc
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/hackmd dest=/etc/nginx/sites-enabled/hackmd state=link
file: src=/etc/nginx/sites-available/hedgedoc dest=/etc/nginx/sites-enabled/hedgedoc state=link
notify: Restart nginx
- name: Systemd unit for hackmd
template: src=hackmd.service.j2 dest=/etc/systemd/system/hackmd.service
- name: Systemd unit for hedgedoc
template: src=hedgedoc.service.j2 dest=/etc/systemd/system/hedgedoc.service
notify:
- Reload systemd
- Restart hackmd
- Restart hedgedoc
- name: Start the hackmd service
service: name=hackmd state=started enabled=yes
- name: Start the hedgedoc service
service: name=hedgedoc state=started enabled=yes

View File

@ -1,13 +1,13 @@
---
{{ hackmd_domain }}:
- path: /etc/nginx/ssl/{{ hackmd_domain }}.key
{{ hedgedoc_domain }}:
- path: /etc/nginx/ssl/{{ hedgedoc_domain }}.key
user: root
group: root
perm: '400'
format: key
action: '/usr/sbin/service nginx restart'
- path: /etc/nginx/ssl/{{ hackmd_domain }}.crt
- path: /etc/nginx/ssl/{{ hedgedoc_domain }}.crt
user: root
group: root
perm: '400'

View File

@ -1,11 +1,11 @@
{
"production": {
"domain": "{{ hackmd_domain }}",
"domain": "{{ hedgedoc_domain }}",
"protocolUseSSL": true,
"allowAnonymous": false,
"allowAnonymousEdits": true,
"allowFreeURL": true,
"sessionSecret": "{{ hackmd_secret }}",
"sessionSecret": "{{ hedgedoc_secret }}",
"hsts": {
"enable": true,
"maxAgeSeconds": 2592000,
@ -22,9 +22,9 @@
"addGoogleAnalytics": true
},
"db": {
"username": "{{ hackmd_dbuser }}",
"password": "{{ hackmd_dbpass }}",
"database": "{{ hackmd_dbname }}",
"username": "{{ hedgedoc_dbuser }}",
"password": "{{ hedgedoc_dbpass }}",
"database": "{{ hedgedoc_dbname }}",
"host": "localhost",
"port": "5432",
"dialect": "postgres"

View File

@ -1,10 +1,10 @@
[Unit]
Description=HackMD
Description=HedgeDoc
After=network.target
[Service]
Environment=NODE_ENV=production
WorkingDirectory=/opt/hedgedoc-{{ hackmd_version }}
WorkingDirectory=/opt/hedgedoc-{{ hedgedoc_version }}
Type=simple
User=hackmd
ExecStart=/usr/bin/yarn start

View File

@ -7,7 +7,7 @@ server {
listen 80;
listen [::]:80;
server_name {{ hackmd_domain }};
server_name {{ hedgedoc_domain }};
location /.well-known/acme-challenge {
default_type "text/plain";
@ -15,7 +15,7 @@ server {
}
location / {
return 301 https://{{ hackmd_domain }}$request_uri;
return 301 https://{{ hedgedoc_domain }}$request_uri;
}
}
@ -23,10 +23,10 @@ server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ hackmd_domain }};
server_name {{ hedgedoc_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ hackmd_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ hackmd_domain }}.crt;
ssl_certificate_key /etc/nginx/ssl/{{ hedgedoc_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ hedgedoc_domain }}.crt;
# set max upload size
client_max_body_size 8M;