refactor: remove authentication for internal deployment
Verify and deploy production / verify-and-deploy (push) Successful in 2m33s
Verify and deploy production / verify-and-deploy (push) Successful in 2m33s
This commit is contained in:
+2
-13
@@ -39,17 +39,10 @@ jobs:
|
||||
- name: Deploy persistent production service
|
||||
if: gitea.event_name == 'workflow_dispatch' || (gitea.event_name == 'push' && gitea.ref == 'refs/heads/main')
|
||||
env:
|
||||
STUDIO_USERNAME: studio
|
||||
STUDIO_PASSWORD: ${{ secrets.STUDIO_PASSWORD }}
|
||||
DEPLOY_PORT: ${{ vars.DEPLOY_PORT }}
|
||||
RELEASE_SHA: ${{ gitea.sha }}
|
||||
run: |
|
||||
set -eu
|
||||
if [ -z "$STUDIO_PASSWORD" ]; then
|
||||
echo "STUDIO_PASSWORD repository secret is required for production deployment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
SUDO=""
|
||||
elif sudo -n true 2>/dev/null; then
|
||||
@@ -79,10 +72,7 @@ jobs:
|
||||
$SUDO chown -R root:root "$APP_ROOT"
|
||||
$SUDO chown -R "$SERVICE_USER:$SERVICE_USER" "$DATA_ROOT"
|
||||
$SUDO ln -sfn "$RELEASE_DIR" "$APP_ROOT/current"
|
||||
|
||||
printf '%s' "$STUDIO_PASSWORD" | $SUDO tee /etc/rednote-tool-studio.password >/dev/null
|
||||
$SUDO chown root:"$SERVICE_USER" /etc/rednote-tool-studio.password
|
||||
$SUDO chmod 640 /etc/rednote-tool-studio.password
|
||||
$SUDO rm -f /etc/rednote-tool-studio.password
|
||||
|
||||
cat > rednote-tool-studio.service <<EOF
|
||||
[Unit]
|
||||
@@ -98,8 +88,7 @@ jobs:
|
||||
Environment=NODE_ENV=production
|
||||
Environment=HOSTNAME=0.0.0.0
|
||||
Environment=PORT=$PORT
|
||||
Environment=STUDIO_USERNAME=$STUDIO_USERNAME
|
||||
ExecStart=/bin/sh -c 'export STUDIO_PASSWORD="\$(cat /etc/rednote-tool-studio.password)"; exec $APP_ROOT/bin/node server.js'
|
||||
ExecStart=$APP_ROOT/bin/node server.js
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user