From dcf8fe8087fff8439c3d0104a7446778ebb5c3c9 Mon Sep 17 00:00:00 2001 From: Jesper Hess Nielsen Date: Wed, 13 Feb 2019 21:16:36 +0100 Subject: [PATCH 1/2] Add codimd service. LDAP isn't working just yet --- group_vars/all/secrets.yml | 86 ++++++++++++++------------ playbook.yml | 1 + roles/docker/defaults/main.yml | 6 +- roles/docker/tasks/services/codimd.yml | 56 +++++++++++++++++ 4 files changed, 107 insertions(+), 42 deletions(-) create mode 100644 roles/docker/tasks/services/codimd.yml diff --git a/group_vars/all/secrets.yml b/group_vars/all/secrets.yml index 9b1720c..a2385c5 100644 --- a/group_vars/all/secrets.yml +++ b/group_vars/all/secrets.yml @@ -1,42 +1,46 @@ $ANSIBLE_VAULT;1.1;AES256 -37383765663034396532346138346339646138613131363332623831383766646534356133626630 -3766346661383236336433633762626538343266323866340a353333616330656132376163373061 -37323833396431663630346331363662373734353263386238306138313938356235303839363734 -3738376564616239370a666635653063356565306431333963626439303630633834663737323036 -64373165616565316534653738353362653339336237373966623635666438363764633938653331 -30313534613864346136383635356666663635396162326334393963306530336130383238326337 -64313162633835306132316431303436623135303165366165306363643838363964623862393334 -36303036636534646438353336626365373036646233356262373436383230366464393561396166 -31306130313434666661633166383435303730613637386366663539363432656362336663633730 -39386530326661383664353563336130313330633237396561356637623331653862336133316133 -31366533646464336434313131353031656634653638383965336563303465373038376131393863 -38393039663631343066396132356362333032633462396433303430656264636435323638363663 -33326364323866346231653164356631303536393664643963613734336163373331663061623263 -32383137373763613465393037383135636633386565646139363034373237323032613066363535 -66366138663636633465346239326232336432353666323532656366353763616565333931353736 -63346662633165346334383933313231643934386232653038643937656464306365386261326539 -64313965663164366138326139626237353835313230393733663133393330323261353537626331 -36383733326162383431363861653137393063393336363437393936613237613761346134336233 -61343539383435396565613066363730376637616538383431363962656237326661383433303662 -39613234393230666434323233663066646430393564313261336436336433613562363066646630 -62653733613832386366306537656164336132323333376634346330643730333736323461343333 -65396264666265386230616438643135633765303164613135626330313261363865363466613863 -35336161316266666263336364343437343864623636326566663063313964386561656335393230 -31336334363230383261653432353430633531306631363362346534653966653738623039633463 -38333665323961616533326437356238393265373436356162313433643164326435386235343232 -61343564643233343234366165623066656431333936383132323930616662366238343233393466 -34643232306331633063353266326232323263663531386464313566383438353131643034643535 -30383664646238383838386263643466333537316136313666353132663766373765393633353361 -35646630373866386235383632356266633530633737363532363235616637653932313434363138 -35366631376439386239396135636463306661643438643431316134663338656330333732613464 -31336164626235323863386235343930343963356136373733666639393263343630623932646338 -62333039663237333731316135643735393932373731663066666239353338376538376162306138 -65313733303262663634343832643566343331396266363163653335363262343861613439663734 -39393631336135303338366230373961373865316338356133613738613366613336643436383238 -65656431636536393830393862623263356532613461353863613230336238346664343132623737 -32313037363365656263663237663736623762316566356139646535363836633366356438333062 -34376162343061343064383935313463656634333564666261616661653866343062383061303661 -39326164306564366662656630323164363533323865393237616265623131343039353864656332 -63623863663134393266323532386366643961306561373934313832613362643534323630363033 -30353433643234316533636330643538643463646164333362633535383865656663396539653131 -65633164363633666266623139666437616530343130336236633137303334303261 +30643964633738353062356235363564666438643964363861626362376232393632633865643432 +6334636639326630316531636138633165306461643336630a623832356137663233333030333031 +33383865313439623337333662653563303065303233373261303635373838353039303231386337 +3339336362393237640a336166343730656337616135663530623764633631393635343233313163 +31633335356633343666396363323064376561643938373065656230396331316163316237353032 +32303962366338646239363336316639646534323561653132616632613737643063643264633033 +61386134366165303736373736393532343236656230353533383035623330336464326536383739 +34616633633539316364363832346665623330333765363363323032303065396566333936366532 +35363966303066373632323330343738656139323961613431393031366162653761613231666236 +39616361636365653330623562613331363239356461316332653838623866663264376262386461 +39383332393665336365303566646234643437386233323163626539303937356230616430616137 +36643435396536363261623764663038626131333364386433666466356265643662653964666564 +39303864636664623839656130663739346131306634306638333361643061303730346262366361 +34643330303137373065373863386233386632636238376538303631393233333334303532393037 +34613034336633383866353063333563663035323435343866313335373061623732643236306534 +61343431646232396362633733643362366262326334313737336164323166363333643235383432 +32633530333031363634396336366165383064306161316233396435303461653736653235626632 +32313661643537376566396561346366366332303034613135666231323935386639623439353034 +36373934386464326631666663653165396561623034643736656239356639313564613363393962 +37376462623663623433653737646538666330373264633663353831363936356331336362333562 +62326235373331376238316165336166336464306636386536636236353534663935623561336130 +34633437306539626635356133383032623839343238313736313462323637363630626664626639 +63346531333764366266386564656532633035366661626266313861666263643038333762313762 +36303036666236636661316530313865373239643964323831346535303338326334356665326538 +32326530653364393864653636313734336533323063316363326134393737663765323138613539 +63396631626435616239306634373965666461666366393033363936303331613131613934393636 +61616138376665646137663938306637623461306230633431613036656462623131333331393032 +61333933386166356536346133396535383064626161343832633034386365626137373566353065 +39383037373239396163383330386363366434386537636430653865616561323833373239623863 +30633034353466626265623065326333376336386361653064303535363736653338333632343662 +33663332636263393963633562373763653132646361383263316262663663343262643131383337 +32666362313536313765663139356266643861396136353831383561653435353237663633613365 +64636136663632613337666639363861663731306330653433326264646237653235633332393863 +62316536303836353931643338626561656633383561373738623163383262323266643461313236 +64363531643433346635343132353037653234636437326461303465623532376532616430306639 +32636639636365313162663437363235636132663630396338616134316230336464666233643334 +65626333626538633039626666666663333866303936363365663437396663643032633065363239 +66376235373363393439323866616438343365366366633630623139663534646636633833393533 +36373961633162323236616630656165636666303135623331356335383331353532666665366531 +36626435303535653439613564353436343931666533353430336130363038336531373530303036 +34356130633666623733663937343463613861313533623338316538313930663738323032386266 +65306262373932396264366634646639396632363561663164666539643132303066346432323234 +66623166306565353937323265363265666663633234323137303934343937626165616131396362 +39336438323233643830663366636537396538623635666137306230316434383264383534383033 +31393839323336356465363563326539366364343962626666303963646261353965 diff --git a/playbook.yml b/playbook.yml index 7a044cf..903a0bb 100644 --- a/playbook.yml +++ b/playbook.yml @@ -18,6 +18,7 @@ - postfix - matrix_riot - privatebin + - codimd smtp_host: postfix smtp_port: 587 diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 0c58763..b07c471 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -27,4 +27,8 @@ riot: privatebin: domain: "paste.{{ base_domain }}" - volume_folder: "{{ volume_root_folder}}/privatebin" + volume_folder: "{{ volume_root_folder }}/privatebin" + +codimd: + domain: "pad.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/codimd" \ No newline at end of file diff --git a/roles/docker/tasks/services/codimd.yml b/roles/docker/tasks/services/codimd.yml new file mode 100644 index 0000000..b00f051 --- /dev/null +++ b/roles/docker/tasks/services/codimd.yml @@ -0,0 +1,56 @@ +--- + +- name: codimd network + docker_network: + name: codimd + +- name: create codimd volume folders + file: + name: "{{ codimd.volume_folder }}/{{ volume }}" + state: directory + loop: + - "db" + - "codimd/uploads" + + loop_control: + loop_var: volume + +- name: codimd database container + docker_container: + name: codimd_db + image: postgres:10 + state: started + restart_policy: unless-stopped + networks: + - name: codimd + volumes: + - "{{ codimd.volume_folder }}/db:/var/lib/postgresql/data" + env: + POSTGRES_USER: "codimd" + POSTGRES_PASSWORD: "{{ postgres_passwords.codimd }}" + +- name: codimd app container + docker_container: + name: codimd_app + image: hackmdio/hackmd:1.2.1 + restart_policy: unless-stopped + networks: + - name: codimd + - name: ldap + - name: external_services + volumes: + - "{{ codimd.volume_folder }}/codimd/uploads:/codimd/public/uploads" + + env: + CMD_DB_URL: "postgres://codimd:{{ postgres_passwords.codimd }}@codimd_db:5432/codimd" + CMD_ALLOW_EMAIL_REGISTER: False + CMD_IMAGE_UPLOAD_TYPE: "filesystem" + CMD_EMAIL: False + CMD_LDAP_URL: "ldap://openldap" + CMD_LDAP_BINDDOMAIN: "cn=admin,dc=data,dc=coop" + CMD_LDAP_BINDCREDENTIALS: "{{ ldap_admin_password }}" + CMD_LDAP_SEARCHBASE: "dc=data,dc=coop" + CMD_LDAP_SEARCHFILTER: "&(|(objectclass=inetOrgPerson))(|(uid='{{'username'}}''))" + VIRTUAL_HOST: "{{ codimd.domain }}" + LETSENCRYPT_HOST: "{{ codimd.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" -- 2.43.4 From 3a2ac5cb6b00559702d840dde01951a8efc2e360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Thu, 14 Feb 2019 22:52:55 +0100 Subject: [PATCH 2/2] Getting codimd to work. --- roles/docker/tasks/services/codimd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/docker/tasks/services/codimd.yml b/roles/docker/tasks/services/codimd.yml index b00f051..94c8082 100644 --- a/roles/docker/tasks/services/codimd.yml +++ b/roles/docker/tasks/services/codimd.yml @@ -47,10 +47,10 @@ CMD_IMAGE_UPLOAD_TYPE: "filesystem" CMD_EMAIL: False CMD_LDAP_URL: "ldap://openldap" - CMD_LDAP_BINDDOMAIN: "cn=admin,dc=data,dc=coop" + CMD_LDAP_BINDDN: "cn=admin,dc=data,dc=coop" CMD_LDAP_BINDCREDENTIALS: "{{ ldap_admin_password }}" CMD_LDAP_SEARCHBASE: "dc=data,dc=coop" - CMD_LDAP_SEARCHFILTER: "&(|(objectclass=inetOrgPerson))(|(uid='{{'username'}}''))" + CMD_LDAP_SEARCHFILTER: "(&(uid={{ '{{username}}' }})(objectClass=inetOrgPerson))" VIRTUAL_HOST: "{{ codimd.domain }}" LETSENCRYPT_HOST: "{{ codimd.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" -- 2.43.4