change directory structure
This commit is contained in:
parent
b89713643d
commit
9eb52229f1
83 changed files with 0 additions and 0 deletions
126
ansible/roles/mastodon/files/.env.production
Normal file
126
ansible/roles/mastodon/files/.env.production
Normal file
|
@ -0,0 +1,126 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
33623964663363323234633464633463323862636234306262386163306633613537303434663137
|
||||
6234333035336362613132333830373865656531643062660a313234363335303635323261643063
|
||||
35633830616433306265616332616139656438303736363436396434626366393666666665343366
|
||||
3830326265393663640a313535353661653266616634643334623034626630376536313063633731
|
||||
66306333393064623939643330323639393134653761386131343738636235623364316139633536
|
||||
32306532663766663362623238386134663864393964353332366634613262346566303465343038
|
||||
66333836666236306139366138393136366566626636646335393336313439613335303935346638
|
||||
61623230663334353835376330366531343331663732613065333938613436343132326338643964
|
||||
62343665333163326631626231336535343363306631363464383039366563366537356637303065
|
||||
39393265393736326433656361646631363334356338316231343265663438623364613531646533
|
||||
62616133333731643761623133343435623836343662663132643430376636336531626539643563
|
||||
61323836633839353333313338666137646664663539383266386537623962373563326161373131
|
||||
36653337353563383065626564326666373836363830336263653535353361363761386530653033
|
||||
39656136313838303062366637346362346333353461356432306562336432353263303938326532
|
||||
62323437376334336332373131653461373164306533383865646262326163393337633366643832
|
||||
33326232353934323733613039393966366434336665623366386466303062633265396238663533
|
||||
35343335393766386563386538663133313763613736313330353963353936346236653663616363
|
||||
33373261626265633436353630333237326537393135636164306165616531613236333362303937
|
||||
32373331316466363965616339656235663436353165303432626636633335633431663231336463
|
||||
38336634636466373638666336373735356134383639323939333233343566616564366661393264
|
||||
39633664316134643637613133393466626134306437306431666365346238313261346661363361
|
||||
65333138333732626339363539363765373036356266366634613566393939636562616261316662
|
||||
65396532373037313761303136663365363138396633623430323038306236363362623564636333
|
||||
65343862356139343363343039666363386565396164353631656265356635373836313538373832
|
||||
38353537323830663362633635326132633632646234396238323338363632663661643237636562
|
||||
31336237353863333365313361646638643839393138346634623136373761323130333731343230
|
||||
61393662343631373332383566386333333662363661336433326634396561386632373965326138
|
||||
32643861333035316362313935393934636632616664653037356462303664333839633865343661
|
||||
65623961353038663330333539636335393030316562363935373430653233646533323363653932
|
||||
39303139323738313939633161653332323935366432383261306164666564626330633439643065
|
||||
62656464393466376162373666396439633464313662613238373163646234326465303332393431
|
||||
30363863313034626330636564616639376431623365323464316139326438336662653939633664
|
||||
37653930616433633266333265623938323638353533663932666432383866663362366530353837
|
||||
66643162616531623130663564343762363663353135633231666530663930393436316232343132
|
||||
66323130383935643232346535633830303266613232613232353561323839386235646231383130
|
||||
39323638663531306639373233376362336136396261306631646264663832383761373331323331
|
||||
35633466333063653136313433326164366666396237613465623237656162633731613037376333
|
||||
32616631386434663435343562633930623431666635623830626466343038333032383937336233
|
||||
37353536303262626562343030663934343638646638356333396263383135343634366232316431
|
||||
34363464386333656333643333666164633537323839313363663536623733373235616237646436
|
||||
31356533393332646463313932636238383161613264303439396464616633303430373938333664
|
||||
39306337353732306466633230333463613166636662326539393137643939656232663237613933
|
||||
65636638396138616339656434633237383237633431636365396236343165346661363330306433
|
||||
32653237333830663663333961336639613632373633366131666136616237623335373334363231
|
||||
34353039313431626266396134643434326366663638336363363430663065306432353130353662
|
||||
63313637333639383038386535646330663234343462646264316634336230343831663736383634
|
||||
64646430643337316432333639616431316130383564343466306365636234613964633538313336
|
||||
30323539396232386434656133633864313332373064306462353630393236303431336666353238
|
||||
30363638653137353165653537636166303238626237643334376432653732393930623638303363
|
||||
35383939353365303663356337653135353363383233393635303532323136663038623132646566
|
||||
34666463383361616661666133653230643166366631306339636339303561363438613264386662
|
||||
61303033323631373062303833326434633031363035366633323036313761646639326262333761
|
||||
62333834383664616163663039326465653365383063303939323438313134366265653564383539
|
||||
33646433353835353736343966363663366430323462363138626334656334316238633936336130
|
||||
66636437386363316365306637346537323263613133313239653633323039363463356666303035
|
||||
35333833326631623438383063393263363163363036333537313237356262326465373937363831
|
||||
30363462303231303931626138326661323561666436353865643961663737393332376665386337
|
||||
30666131623566336436373863366634316162393831366635353832323034356634653533366163
|
||||
61343461643633343261343536636131363262653361326661353636626131393766653463336439
|
||||
36313036376336633338346265383637383333653161383230633733313862643932383030633566
|
||||
64363164636264643365366630333439653466356339373237653636393361386565636433356136
|
||||
38656338313636663739343130363166333061653130303432353238633362366265663664356561
|
||||
36353332643738656231313037653135303233396632363338643666313039353431623233626336
|
||||
64363962323466363230303633633663343463333461303534346264346632353133313561323435
|
||||
61336634393262386339636232316365363338656633633064333331636163313432633337373434
|
||||
33393762393932656137383232616136396238613163323638323437633239656562396164383839
|
||||
66343064363663363938333631643661616536646130346136373930363635656131316334316430
|
||||
37613337366239633862326461663034383430373062366332663534653439306231636263353832
|
||||
38363262333365343539643331396633363361663239303064663163373837333164386430313333
|
||||
35653234366363306630303262663437346330353762633534616231633537326330623237393938
|
||||
63393531613431663663613164373636323766363430623761336533343238633136623866383432
|
||||
62363238636532646638656336313130626534326634663031636165636162313630383933306266
|
||||
61356533633661663364336261616363666436313532303736333836343466353165396163656561
|
||||
36643265653061356130393535646563633330366466343165336639633261306639393163313539
|
||||
37346236396130653462313333373738356366333832623337386538623639623432656338306339
|
||||
37363161663639656464373862386662656563316333623531323035383130396134313866663039
|
||||
65346561636235623761646436646261383936396263333235386134363466326331373166356361
|
||||
62383132323563303036653135633439366533323966616533616237313736306164653235303335
|
||||
65623763613662316132323064663264383133633361383833633766326333613265616530656638
|
||||
64323162336163613865623162336533396432336163313435623932323136653937653333323436
|
||||
33386637623730633037323838316430666331396230326439363032303336396336656139623564
|
||||
63326363393432313434653762623062656539333261633663396664656562333761383337393462
|
||||
37373361633732663131666231633366316238396233666339313263323933336362613062613463
|
||||
34383238323663636332663961656130336263333138303438623664376433656137363536376532
|
||||
39636663383365346335613635303238343633643531323931643236303662613065363836366162
|
||||
30613438316332333962383763613061636134313338626530373966373263663765626334303161
|
||||
62613966393434336437346132316239323934393532313637363531343637313962323435653437
|
||||
65303863333164383363386266386333363439666666616331393561373630613739643666313538
|
||||
33383434366364373334623237323766316362383663326633633737323336396462316361633563
|
||||
66646364666539333961303832303234373533663037666265626335343231393235386430633837
|
||||
36316432383936306535383235636233326439363533343461306431373139393361623935376331
|
||||
34613130633237363536366431323632346238356564633331326463636661353830663433636536
|
||||
34373339646265343437386430653436353662636235656632353039663634316131646330373636
|
||||
65346531373830343937333163613565663631326534653838346633383963626139343865356662
|
||||
36623331666330316330376637666536636538303739366237383830323534303335643866373336
|
||||
34363833636665616537313734366631633536306639313438633930333764643938376562326439
|
||||
62393561336161343461623761353230636230666233386363393566366662393966636638653730
|
||||
39646561366432363338383363383934633963626434613466326439643235653136383463653630
|
||||
33303738636139386331336639363337393936363338643438633233373732376339353566323264
|
||||
39343336383336303430323338393064323730656235343861363236336432376365396334366466
|
||||
61306362376261396133303237663561353066636462653634393839643966346134363431646636
|
||||
38396461666261343238383631623666636661393565373962323537623263313731353939313237
|
||||
34376638666531356537316437343834306530623538336666303132336236306533373238383330
|
||||
32303036336134663631336232393833613265373137373161336461643630396431326562383935
|
||||
39316631316263396263336661333237386536306438633435313565343362393035613464343132
|
||||
32303032666339666164393762343534633065616235303161666137653065646466363732653137
|
||||
62643536616636366233323864313230636366356162356462313931363030353630343737326137
|
||||
61313765636336613731363035626631633661383562623565383363643364393932326366393638
|
||||
33323135376461313362373937656435626633663166386636623335636130396562363833336431
|
||||
31656136316537633765616261333837646231646162323938333531353665613530626137623063
|
||||
62386561316135663933303531306630623736626465623630313265353630396166343331383333
|
||||
37623430653638636166623637643762376432323764616235323533386334656262343339323134
|
||||
30373539336436336635633265623130656336373661636265336530303335383965363732386236
|
||||
30353935393539313165653432343463353236323338366338346234306364303137663864653737
|
||||
65626533393262633131623965363332396430343637323939323935306531343561313334373232
|
||||
30366236633433396439653866666438343261396239323465623034363531643261323234353365
|
||||
61336330643932303566346332393630356232636463353833313264396535346266663933396162
|
||||
35636166616631373666613364633033323764613930663763346333633038333032386237343539
|
||||
31323835616338376464363764623637323430656431343864663034666436633537663362306262
|
||||
61613064376637323164643964626261346131303931343866373866373861663933626264343032
|
||||
36616437333561376165343364623835636431646131623661316438386239386635336661356164
|
||||
39613164376233616633303364303439376562363932366562343262653535663330376666643735
|
||||
65346130303436613132306231396265313361373534393430326366363563646430376236326563
|
||||
62666134356539663836653837646438343564656637643532313930313130333766383966663133
|
||||
34336463343935646338653463313933386639343230663866373665633635343731
|
4
ansible/roles/mastodon/meta/main.yml
Normal file
4
ansible/roles/mastodon/meta/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
dependencies:
|
||||
- role: common
|
||||
- role: docker
|
||||
- role: traefik
|
27
ansible/roles/mastodon/tasks/main.yml
Normal file
27
ansible/roles/mastodon/tasks/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
- name: Create Mastodon app directory
|
||||
file:
|
||||
path: "{{ service_dir }}"
|
||||
state: directory
|
||||
- name: Copy .env.production
|
||||
copy:
|
||||
src: "{{ role_path }}/files/.env.production"
|
||||
dest: "{{ service_dir }}/.env.production"
|
||||
- name: Copy Docker Compose script
|
||||
template:
|
||||
src: "{{ role_path }}/templates/docker-compose.yml.j2"
|
||||
dest: "{{ service_dir }}/docker-compose.yml"
|
||||
- name: Create data directory
|
||||
file:
|
||||
path: "{{ data_dir }}"
|
||||
state: directory
|
||||
mode: 0777
|
||||
- name: Create cache directory
|
||||
file:
|
||||
path: "{{ service_dir }}/cache"
|
||||
state: directory
|
||||
mode: 0777
|
||||
- name: Start Docker Compose
|
||||
docker_compose:
|
||||
project_src: "{{ service_dir }}"
|
||||
pull: true
|
||||
remove_orphans: true
|
103
ansible/roles/mastodon/templates/docker-compose.yml.j2
Normal file
103
ansible/roles/mastodon/templates/docker-compose.yml.j2
Normal file
|
@ -0,0 +1,103 @@
|
|||
version: '3'
|
||||
services:
|
||||
db:
|
||||
restart: always
|
||||
image: postgres:14-alpine
|
||||
container_name: mastodon-db
|
||||
shm_size: 256mb
|
||||
networks:
|
||||
- default
|
||||
healthcheck:
|
||||
test: ['CMD', 'pg_isready', '-U', 'postgres']
|
||||
volumes:
|
||||
- {{ data_dir }}/postgres14:/var/lib/postgresql/data
|
||||
environment:
|
||||
- 'POSTGRES_HOST_AUTH_METHOD=trust'
|
||||
- 'POSTGRES_PASSWORD={{ mastodon_postgres_password }}'
|
||||
- 'POSTGRES_DB=mastodon_production'
|
||||
- 'POSTGRES_USER=mastodon'
|
||||
|
||||
redis:
|
||||
restart: always
|
||||
image: redis:7-alpine
|
||||
container_name: mastodon-redis
|
||||
networks:
|
||||
- default
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
volumes:
|
||||
- {{ data_dir }}/redis:/data
|
||||
environment:
|
||||
- 'REDIS_PASSWORD={{ mastodon_redis_password }}'
|
||||
|
||||
web:
|
||||
image: tootsuite/mastodon:v3.5.3
|
||||
container_name: mastodon-web
|
||||
restart: always
|
||||
env_file: .env.production
|
||||
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
|
||||
networks:
|
||||
- default
|
||||
- traefik
|
||||
healthcheck:
|
||||
# prettier-ignore
|
||||
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
volumes:
|
||||
- {{ data_dir }}/public/system:/mastodon/public/system
|
||||
- {{ service_dir }}/cache:/mastodon/public/system/cache
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.mastodon.entrypoints=websecure
|
||||
- traefik.http.routers.mastodon.rule=Host(`social.pizzapim.nl`)
|
||||
- traefik.http.routers.mastodon.tls=true
|
||||
- traefik.http.routers.mastodon.tls.certresolver=letsencrypt
|
||||
- traefik.http.services.mastodon.loadbalancer.server.port=3000
|
||||
- traefik.http.routers.mastodon.service=mastodon
|
||||
- traefik.docker.network=traefik
|
||||
|
||||
streaming:
|
||||
image: tootsuite/mastodon:v3.5.3
|
||||
container_name: mastodon-streaming
|
||||
restart: always
|
||||
env_file: .env.production
|
||||
command: node ./streaming
|
||||
networks:
|
||||
- default
|
||||
- traefik
|
||||
healthcheck:
|
||||
# prettier-ignore
|
||||
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.mastodon-streaming.entrypoints=websecure
|
||||
- "traefik.http.routers.mastodon-streaming.rule=(Host(`social.pizzapim.nl`) && PathPrefix(`/api/v1/streaming`))"
|
||||
- traefik.http.routers.mastodon-streaming.service=mastodon-streaming
|
||||
- traefik.http.services.mastodon-streaming.loadbalancer.server.port=4000
|
||||
- traefik.docker.network=traefik
|
||||
|
||||
sidekiq:
|
||||
image: tootsuite/mastodon:v3.5.3
|
||||
container_name: mastodon-sidekiq
|
||||
restart: always
|
||||
env_file: .env.production
|
||||
command: bundle exec sidekiq
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
networks:
|
||||
- default
|
||||
volumes:
|
||||
- {{ data_dir }}/public/system:/mastodon/public/system
|
||||
- {{ service_dir }}/cache:/mastodon/public/system/cache
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
20
ansible/roles/mastodon/vars/main.yml
Normal file
20
ansible/roles/mastodon/vars/main.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
service_name: mastodon
|
||||
data_dir: "{{ base_data_dir }}/{{ service_name }}"
|
||||
service_dir: "{{ base_service_dir }}/{{ service_name }}"
|
||||
|
||||
mastodon_postgres_password: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
34643131323762373635383736636432643161646130373565333432323337646435656233383131
|
||||
3066353734373938353162656335666536323265643162620a663562303636383737393061396331
|
||||
30353538326333393031373736363933666636383866373763303237376561333061323131303062
|
||||
3532316632613062310a343566393237363364613931353062636537663864383839623930383836
|
||||
32613634616335616462336261303632646266326663383166366236643438616538626263343835
|
||||
6539616439636364626466333163316164633631616132623665
|
||||
mastodon_redis_password: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
35643365666261333939303162366366393933613034306438323031393763343065613034366331
|
||||
3537383364313562623234363465363937613736616536360a323664306562653337616534313737
|
||||
62343433333033376363386333663632663965373963386432316136376563383763623631326133
|
||||
3430346364303334380a613932336534346437346539623864306233626265336663343565303866
|
||||
33393665633236653536383636616537396432366532366438316135303437313736336536336264
|
||||
3366643332306236376466386630666230366235333662663161
|
Reference in a new issue