修改安装脚本

This commit is contained in:
flowshadow
2025-10-17 01:13:24 +08:00
parent 8dfa6029ac
commit e71b7dee69
2 changed files with 36 additions and 53 deletions

View File

@@ -36,35 +36,36 @@ create-shokku-app() {
echo "=> pulling image (version: $SHOKKU_VERSION)"
HOST_SSH_PORT=$(grep "Port " /etc/ssh/sshd_config | awk '{ print $2 }')
docker pull "$SHOKKU_IMAGE" &>/dev/null
docker pull "$SHOKKU_IMAGE"
SHOKKU_IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "$SHOKKU_IMAGE")
echo "=> creating & configuring dokku app"
dokku apps:create shokku &>/dev/null
dokku apps:create shokku
dokku docker-options:add shokku deploy \
"--add-host=host.docker.internal:host-gateway" &>/dev/null
"--add-host=host.docker.internal:host-gateway"
dokku config:set shokku \
DOKKU_SSH_HOST='host.docker.internal' \
DOKKU_SSH_PORT="$HOST_SSH_PORT" &>/dev/null
DOKKU_SSH_PORT="$HOST_SSH_PORT"
echo "==> creating storage"
dokku storage:ensure-directory shokku --chown false &>/dev/null
dokku storage:mount shokku "$SHOKKU_APP_DATA_MOUNT_PATH" &>/dev/null
chown -R "$DISTROLESS_NONROOT_UID":"$DISTROLESS_NONROOT_UID" "$SHOKKU_DATA_DIR" &>/dev/null
dokku storage:ensure-directory shokku --chown false
dokku storage:mount shokku "$SHOKKU_APP_DATA_MOUNT_PATH"
chown -R "$DISTROLESS_NONROOT_UID":"$DISTROLESS_NONROOT_UID" "$SHOKKU_DATA_DIR"
echo "==> bootstrapping"
dokku config:set shokku DOKKU_SKIP_DEPLOY=true &>/dev/null
dokku git:from-image shokku "$SHOKKU_IMAGE_DIGEST" &>/dev/null
dokku config:set shokku DOKKU_SKIP_DEPLOY=true
dokku git:from-image shokku "$SHOKKU_IMAGE_DIGEST"
shokku_ssh_key=$(dokku run shokku bootstrap) &>/dev/null
echo "$shokku_ssh_key" | dokku ssh-keys:add "$SHOKKU_DOKKU_USER" &>/dev/null
shokku_ssh_key=$(dokku run shokku bootstrap)
echo "$shokku_ssh_key" | dokku ssh-keys:add "$SHOKKU_DOKKU_USER"
echo "==> deploying"
dokku config:unset shokku DOKKU_SKIP_DEPLOY &>/dev/null
dokku config:unset shokku DOKKU_SKIP_DEPLOY
if [ -z "$SHOKKU_CERT" ]; then
echo "==> enabling letsencrypt"
dokku letsencrypt:enable shokku &>/dev/null
dokku letsencrypt:set shokku email ssl@ssl.com
dokku letsencrypt:enable shokku
else
echo "==> adding certificate from SHOKKU_CERT"
dokku certs:add shokku < "$SHOKKU_CERT"
@@ -92,7 +93,7 @@ main() {
for plugin in redis postgres mongo mysql; do
if ! dokku plugin:installed $plugin; then
echo "=> Installing plugin $plugin"
dokku plugin:install https://git.shusou.com/dokku/dokku-$plugin.git $plugin &>/dev/null
dokku plugin:install https://git.shusou.com/dokku/dokku-$plugin.git $plugin
fi
done