From 2625fb7e2cab555ae00b3b1301bd967c2609849a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8E=B7=F0=9F=90=A2=20S=2E=20P=2E=20O=2E=20Clayton?= Date: Mon, 20 Jun 2022 12:45:27 -0400 Subject: [PATCH] Use templates for gitea --- .gitignore | 3 +- caddy.yaml | 14 +++-- Caddyfile => caddy/Caddyfile | 0 gitea.yaml | 29 +++++++++- gitea/Dockerfile | 5 ++ gitea/app.ini.j2 | 75 +++++++++++++++++++++++++ vault.yaml | 104 +++++++++++++++++++---------------- 7 files changed, 176 insertions(+), 54 deletions(-) rename Caddyfile => caddy/Caddyfile (100%) create mode 100644 gitea/Dockerfile create mode 100644 gitea/app.ini.j2 diff --git a/.gitignore b/.gitignore index 3dcb832..aa17601 100755 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -foundry_cache \ No newline at end of file +foundry_cache +gitea/app.ini \ No newline at end of file diff --git a/caddy.yaml b/caddy.yaml index 9cc4b0d..10d85dd 100755 --- a/caddy.yaml +++ b/caddy.yaml @@ -8,15 +8,21 @@ - vars.yaml tasks: + - name: Create Caddy Directory + file: + path: ~/caddy + state: directory + recurse: yes + - name: Send Caddy Dockerfile copy: - src: ./caddy/ - dest: ~/caddy/ + src: ./caddy/Dockerfile + dest: ~/caddy/Dockerfile - name: Send Caddyfile copy: - src: ./Caddyfile - dest: ~/ + src: ./caddy/Caddyfile + dest: ~/Caddyfile - name: Build Caddy image docker_image: diff --git a/Caddyfile b/caddy/Caddyfile similarity index 100% rename from Caddyfile rename to caddy/Caddyfile diff --git a/gitea.yaml b/gitea.yaml index 105470f..90993fd 100755 --- a/gitea.yaml +++ b/gitea.yaml @@ -27,12 +27,37 @@ target: /var/lib/postgresql/data state: "{{ container_state }}" + - name: Build Gitea config + template: + src: ./gitea/app.ini.j2 + dest: ./gitea/app.ini + + - name: Create Gitea Directory + file: + path: ~/gitea + state: directory + recurse: yes + + - name: Send Gitea Dockerfile + copy: + src: ./gitea/Dockerfile + dest: ~/gitea/Dockerfile + + - name: Build Gitea image + docker_image: + name: gitea_with_asciidoc + source: build + build: + cache_from: + - gitea/gitea:1.16.8 + path: "./gitea" + - name: Run Gitea docker_container: name: "{{ stack_prefix_name }}gitea" recreate: true restart_policy: unless-stopped - image: gitea/gitea:1.16.7 + image: gitea_with_asciidoc published_ports: - "3000:3000" env: @@ -48,7 +73,7 @@ - name: "{{ stack_external_network }}" # May need to open ssh ports for some things. Maybe not. mounts: - - source: "/home/server/gitea-app.ini" + - source: "/home/server/gitea/app.ini" target: /data/gitea/conf/app.ini type: bind - source: "{{ stack_prefix_name }}gitea_data" diff --git a/gitea/Dockerfile b/gitea/Dockerfile new file mode 100644 index 0000000..600fa27 --- /dev/null +++ b/gitea/Dockerfile @@ -0,0 +1,5 @@ +FROM gitea/gitea:1.16.8 + +COPY app.ini /data/gitea/conf/app.ini + +RUN apk --no-cache add asciidoctor \ No newline at end of file diff --git a/gitea/app.ini.j2 b/gitea/app.ini.j2 new file mode 100644 index 0000000..2edf4e7 --- /dev/null +++ b/gitea/app.ini.j2 @@ -0,0 +1,75 @@ +APP_NAME = Sean's Code +RUN_USER = git +RUN_MODE = prod + +[database] +NAME = gitea +DB_TYPE = postgres +USER = gitea +HOST = server_gitea-db:5432 +PASSWD = {{ secret_gitea_db_password }} +SCHEMA = +SSL_MODE = disable +CHARSET = utf8 +PATH = /app/gitea/data/gitea.db +LOG_SQL = false + +[repository] +DEFAULT_PUSH_CREATE_PRIVATE = false +ENABLE_PUSH_CREATE_USER = true +ROOT = /app/gitea/data/gitea-repositories + +[server] +SSH_DOMAIN = code.sean.wtf +DOMAIN = code.sean.wtf +HTTP_PORT = 3000 +ROOT_URL = https://code.sean.wtf/ +DISABLE_SSH = true +LFS_START_SERVER = true +LFS_CONTENT_PATH = /app/gitea/data/lfs +LFS_JWT_SECRET = {{ secret_gitea_lfs_jwt_secret }} +OFFLINE_MODE = false + +[mailer] +ENABLED = false + +[markup.asciidoc] +ENABLED = true +FILE_EXTENSIONS = .adoc,.asciidoc +; Input is not a standard input but a file +RENDER_COMMAND = "asciidoctor -s -a showtitle --out-file=- -" +IS_INPUT_FILE = false + +[service] +REGISTER_EMAIL_CONFIRM = false +ENABLE_NOTIFY_MAIL = false +DISABLE_REGISTRATION = true +ALLOW_ONLY_EXTERNAL_REGISTRATION = false +ENABLE_CAPTCHA = false +REQUIRE_SIGNIN_VIEW = false +DEFAULT_KEEP_EMAIL_PRIVATE = true +DEFAULT_ALLOW_CREATE_ORGANIZATION = true +DEFAULT_ENABLE_TIMETRACKING = true +NO_REPLY_ADDRESS = noreply.code.sean.wtf + +[picture] +DISABLE_GRAVATAR = false +ENABLE_FEDERATED_AVATAR = true + +[openid] +ENABLE_OPENID_SIGNIN = false +ENABLE_OPENID_SIGNUP = false + +[session] +PROVIDER = file + +[log] +MODE = console +LEVEL = info +ROOT_PATH = /app/gitea/log +ROUTER = console + +[security] +INSTALL_LOCK = true +INTERNAL_TOKEN = {{ secret_gitea_internal_token }} +PASSWORD_HASH_ALGO = pbkdf2 \ No newline at end of file diff --git a/vault.yaml b/vault.yaml index 11f9311..dc0951e 100755 --- a/vault.yaml +++ b/vault.yaml @@ -1,48 +1,58 @@ $ANSIBLE_VAULT;1.1;AES256 -36383835326631333663363138363766376564663836376330353132343565326331666565366263 -6366626130326438333364656533313436333734623731320a393633626162663765396534343465 -61633034353832633337396331623965313531623861303966613464646530656336396334663266 -3137623231613465380a663862303465383364643138303766346338353161616131633133353435 -63383535313463303536323135313337346338326561306237363964333930623035393333353264 -30393439316235666635633639653936613763336137363333613833343139616361363332633430 -65313233383236643961303038363266393863666435353161666539663039626465383738626337 -66636239663538306637323862313064306236313739323439363633653137663264623633346231 -61303464666364623831623538303063646161323866396534633630316239646566356666313934 -36623033613863326437626265376163366434393134626663663735653565643737386232356635 -33356164303835653133373864326338393134666331373362303132653864663536666565306366 -30623032653164376131643861313133366366646632353735333638333932356233303738306634 -33346638313135306465646166376362616461353836363937646432356535633934613962366266 -64326630306539363065616430646639323465626265366263643563306331373239373038623733 -33353364633033353434346537336336336339343461326132633532323538646635656531316333 -33336632643065616364316263383630306533663133313634623466396162663062396534636332 -32623162353937393936366337383531363934396230303033353334646666616635616637343038 -62643130626532353562643130636465643765313766356437636431663561376235346335633564 -36316634613462366366353732343937613834323666313962306264343233343030663430316633 -62383736363736653761323264306462316230636231353439356632353332656632643131623865 -37343537393433356539316634626638626235383166613739313735646266653835393065613236 -66396264376463336463346635343737313363656136376439656431353466636637333237306638 -64663865336561356631636466653833663965646431343731346635636465363861353261313332 -30343739646338386237636237333439306337626534663334343331323937333930626635306364 -61336361313662656231396135303035643432333465376566343136363037366335326330623231 -31336338303936333932623466343765646136643031613265613039336230373136346337623765 -35633931366437663737323535363436643365306437613232333730306538626462636662323839 -33613838393334363563393432376136366261643339653035346238303236636632633731613263 -63336237383934356533666566613866373935626435623039393061666232396266646632376632 -64376464313263333937633033353066303536636461316137396264366165303737356664616232 -30303563326266386165643234353465346463613866303538616331376261343162323936633661 -37646666393966393761313732633739323539376339323937343264336637396234626336313464 -65316434656534343031336363636561393261623238656362363863616437343138373231663034 -61303462306562343336373065626664623839303361363866643035333334393932666138363939 -61626334383731386265323064396439636162666464626333323966663938623237656166613231 -38393331386330356365396432643635306239623133653232633439353730313530366530666562 -36373762393830646632613731323464396561343732323066346630353434616438386366343132 -31376430316135653138356434636437353332393730626433326632643764323732633435323330 -35613064663730376466386630366632373664623665386536643638326236623465303534313662 -36396239396465643964643134363239356137626464313131326161643463663638633764653833 -33393339623966323634613762366362666437336439316438383932353662336166623434356138 -36666431376338333231353161333639363362356630393834363430343135646131326161656439 -31383838396562333632316632383034383033643564366339656439303364326434383461306437 -38306437633564373833616162616636616266333739656566653331386162363964366637383136 -62396437323235656235303237343131656639616563353235373766616464373032316664363763 -35663461333035396366363530646638343138356532363635373539666664376537343661646536 -313935316164343663653434623339393863 +62356536623463366338336231303333353262383437366464366538376533326434663237343761 +6436613366306363303036623833326662336263323439660a386135333265336630336134323636 +64313535623235333166656663376634373132346566323331353263646332376536393036303938 +3338306261346239660a373439383832303464303062663962386564363737376132393864353166 +66336632633566656432343939383366363464636236396333326461626166323730376531356264 +37653161393631316239663333353966323836333036323665376535386433386662663539306334 +63633264383765333233323336393334343563636264623633373634383862616663396239313365 +34303039363836653135376535656635303261643064633632363439643030646134336233333037 +34353032613934366336323832623637626663396635356631623262383864313661373939653034 +37616437306139326538353465313332386437656362393833633863626566333336363162336362 +38633563343061303434373662643663386339663139396531643538646536356465316335613033 +39353161336532313633386431613064383863343136623263343738326134366339663130313339 +31356536343332616265373036616638643362336663313466646561373735393539326361653764 +30343233356362626436363837396339613165383330633433386433303234326166646138363434 +34656637343766623230663537313031333834316263313432383466346665303536656537386639 +62356634333033633161643237616631616134656239366639333836316562653437353965626463 +35366330633461346462386236633033306662613961646232653336626339316331353732653131 +35363062343831333636373734623261386331386530623262313732626231383231323265383535 +64613932623534623035373662366165363231393261386434373431636234623333383566663265 +38323361303664303736613661376438333862333039663864316132623438343638383566653065 +64653531326664636637393936323963613037333235633834366230613737633665353437326439 +38613936383139363663383834383261376331656538346164306133663235343966366564613838 +34363433313837633830666163373236316266656535346564653232313833613632376463316333 +32336166383366643331376131366535646232356534616230313532323130666662376531616464 +36313232313361656163366532666261326438386534336533383334393037363333663031316663 +63313737636537636162373464393363356566613332633031386538393938653836363464306564 +61396161663464306535343532636538323834333565626264393534363032376466346462323632 +65373730316132306636313638663664383733633532356566396663306466346434653065623533 +63313565663162623261633361653935633330313132626335633431376336386234363231353230 +35653038373062653063336537336238366264626436313037643530363630376564663537616337 +30636463323665306136356530343262636664636632633434653166633330383737326661346666 +39323337636539623665316630363061353235366566353039373136623661353938343432323164 +64623836353238393235633834346633333164356263633561333436666231366264653839623235 +30356465353765363464653035363063653063616630323634613238363434653237303261353632 +36313466633963633430363037313431643530383234313432666637616562656630343761306433 +34653039666134633463623334356634366238376362343539383563343838356234353065653639 +31316439373933356535363935646139643663626263633332623236333338333133383636303664 +37333439356634343565383336626266336564326532616131343665623834333031346436353333 +62306365336565346163666330323739383066643331623135386436343238616436393935376636 +30653063326338333635303338623962363465666662386366623035663939366262376562616632 +36363934303337313139396135353431663661386466366433373730333235666565323864363530 +35363866313435636231636361383461363136373061396533646230303732633234613166316235 +62316262316133636636656434333631333232396132646137363535636331646564633930386230 +63323036333365363438356438386261623230353335643432393431366566626531323564663666 +61383530376565303766383930373566363630353336393436333634376465353538626262616136 +62363435323138646334666239353830356465366439666333373832666235663366663862636131 +33623533343362313666623837396531316663666633336636633738373462626438646434343037 +34626638636165653333393835386530303738643165613561323261656463336330383839623638 +32663431633963656436363635303564373233633761373435643033653565303833656266343064 +63336434336636393832653139653038626539306131666662326564373463393138333334383065 +61366463373136356332666565383538336530633235353733393233313764623830336135343465 +65633038613963316464306538666131616338663137323936646136653362336263316261326232 +34353962383737363961633632313561326165336531396130326265613265396264633538636464 +35386633366231316463616130376634366165363537616666303461616630646634353430356162 +33343462313333363333383536613336353539613536323965383362653830626639626237323031 +34653834626363343561363036373033666333613464396631613863376533643761323565396539 +34333235633766626365633934366164623366333336383861323039363765313936