IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
소스 검색

More modular setup for Gitea.

master
부모
커밋
b54be3ef64
6개의 변경된 파일75개의 추가작업 그리고 21개의 파일을 삭제
  1. +23
    -0
      example/gitea-custom/Fockerfile
  2. +10
    -0
      example/gitea-custom/files/body_inner_pre.tmpl
  3. +7
    -0
      example/gitea-custom/files/secrets.ini
  4. +16
    -0
      example/gitea-logo/Fockerfile
  5. +15
    -0
      example/gitea-logo/files/resize.py
  6. +4
    -21
      example/gitea/focker-compose.yml

+ 23
- 0
example/gitea-custom/Fockerfile 파일 보기

@@ -0,0 +1,23 @@
base: gitea-logo
steps:
- copy:
- [ files/body_inner_pre.tmpl,
/usr/local/share/gitea/templates/custom/body_inner_pre.tmpl ]
- [ files/secrets.ini,
/tmp/secrets.ini ]
- run: |
export GITEA_CONF=/usr/local/etc/gitea/conf/app.ini && \
export SECRET_CONF=/tmp/secrets.ini && \
crudini --set --inplace $GITEA_CONF server DISABLE_SSH true && \
crudini --set --inplace $GITEA_CONF service DEFAULT_ALLOW_CREATE_ORGANIZATION false && \
crudini --set --inplace $GITEA_CONF service DEFAULT_KEEP_EMAIL_PRIVATE true && \
crudini --set --inplace $GITEA_CONF repository MAX_CREATION_LIMIT 0 && \
crudini --set --inplace $GITEA_CONF server LANDING_PAGE explore && \
crudini --set --inplace $GITEA_CONF service DISABLE_REGISTRATION true && \
crudini --set --inplace $GITEA_CONF repository DEFAULT_REPO_UNITS repo.code && \
crudini --set --inplace $GITEA_CONF oauth2 JWT_SECRET `crudini --get $SECRET_CONF oauth2 JWT_SECRET` && \
crudini --set --inplace $GITEA_CONF security INTERNAL_TOKEN `crudini --get $SECRET_CONF security INTERNAL_TOKEN` && \
crudini --set --inplace $GITEA_CONF security SECRET_KEY `crudini --get $SECRET_CONF security SECRET_KEY` && \
rm -v $SECRET_CONF && \
sed -i -e '/<link rel="mask-icon"/ d' /usr/local/share/gitea/templates/base/head.tmpl

+ 10
- 0
example/gitea-custom/files/body_inner_pre.tmpl 파일 보기

@@ -0,0 +1,10 @@
{{if not .IsSigned}}
<div class="ui positive message" style="margin: 1em;">
Please write an email to s dot adaszewski at gmail dot com
if you would like to get an account. User accounts are only
allowed to report issues and/or make forks in order to
generate pull requests. This is a purpose-specific Git hosting
for <a href="https://adared.ch" target="_blank">ADARED</a>
projects.
</div>
{{end}}

+ 7
- 0
example/gitea-custom/files/secrets.ini 파일 보기

@@ -0,0 +1,7 @@
[oauth2]
JWT_SECRET = jyPeKbTyjilNDxQasRmMj0aoy1dt8GjNXQ5YvF31bBg
[security]
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODgzNTYwNzR9.BxjHW8MGqP6TJWNpYwhj-H0vjhD183CWBbUkQJsIOsI
SECRET_KEY = HOuK9pbQE8p7KE8aRMXygJ2LUp4OBfI1eg1rhyfgmVcAjaIP9xjpjiN4z73zttB3

+ 16
- 0
example/gitea-logo/Fockerfile 파일 보기

@@ -0,0 +1,16 @@
base: gitea-latest
steps:
- copy:
- [ files/resize.py,
/tmp/resize.py ]
- run: |
ASSUME_ALWAYS_YES=yes pkg install py37-pillow && \
export LOGO_URL=https://adared.ch/wp-content/uploads/2017/04/adared_logo_20170403-2.png && \
fetch $LOGO_URL -o logo.png && \
python3.7 /tmp/resize.py logo.png && \
mv -v gitea-*.png /usr/local/share/gitea/public/img/ && \
rm -v logo.png && \
rm -v /tmp/resize.py && \
ASSUME_ALWAYS_YES=yes pkg remove py37-pillow && \
ASSUME_ALWAYS_YES=yes pkg autoremove

