Browse Source

standardize favicon.ico across all domains

sni-wip
forest 8 months ago
parent
commit
1d4418e38d
4 changed files with 25 additions and 3 deletions
  1. +1
    -1
      build-docker.sh
  2. BIN
      caddy/static/favicon.ico
  3. +11
    -2
      docker-compose.yml
  4. +13
    -0
      main.go

+ 1
- 1
build-docker.sh View File

@ -1,6 +1,6 @@
#!/bin/bash -e
VERSION="0.0.11"
VERSION="0.0.12"
rm -rf dockerbuild || true
mkdir dockerbuild


BIN
caddy/static/favicon.ico View File

Before After

+ 11
- 2
docker-compose.yml View File

@ -12,6 +12,10 @@ services:
- "443:443"
command: ["/bin/sh", "-c", "rm -f /caddysocket/caddy.sock && caddy run -config /config/config.json"]
volumes:
- type: bind
source: ./caddy/static
target: /srv/static
read_only: true
- type: bind
source: ./caddy/config
target: /config
@ -27,7 +31,8 @@ services:
target: /caddysocket
caddy-config:
image: sequentialread/caddy-config:0.0.11
image: sequentialread/caddy-config:0.0.12
mem_limit: 50m
networks:
- sequentialread
volumes:
@ -45,6 +50,7 @@ services:
docker-api-security-gateway:
image: sequentialread/docker-api-security-gateway:0.0.16
mem_limit: 50m
userns_mode: "host"
volumes:
- type: bind
@ -283,6 +289,7 @@ services:
gitea:
image: sequentialread/gitea-armv7:1.13.2
restart: always
mem_limit: 300m
ports:
- "10022:10022"
networks:
@ -293,6 +300,9 @@ services:
target: /data
environment:
- APP_NAME='SequentialRead Git'
- UI_META_AUTHOR='Forest Johnson (SequentialRead)'
- UI_META_DESCRIPTION='Forest's self-hosted git server for sequentialread.com'
- SERVER_LANDING_PAGE='explore'
- SSH_PORT=10022
- SSH_LISTEN_PORT=10022
- ROOT_URL=https://git.beta.sequentialread.com
@ -472,4 +482,3 @@ networks:
volumes:
caddy-socket-volume:

+ 13
- 0
main.go View File

@ -113,6 +113,10 @@ type CaddyHandler struct {
//CaddyStaticResponseHandler
Headers map[string][]string `json:"headers,omitempty"`
StatusCode int `json:"status_code,omitempty"`
//CaddyFileServerHandler
Root string `json:"root,omitempty"`
Passthrough bool `json:"pass_thru,omitempty"`
}
// https://caddyserver.com/docs/json/apps/http/servers/routes/handle/reverse_proxy/
@ -136,6 +140,7 @@ type CaddyVarsRegexp struct {
var CADDY_SOCKET = "/caddysocket/caddy.sock"
var DOCKER_SOCKET = "/var/run/docker.sock"
var FAVICON_DIRECTORY = "/srv/static"
var DOCKER_API_VERSION = "v1.40"
var CADDY_ACME_ISSUER_URL = "https://acme-v02.api.letsencrypt.org/directory"
var CADDY_ACME_CLIENT_EMAIL_ADDRESS = ""
@ -146,6 +151,7 @@ func main() {
CADDY_SOCKET = getEnvVar("$CADDY_SOCKET", CADDY_SOCKET)
DOCKER_SOCKET = getEnvVar("$DOCKER_SOCKET", DOCKER_SOCKET)
FAVICON_DIRECTORY = getEnvVar("$FAVICON_DIRECTORY", FAVICON_DIRECTORY)
DOCKER_API_VERSION = getEnvVar("$DOCKER_API_VERSION", DOCKER_API_VERSION)
CADDY_ACME_ISSUER_URL = getEnvVar("$CADDY_ACME_ISSUER_URL", CADDY_ACME_ISSUER_URL)
CADDY_ACME_CLIENT_EMAIL_ADDRESS = getEnvVar("$CADDY_ACME_CLIENT_EMAIL_ADDRESS", CADDY_ACME_CLIENT_EMAIL_ADDRESS)
@ -331,6 +337,13 @@ func IngressConfig() error {
if container.PublicHostnames != "" {
newRoute := CaddyRoute{
Handle: []CaddyHandler{
// this handler is just here to standardize the favicon (or any other universal static file)
// across the sites
CaddyHandler{
Handler: "file_server",
Root: FAVICON_DIRECTORY,
Passthrough: true,
},
CaddyHandler{
Handler: "reverse_proxy",
Upstreams: []CaddyUpstream{


Loading…
Cancel
Save