init: alpine base git server

This commit is contained in:
2025-07-12 17:19:14 +08:00
commit 6968343da2
11 changed files with 354 additions and 0 deletions

87
swarm/docker-compose.yml Normal file
View File

@ -0,0 +1,87 @@
version: "3.9"
services:
nginx:
image: nginx:alpine
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
configs:
- source: nginx
target: /etc/nginx/nginx.conf
secrets:
- source: cakey
target: /etc/nginx/certs/ca.key
mode: 0440
- source: cacer
target: /etc/nginx/certs/ca.cer
mode: 0440
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /data/nginx/conf.d:/etc/nginx/conf.d
- /data/nginx/html:/usr/share/nginx/html:ro
- /data/nginx/www_root:/usr/share/nginx/www_root:ro
networks:
- inline
depends_on:
- gitea
- registry
gitea:
image: gitea/gitea:1.23.7
ports:
- target: 22
published: 22
mode: host
environment:
- USER_UID=1000
- USER_GID=1000
- APP_NAME=Where the world builds software
- RUN_MODE=prod
- RUN_USER=git
- DB_TYPE=sqlite3
- DISABLE_SSH=false
- LFS_START_SERVER=true
- REQUIRE_SIGNIN_VIEW=false
- DISABLE_REGISTRATION=true
- DEFAULT_ACTIONS_URL=self
- DOMAIN=git.guzal.cc
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /data/gitea:/data
networks:
- inline
registry:
image: registry:latest
environment:
- REGISTRY_HTTP_SECRET=HnpapIhqHs6V4fv/lT4iIg==
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /data/registry:/var/lib/registry
networks:
- inline
networks:
host:
external: true
name: "host"
inline:
external: false
configs:
nginx:
file: ./nginx.conf
secrets:
cakey:
file: /root/.acme.sh/guzal.cc_ecc/guzal.cc.key
cacer:
file: /root/.acme.sh/guzal.cc_ecc/fullchain.cer

70
swarm/nginx.conf Normal file
View File

@ -0,0 +1,70 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format json_analytics '{'
'"msec": "$msec", ' # request unixtime in seconds with a milliseconds resolution
'"connection": "$connection", ' # connection serial number
'"connection_requests": "$connection_requests", ' # number of requests made in connection
'"pid": "$pid", ' # process pid
'"request_id": "$request_id", ' # the unique request id
'"request_length": "$request_length", ' # request length (including headers and body)
'"remote_addr": "$remote_addr", ' # client IP
'"remote_user": "$remote_user", ' # client HTTP username
'"remote_port": "$remote_port", ' # client port
'"time_local": "$time_local", '
'"time_iso8601": "$time_iso8601", ' # local time in the ISO 8601 standard format
'"request": "$request", ' # full path no arguments if the request
'"request_uri": "$request_uri", ' # full path and arguments if the request
'"args": "$args", ' # args
'"status": "$status", ' # response status code
'"body_bytes_sent": "$body_bytes_sent", ' # the number of body bytes exclude headers sent to a client
'"bytes_sent": "$bytes_sent", ' # the number of bytes sent to a client
'"http_referer": "$http_referer", ' # HTTP referer
'"http_user_agent": "$http_user_agent", ' # user agent
'"http_x_forwarded_for": "$http_x_forwarded_for", ' # http_x_forwarded_for
'"http_host": "$http_host", ' # the request Host: header
'"server_name": "$server_name", ' # the name of the vhost serving the request
'"request_time": "$request_time", ' # request processing time in seconds with msec resolution
'"upstream": "$upstream_addr", ' # upstream backend server for proxied requests
'"upstream_connect_time": "$upstream_connect_time", ' # upstream handshake time incl. TLS
'"upstream_header_time": "$upstream_header_time", ' # time spent receiving upstream headers
'"upstream_response_time": "$upstream_response_time", ' # time spend receiving upstream body
'"upstream_response_length": "$upstream_response_length", ' # upstream response length
'"upstream_cache_status": "$upstream_cache_status", ' # cache HIT/MISS where applicable
'"ssl_protocol": "$ssl_protocol", ' # TLS protocol
'"ssl_cipher": "$ssl_cipher", ' # TLS cipher
'"scheme": "$scheme", ' # http or https
'"request_method": "$request_method", ' # request method
'"server_protocol": "$server_protocol", ' # request protocol, like HTTP/1.1 or HTTP/2.0
'"pipe": "$pipe", ' # "p" if request was pipelined, "." otherwise
'"gzip_ratio": "$gzip_ratio", '
'"http_cf_ray": "$http_cf_ray"'
'}';
access_log /var/log/nginx/access.log json_analytics;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip off;
server_tokens off;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/conf.d/vhost/*.conf;
include /etc/nginx/conf.d/server/*.conf;
}