Интернет-магазин: Go, PostgreSQL 17 SSL, Caddy, Docker Compose
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
DIR="${1:-/certs}"
|
||||
CRT="$DIR/server.crt"
|
||||
KEY="$DIR/server.key"
|
||||
|
||||
if [ -f "$CRT" ] && [ -f "$KEY" ]; then
|
||||
echo "SSL certificates already exist in $DIR"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "$DIR"
|
||||
|
||||
openssl req -new -x509 -days 825 -nodes -text \
|
||||
-out "$CRT" \
|
||||
-keyout "$KEY" \
|
||||
-subj "/CN=postgres.shop.local"
|
||||
|
||||
chmod 600 "$KEY"
|
||||
chmod 644 "$CRT"
|
||||
|
||||
# postgres image runs as uid 999
|
||||
chown 999:999 "$KEY" "$CRT" 2>/dev/null || true
|
||||
|
||||
echo "Generated PostgreSQL SSL certificates in $DIR"
|
||||
Reference in New Issue
Block a user