Fix database connection issues and serve photos app at root domain
This commit is contained in:
parent
31def9585a
commit
6f6741dfb5
53
start.sh
53
start.sh
@ -426,16 +426,10 @@ cat > /app/data/public/index.html <<EOT
|
|||||||
<title>Ente</title>
|
<title>Ente</title>
|
||||||
<script src="/config.js"></script>
|
<script src="/config.js"></script>
|
||||||
<script src="/debug.js"></script>
|
<script src="/debug.js"></script>
|
||||||
<script>
|
|
||||||
// Redirect to the photos app after a brief delay
|
|
||||||
setTimeout(function() {
|
|
||||||
window.location.href = "/photos/";
|
|
||||||
}, 300);
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Loading Ente...</h1>
|
<h1>Ente</h1>
|
||||||
<p>You will be redirected automatically.</p>
|
<p>Welcome to Ente!</p>
|
||||||
<p><a href="/debug">Debug Information</a></p>
|
<p><a href="/debug">Debug Information</a></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -527,34 +521,26 @@ cat > /app/data/caddy/Caddyfile <<EOT
|
|||||||
reverse_proxy localhost:$API_PORT
|
reverse_proxy localhost:$API_PORT
|
||||||
}
|
}
|
||||||
|
|
||||||
# Root handler
|
# Serve photos app at the root
|
||||||
handle / {
|
handle /* {
|
||||||
root * /app/data/public
|
|
||||||
file_server
|
|
||||||
}
|
|
||||||
|
|
||||||
# Server web apps
|
|
||||||
handle /photos* {
|
|
||||||
uri replace /photos /
|
|
||||||
root * /app/web/photos
|
root * /app/web/photos
|
||||||
|
|
||||||
# Inject config script
|
# Inject config script
|
||||||
handle_path /* {
|
@html {
|
||||||
@html {
|
path *.html index.html
|
||||||
path *.html index.html
|
not path */assets/* */static/* */img/* */css/* */js/*
|
||||||
not path */assets/* */static/* */img/* */css/* */js/*
|
|
||||||
}
|
|
||||||
|
|
||||||
header @html Content-Type "text/html; charset=utf-8"
|
|
||||||
|
|
||||||
# Use rewrite to modify HTML content
|
|
||||||
@isIndex path /index.html
|
|
||||||
rewrite @isIndex /photos-injected.html
|
|
||||||
|
|
||||||
file_server
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header @html Content-Type "text/html; charset=utf-8"
|
||||||
|
|
||||||
|
# Use rewrite to modify HTML content
|
||||||
|
@isIndex path /index.html
|
||||||
|
rewrite @isIndex /photos-injected.html
|
||||||
|
|
||||||
|
file_server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Accounts app
|
||||||
handle /accounts* {
|
handle /accounts* {
|
||||||
uri replace /accounts /
|
uri replace /accounts /
|
||||||
root * /app/web/accounts
|
root * /app/web/accounts
|
||||||
@ -575,6 +561,7 @@ cat > /app/data/caddy/Caddyfile <<EOT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Auth app
|
||||||
handle /auth* {
|
handle /auth* {
|
||||||
uri replace /auth /
|
uri replace /auth /
|
||||||
root * /app/web/auth
|
root * /app/web/auth
|
||||||
@ -595,6 +582,7 @@ cat > /app/data/caddy/Caddyfile <<EOT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cast app
|
||||||
handle /cast* {
|
handle /cast* {
|
||||||
uri replace /cast /
|
uri replace /cast /
|
||||||
root * /app/web/cast
|
root * /app/web/cast
|
||||||
@ -778,7 +766,7 @@ if [ -d "$SERVER_DIR/cmd/museum" ]; then
|
|||||||
# Execute as the cloudron user but use a proper script instead of env cd
|
# Execute as the cloudron user but use a proper script instead of env cd
|
||||||
cat > /tmp/run_migration.sh <<EOF
|
cat > /tmp/run_migration.sh <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd "$SERVER_DIR" && go run cmd/museum/main.go db force 25
|
cd "$SERVER_DIR" && ENTE_PG_DSN="postgres://${MUSEUM_DB_USER}:${MUSEUM_DB_PASSWORD}@${MUSEUM_DB_HOST}:${MUSEUM_DB_PORT}/${MUSEUM_DB_NAME}?sslmode=disable" go run cmd/museum/main.go db force 25
|
||||||
EOF
|
EOF
|
||||||
chmod +x /tmp/run_migration.sh
|
chmod +x /tmp/run_migration.sh
|
||||||
|
|
||||||
@ -830,7 +818,7 @@ elif [ -d "$SERVER_DIR/cmd/museum" ]; then
|
|||||||
# Create a startup script
|
# Create a startup script
|
||||||
cat > /tmp/run_server.sh <<EOF
|
cat > /tmp/run_server.sh <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd "$SERVER_DIR" && go run cmd/museum/main.go serve
|
cd "$SERVER_DIR" && ENTE_PG_DSN="postgres://${MUSEUM_DB_USER}:${MUSEUM_DB_PASSWORD}@${MUSEUM_DB_HOST}:${MUSEUM_DB_PORT}/${MUSEUM_DB_NAME}?sslmode=disable" go run cmd/museum/main.go serve
|
||||||
EOF
|
EOF
|
||||||
chmod +x /tmp/run_server.sh
|
chmod +x /tmp/run_server.sh
|
||||||
|
|
||||||
@ -845,6 +833,7 @@ EOF
|
|||||||
MUSEUM_DB_USER="$MUSEUM_DB_USER" \
|
MUSEUM_DB_USER="$MUSEUM_DB_USER" \
|
||||||
MUSEUM_DB_PASSWORD="$MUSEUM_DB_PASSWORD" \
|
MUSEUM_DB_PASSWORD="$MUSEUM_DB_PASSWORD" \
|
||||||
MUSEUM_DB_NAME="$MUSEUM_DB_NAME" \
|
MUSEUM_DB_NAME="$MUSEUM_DB_NAME" \
|
||||||
|
ENTE_PG_DSN="postgres://${MUSEUM_DB_USER}:${MUSEUM_DB_PASSWORD}@${MUSEUM_DB_HOST}:${MUSEUM_DB_PORT}/${MUSEUM_DB_NAME}?sslmode=disable" \
|
||||||
ENTE_LOG_LEVEL=debug \
|
ENTE_LOG_LEVEL=debug \
|
||||||
bash /tmp/run_server.sh > /app/data/logs/museum.log 2>&1 &
|
bash /tmp/run_server.sh > /app/data/logs/museum.log 2>&1 &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user