fix image, format bootstrap

This commit is contained in:
texm
2023-05-13 13:29:32 +08:00
parent ebc969a351
commit 0d5b289a2c
3 changed files with 29 additions and 27 deletions

View File

@@ -18,14 +18,14 @@ DISTROLESS_NONROOT_UID="65532"
clean-shokku() {
echo "=> checking for existing resources"
if dokku apps:exists shokku &> /dev/null; then
if dokku apps:exists shokku &>/dev/null; then
echo "==> destroying old dokku app"
dokku apps:destroy --force shokku &> /dev/null
dokku apps:destroy --force shokku &>/dev/null
fi
if dokku ssh-keys:list "$SHOKKU_DOKKU_USER" &> /dev/null; then
if dokku ssh-keys:list "$SHOKKU_DOKKU_USER" &>/dev/null; then
echo "==> removing existing dokku ssh key"
dokku ssh-keys:remove $SHOKKU_DOKKU_USER;
dokku ssh-keys:remove $SHOKKU_DOKKU_USER
fi
echo "==> done"
@@ -36,56 +36,56 @@ 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" &>/dev/null
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 &>/dev/null
dokku docker-options:add shokku deploy \
"--add-host=host.docker.internal:host-gateway" &> /dev/null
"--add-host=host.docker.internal:host-gateway" &>/dev/null
dokku config:set shokku \
DOKKU_SSH_HOST='host.docker.internal' \
DOKKU_SSH_PORT="$HOST_SSH_PORT" &> /dev/null
DOKKU_SSH_PORT="$HOST_SSH_PORT" &>/dev/null
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 &>/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
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 &>/dev/null
dokku git:from-image shokku "$SHOKKU_IMAGE_DIGEST" &>/dev/null
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) &>/dev/null
echo "$shokku_ssh_key" | dokku ssh-keys:add "$SHOKKU_DOKKU_USER" &>/dev/null
echo "==> deploying"
dokku config:unset shokku DOKKU_SKIP_DEPLOY &> /dev/null
dokku config:unset shokku DOKKU_SKIP_DEPLOY &>/dev/null
echo "==> enabling letsencrypt"
dokku letsencrypt:enable shokku &> /dev/null
dokku letsencrypt:enable shokku &>/dev/null
}
main() {
if [[ "$(id -u)" != "0" ]]; then
echo "This script must be run as root" 1>&2
exit 1
echo "This script must be run as root" 1>&2
exit 1
fi
if ! command -v dokku &> /dev/null; then
echo "Please install dokku first using the instructions at https://dokku.com" 1>&2
exit
if ! command -v dokku &>/dev/null; then
echo "Please install dokku first using the instructions at https://dokku.com" 1>&2
exit 1
fi
if ! dokku plugin:installed letsencrypt; then
echo "Please setup letsencrypt using the instructions at https://dokku.com/docs/deployment/application-deployment/#setting-up-ssl" 1>&2
exit
exit 1
fi
for plugin in redis postgres mongo mysql; do
if ! dokku plugin:installed $plugin; then
echo "=> Installing plugin $plugin"
dokku plugin:install https://github.com/dokku/dokku-$plugin.git $plugin &> /dev/null
dokku plugin:install https://github.com/dokku/dokku-$plugin.git $plugin &>/dev/null
fi
done
@@ -94,6 +94,7 @@ main() {
shokku_app_domain=$(dokku domains:report shokku --domains-app-vhosts)
shokku_setup_key=$(dokku logs -q shokku | grep setup_key | jq ".setup_key")
echo "---"
echo "=> shokku installed and running "
echo "--- proceed with setup using key $shokku_setup_key at https://$shokku_app_domain ---"
}

View File

@@ -1,11 +1,12 @@
<script>
export let title = "";
const cardImgUrl = "https://shokku.dev/images/share-card.png"
</script>
<meta property="og:title" content={title}>
<meta property="og:type" content="website" />
<meta property="og:image" content="https://shokku.dev/share-card.png">
<meta name="twitter:card" content="https://shokku.dev/share-card.png">
<meta property="og:image" content={cardImgUrl}>
<meta name="twitter:card" content={cardImgUrl}>
<meta property="og:description" content="Free and open source interface for the Dokku PaaS">
<meta name="twitter:image:alt" content="Shokku Logo">

View File

@@ -3,7 +3,7 @@
const scriptInstallCommands = [
`wget "${bootstrapLink}"`,
`export SHOKKU_LETSENCRYPT_EMAIL="foo@example.com"`,
`sudo bash install.sh`,
`bash install.sh`,
];
</script>