+ 15
- 0
example/gitea-logo/files/resize.py 파일 보기

@@ -0,0 +1,15 @@
from argparse import ArgumentParser
from PIL import Image
parser = ArgumentParser()
parser.add_argument('filename', type=str)
args = parser.parse_args()
im = Image.open(args.filename)
for name, height in { 'sm': 120,
'lg': 880, '192': 192, '512': 512}.items():
print(name, height)
width = im.width * height // im.height
im_1 = im.resize((width, height), Image.BILINEAR)
im_1.save('gitea-' + name + '.png')

+ 4
- 21
example/gitea/focker-compose.yml 파일 보기

@@ -1,5 +1,7 @@
images:
gitea-latest: .
gitea: .
gitea-logo: ../gitea-logo
gitea-custom: ../gitea-custom
certbot-latest: ../certbot
volumes:
@@ -13,7 +15,7 @@ jails:
domains:
- xyz.com
- www.xyz.com
image: gitea-latest
image: gitea-custom
mounts:
gitea-data: /var/db/gitea
ip4.addr: 127.0.8.1
@@ -25,29 +27,10 @@ jails:
sed -i -e "s/127.0.0.1/${IP4_ADDR}/g" $GITEA_CONF && \
sed -i -e "s/localhost/${DOMAIN_NAME}/g" $GITEA_CONF && \
crudini --set --inplace $GITEA_CONF server ROOT_URL https://${DOMAIN_NAME} && \
crudini --set --inplace $GITEA_CONF server DISABLE_SSH true && \
crudini --set --inplace $GITEA_CONF service DEFAULT_ALLOW_CREATE_ORGANIZATION false && \
crudini --set --inplace $GITEA_CONF service DEFAULT_KEEP_EMAIL_PRIVATE true && \
crudini --set --inplace $GITEA_CONF repository MAX_CREATION_LIMIT 0 && \
crudini --set --inplace $GITEA_CONF server LANDING_PAGE explore && \
crudini --set --inplace $GITEA_CONF service DISABLE_REGISTRATION false && \
crudini --set --inplace $GITEA_CONF repository DEFAULT_REPO_UNITS repo.code && \
export SECRET_CONF=/var/db/gitea/focker-secrets.ini && \
if [ ! -f $SECRET_CONF ]; then
touch $SECRET_CONF && \
chown root:git $SECRET_CONF && \
chmod 640 $SECRET_CONF && \
crudini --set --inplace $SECRET_CONF oauth2 JWT_SECRET `gitea generate secret JWT_SECRET` && \
crudini --set --inplace $SECRET_CONF security INTERNAL_TOKEN `gitea generate secret INTERNAL_TOKEN` && \
crudini --set --inplace $SECRET_CONF security SECRET_KEY `gitea generate secret SECRET_KEY`; \
fi && \
if [ ! -f /var/db/gitea/gitea.db ]; then \
su git -c 'gitea migrate -c $GITEA_CONF' && \
su git -c 'gitea admin -c $GITEA_CONF create-user --username admin1 --password "AdminAdmin1+" --email "invaliduser@nonexistentdomain.com" --admin'; \
fi && \
crudini --set --inplace $GITEA_CONF oauth2 JWT_SECRET `crudini --get $SECRET_CONF oauth2 JWT_SECRET` && \
crudini --set --inplace $GITEA_CONF security INTERNAL_TOKEN `crudini --get $SECRET_CONF security INTERNAL_TOKEN` && \
crudini --set --inplace $GITEA_CONF security SECRET_KEY `crudini --get $SECRET_CONF security SECRET_KEY` && \
/bin/sh /etc/rc
certbot-gitea:


불러오는 중...
취소
저장