diff --git a/files/apps/gramps/docker-compose.yml b/files/apps/gramps/docker-compose.yml new file mode 100644 index 0000000..191fcd3 --- /dev/null +++ b/files/apps/gramps/docker-compose.yml @@ -0,0 +1,49 @@ +# See versions: https://github.com/gramps-project/gramps-web/pkgs/container/grampsweb + +services: + + grampsweb: &grampsweb + image: ghcr.io/gramps-project/grampsweb:v24.12.2 + restart: unless-stopped + ports: + - "127.0.0.1:${WEB_SERVER_PORT}:5000" # host:docker + environment: + GRAMPSWEB_TREE: "Gramps" # will create a new tree if not exists + GRAMPSWEB_SECRET_KEY: "${SECRET_KEY}" + GRAMPSWEB_BASE_URL: "https://gramps.vakhrushev.me" + GRAMPSWEB_REGISTRATION_DISABLED: "true" + GRAMPSWEB_CELERY_CONFIG__broker_url: "redis://grampsweb_redis:6379/0" + GRAMPSWEB_CELERY_CONFIG__result_backend: "redis://grampsweb_redis:6379/0" + GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://grampsweb_redis:6379/1 + GUNICORN_NUM_WORKERS: 4 + # media storage at s3 + GRAMPSWEB_MEDIA_BASE_DIR: "s3://av-gramps-media-storage" + AWS_ENDPOINT_URL: "https://storage.yandexcloud.net" + AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}" + AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}" + AWS_DEFAULT_REGION: "ru-central1" + depends_on: + - grampsweb_redis + volumes: + - ./data/gramps_users:/app/users # persist user database + - ./data/gramps_index:/app/indexdir # persist search index + - ./data/gramps_thumb_cache:/app/thumbnail_cache # persist thumbnails + - ./data/gramps_cache:/app/cache # persist export and report caches + - ./data/gramps_secret:/app/secret # persist flask secret + - ./data/gramps_db:/root/.gramps/grampsdb # persist Gramps database + - ./data/gramps_media:/app/media # persist media files + - ./data/gramps_tmp:/tmp + + grampsweb_celery: + <<: *grampsweb # YAML merge key copying the entire grampsweb service config + ports: [] + container_name: grampsweb_celery + restart: unless-stopped + depends_on: + - grampsweb_redis + command: celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2 + + grampsweb_redis: + image: docker.io/library/redis:7.2.4-alpine + container_name: grampsweb_redis + restart: unless-stopped diff --git a/playbook-app-gramps.yml b/playbook-app-gramps.yml new file mode 100644 index 0000000..b8a7b1e --- /dev/null +++ b/playbook-app-gramps.yml @@ -0,0 +1,47 @@ +--- +- name: 'Configure gramps application' + hosts: all + + vars_files: + - vars/ports.yml + - vars/vars.yml + + vars: + app_name: 'gramps' + base_dir: '/home/major/applications/{{ app_name }}/' + + tasks: + + - name: 'Create application directories' + ansible.builtin.file: + path: '{{ item }}' + state: 'directory' + mode: '0755' + loop: + - '{{ base_dir }}' + - '{{ (base_dir, "data") | path_join }}' + + - name: 'Copy application files' + ansible.builtin.copy: + src: '{{ item }}' + dest: '{{ base_dir }}' + mode: '0644' + loop: + - './files/apps/{{ app_name }}/docker-compose.yml' + + - name: 'Set up environment variables for application' + ansible.builtin.template: + src: 'env.j2' + dest: '{{ (base_dir, ".env") | path_join }}' + mode: '0644' + vars: + env_dict: + WEB_SERVER_PORT: '{{ gramps_port }}' + SECRET_KEY: '{{ gramps.secret_key }}' + AWS_ACCESS_KEY_ID: '{{ gramps.aws_access_key_id }}' + AWS_SECRET_ACCESS_KEY: '{{ gramps.aws_secret_access_key }}' + + - name: 'Run application with docker compose' + community.docker.docker_compose_v2: + project_src: '{{ base_dir }}' + state: 'present' diff --git a/playbook-app-music.yml b/playbook-app-music.yml index 466d363..0ccb822 100644 --- a/playbook-app-music.yml +++ b/playbook-app-music.yml @@ -13,7 +13,7 @@ - name: 'Create application directories' ansible.builtin.file: - path: '{{ item }}' + path: '{{ item }}' state: 'directory' mode: '0755' loop: diff --git a/templates/Caddyfile.j2 b/templates/Caddyfile.j2 index 6c6cba8..1a3ab5f 100644 --- a/templates/Caddyfile.j2 +++ b/templates/Caddyfile.j2 @@ -65,3 +65,11 @@ music.vakhrushev.me { to 127.0.0.1:{{ navidrome_port }} } } + +gramps.vakhrushev.me { + tls anwinged@ya.ru + + reverse_proxy { + to 127.0.0.1:{{ gramps_port }} + } +} diff --git a/vars/ports.yml b/vars/ports.yml index 13d5217..88731ac 100644 --- a/vars/ports.yml +++ b/vars/ports.yml @@ -11,3 +11,4 @@ gitea_port: "{{ base_port + 8 }}" keycloak_port: "{{ base_port + 9 }}" outline_port: "{{ base_port + 10 }}" navidrome_port: "{{ base_port + 11 }}" +gramps_port: "{{ base_port + 12 }}" diff --git a/vars/vars.yml b/vars/vars.yml index 9ee3060..fc3b783 100644 --- a/vars/vars.yml +++ b/vars/vars.yml @@ -1,52 +1,61 @@ $ANSIBLE_VAULT;1.1;AES256 -66343038363033616463663935663066663937373633383364626362656565333861373734626265 -3239643335313165383962663832633935393039616134620a626436643836623037316233373461 -62623330376438633933353965356262386138383864313461623062343836313739623562336431 -3433356538323334640a663835313739646231316639616562373335646461616239383335373565 -34303533376563393464303137633639396364366261376532623462653030363238343233623864 -37316337383736626262643133636337623532343334386665643637386265313933386332663030 -38663839303431656332356334303764353932316465363032386431376235313734666238383030 -64323236636531643932663838383336616236303231326265333735346664633732363963653166 -31616264356132396162356435373363666165353231336262386265393637393563663739383161 -31393835353165636137356536353239366339636638646532396632666332393630663631626261 -30313761393931386236353763663363393436643864643735326233323262626438616338326162 -34333236653030326564363465316463663263346565343534326363333361663238626362356666 -32663362616361623235393362363766316366616337666637353039653862646632393065336239 -33666264366366323333663238623138613863653233623931373766373739383766333139653734 -30333031363134326263343437656238613865306236306235396262306133653334616637376637 -34663533386134373139343263373265326261666161326334626137313930643964656165636135 -37656532653633616232356361326139613061633936333337383536616364623035623865663431 -61633433656462373730303264363830376137323666326561333065326339303430663731633031 -30326632373337663733363965383836623930366432323763333265363937363430333965316566 -30653161353266623532383331336139383336626162306435613634363261623430343634656161 -62353233633165626339633931616237316638653566363534333130373366633464346662343738 -34336265343936653566623464356531336561626139633466316632373639666330666138343965 -64326334343162626666366635363034303566303836376566613632353633346139616534333438 -30633731333434666135656238633664376338303166373131643334343030326632316265373433 -61646534663135613433343864353936623661653337646461353233336365363030376465666666 -31626531303039333932306531303833313731386435633438373363633461623433613265643435 -31643233386564323135653363363038386366353232303032316361613733313966393664656362 -31373039393933326631343163383335376561616433623332646239303562363738393865336562 -35613662376238613339316130386365643836663334346362623832623639636330363365616263 -36613962396537653837303161613236616537383736666431313164393639353130653563343536 -32373764376438366566396437376137383133303365623532626537373832346665333634353364 -36326531323865323866623532383666333230646234383539313430396234313430323439393631 -61313332336162343232393937343231626532303037323163333165626230646134633036393732 -35633633613366643736343462336434633438333634653639623734346665383832316161383539 -34656231306535613639613737626630666430326432633737616435613965613738363836373535 -34613739643966653833393639313064356131393533653037376264306636353538373838613166 -61633032643564383030323066623863643037306639653164356236353564616634376537383534 -63343638303762656635383837613535646235313137336336343964333633306662633866343037 -64393264653737656238663939663137616637356238636265313438373363316166373862653331 -65383039393939373365633738306239373631333663613463313036393563643537306562386631 -61313064653831343138343832366261613936316330386332613034383139373861363038613030 -66616665646434363731346234313261353035323263333035616531316161356536653536613136 -63356136373035363864356633373139643761323734343030353130353866653337336338316364 -39643466386139346233373837656165393732326662353934656563386436313964643131376264 -61336331353937373965653363396438303561636531626330333063316533616566316165646562 -64306164343162646634366235363333636638353562656438343937346666643565303264323265 -65353961623937623665366536333366663462376135396132663161383563383738333232653435 -30366637393065653233323261633063373235306238323032623562326261613938646535396536 -34633730393234363866643533396435646137313365636136643239383662643837626565663739 -31313130626230353162393037653265633336343537313564373531636166666532356138633331 -336233346133636565623763646438373536 +36633164616665656332353931383339663033323235656335343234363164633266303764663938 +6665373565313439386334363833393337326237313532650a366465633265313765373035616331 +30626533343763376566313466303765373235343839333866643162623561323031356334656537 +6663633735393236310a376364613430313661313338313539383434323163343865373335383666 +31343431343432316364366333333539626466333332303537393235373063373561653530333237 +65333262613932303135393238666264373834313239303264386161323436653436373930306136 +66643039613030346434663038343030393939313434393965636636353264393535316132306139 +63616663633664666439653364316365356633333137663138343062346664336663666537386331 +30313335643062383965333461633433376432393931613432363931373435323431383462313939 +31353264636635303637333362343437393837646137376638373938363963303539633764353061 +63363861333438346230393065663763346131663731346362383635616633373134616131643866 +36303038656130633462643739323763313832663939613630653632386433633138353862353765 +31613033333865383038643639646530373536656163376166366333346463623432313663353835 +30613236343465346336343734663466646533303632393937336330656563626166333534646165 +61653539326437636234393934323335363433663762646462326236323138653739623163373930 +65656332643963383261613039393636646362663531383865623533363035633562636137613066 +33383866393062303934333130333133386331653436663462656235366362666634646237363639 +30333264633137366264336235323164303332616336353136613232383062623533346463303232 +37336262613638616333376564386632356265396162383761396332636136653961663166633132 +64363666633063356539663833363635633435396136303264343666393131326132303366376233 +35316132363637303461396432353132383838653736353965663131663031393261303538346438 +37356563646663643937323337326239393834663464653532613039313335356231663734636332 +38383635356632353132663439303264383733366631366666316434383465393931613261613661 +38613031376430636366366363626465336236306633363836616264396635623633646164383563 +39623564623537343033376161363238363265643664393234313563623830633135653162366466 +30373161346464623331393934383839336336396666303934303336636431346664326133313566 +37346234343835636664663037333333353131343735303537376134663136323162306363343034 +66393539663638353930363663323938353961343730333963313432333538643432333630663663 +37363233303262633538663064636631343938343666353036636566303761343734373537323539 +62323866396639313139383930363732363630373032336565346230313264366138386465636237 +30616565306462623331363661353965616639393338616133363332613931626539646438346430 +64646561346264343531616334623135373361663338653339346633316438393433373665363533 +34393239393062383066383632346431386333653461356164356462633065373930626233323831 +35626563316139303164336533653765623539396335663138366539666136623038366337343039 +36323337646662626334363366343139666234363134323165303864643239356631333631343265 +33373461346234316566323837373962613934626232643262653761643039303965363839306463 +65663632613266646630343064326239633933613062623433356337663931633330313338653862 +65373538613335636339633466646431333338356563386230653164626265633637333865333131 +32643437336633613536326361663636323039346562333464653161663936623964383539633239 +32396635393733633035613032333065346232616635373663356163386635393761653665343463 +32643738343536376566663635303235373764313363323330356631343336353635306531666134 +61363364666339373531366337366562646131303463303633303333303436366134646231643636 +63303139636336376439646465353530643261356336326665313665616364323432333939323133 +37623561383630366236636533336436366230393035623836373035343034323065386666316539 +61396439646564333766383561326136323434376465623061386664383137333934636536356166 +36666166623038363262626166613262336635303632353536663238333834303331316339316463 +35623866383535613236616330346161396462386130356465363566616630326662393632633962 +36643532333935373832323966666634353332616135396265613461306137323233643330656461 +38313134313165623133663235373034386334616231653930366432346532656562353238343831 +65643965386664333731373036623732613734393837356162366534306536393638326632396265 +66623631613134393762653264653466613164663463616165633639323635363561643439373834 +36616438666665333532626462663664353332623266396466313333666638373861386239616663 +63646266633635646563393935616266373566656334336139383638666361363332343939643964 +62373530343332313135316131386461373464623966323534643661346532373438653233366635 +61303461306464353165373030626165333737356539303663346164623634326463303032343431 +64366361336539303138313232393435396537656138363365653538663131666439643761643964 +36303164316334623565316538623062323032346135313631666565623838326632303963383938 +64346436373634633733323639303434663664316430633836646664623231306233303038633362 +63316330663263373633353736346265373366326561303731623335653265373661373133363630 +38346530653531393133