feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -18,10 +18,13 @@ run_remote_migrations=1
run_db_sync=0
run_meilisearch_setup=0
auto_detect_meilisearch=1
deploy_mode="normal"
db_sync_source=""
legacy_db_sync_mode=0
force_db_sync=0
skip_maintenance=0
full_upgrade_pre_hook="${FULL_UPGRADE_PRE_HOOK:-}"
full_upgrade_post_hook="${FULL_UPGRADE_POST_HOOK:-}"
db_sync_confirm_target="${DB_SYNC_CONFIRM_TARGET:-}"
db_sync_confirm_phrase="${DB_SYNC_CONFIRM_PHRASE:-}"
meilisearch_models_csv=""
@@ -32,6 +35,9 @@ usage() {
Usage: bash sync.sh [options]
Options:
--mode=normal|full-upgrade
Choose the deploy mode. Default: normal.
--full-upgrade Alias for --mode=full-upgrade.
--skip-build Skip local npm build before rsync.
--skip-migrate Skip php artisan migrate on the server.
--with-db-from=local Replace the production database with a dump from the local database.
@@ -43,15 +49,33 @@ Options:
--force-db-sync Legacy extra confirmation flag for --with-db.
--with-meilisearch Force Meilisearch settings sync and reimport all searchable models.
--skip-meilisearch Skip Meilisearch refresh, including auto-detected refreshes.
--upgrade-pre-hook CMD
Run a remote shell command before Composer/migrations in full-upgrade mode.
--upgrade-post-hook CMD
Run a remote shell command after the deploy completes in full-upgrade mode.
--no-maintenance Skip php artisan down/up during deploy.
--help Show this help.
Environment overrides:
LOCAL_FOLDER, REMOTE_FOLDER, REMOTE_SERVER, PHP_BIN, COMPOSER_BIN, SSH_BIN, RSYNC_BIN,
LOCAL_BUILD_COMMAND, DB_SYNC_CONFIRM_TARGET, DB_SYNC_CONFIRM_PHRASE
LOCAL_BUILD_COMMAND, DB_SYNC_CONFIRM_TARGET, DB_SYNC_CONFIRM_PHRASE,
FULL_UPGRADE_PRE_HOOK, FULL_UPGRADE_POST_HOOK
EOF
}
set_deploy_mode() {
case "$1" in
normal|full-upgrade)
deploy_mode="$1"
;;
*)
echo "Unsupported deploy mode: $1" >&2
echo "Allowed values: normal, full-upgrade" >&2
exit 1
;;
esac
}
confirm_database_replacement() {
local expected_phrase="replace production db from local"
local typed_target=""
@@ -130,6 +154,7 @@ build_rsync_args() {
--no-perms
--no-times
--omit-dir-times
--delay-updates
--delete
--delete-delay
--exclude ".phpintel/"
@@ -143,6 +168,7 @@ build_rsync_args() {
--exclude ".git/"
--exclude ".cursor/"
--exclude ".venv/"
--exclude "/var/php-tmp"
--exclude "/oldSite"
--exclude "/vendor"
-e "$ssh_bin"
@@ -217,6 +243,16 @@ detect_meilisearch_models_from_sync() {
while [[ $# -gt 0 ]]; do
case "$1" in
--mode)
shift
set_deploy_mode "${1:?Missing value for --mode}"
;;
--mode=*)
set_deploy_mode "${1#*=}"
;;
--full-upgrade)
deploy_mode="full-upgrade"
;;
--skip-build)
run_local_build=0
;;
@@ -264,6 +300,20 @@ while [[ $# -gt 0 ]]; do
auto_detect_meilisearch=0
meilisearch_models_csv=""
;;
--upgrade-pre-hook)
shift
full_upgrade_pre_hook="${1:?Missing value for --upgrade-pre-hook}"
;;
--upgrade-pre-hook=*)
full_upgrade_pre_hook="${1#*=}"
;;
--upgrade-post-hook)
shift
full_upgrade_post_hook="${1:?Missing value for --upgrade-post-hook}"
;;
--upgrade-post-hook=*)
full_upgrade_post_hook="${1#*=}"
;;
--no-maintenance)
skip_maintenance=1
;;
@@ -280,6 +330,11 @@ while [[ $# -gt 0 ]]; do
shift
done
if [[ -n "$full_upgrade_pre_hook" || -n "$full_upgrade_post_hook" ]] && [[ "$deploy_mode" != "full-upgrade" ]]; then
echo "Upgrade hooks can only be used with --mode=full-upgrade." >&2
exit 1
fi
if [[ "$run_db_sync" -eq 1 && "$db_sync_source" != "local" ]]; then
echo "Refusing DB sync without an explicit source. Use --with-db-from=local." >&2
exit 1
@@ -299,6 +354,12 @@ if [[ "$run_db_sync" -eq 1 ]]; then
confirm_database_replacement
fi
if [[ "$deploy_mode" == "full-upgrade" && "$auto_detect_meilisearch" -eq 1 && "$run_meilisearch_setup" -eq 0 ]]; then
run_meilisearch_setup=1
auto_detect_meilisearch=0
meilisearch_models_csv="$all_meilisearch_models_csv"
fi
if [[ "$run_local_build" -eq 1 ]]; then
echo "Building frontend assets locally..."
run_frontend_build
@@ -332,7 +393,10 @@ echo "Running remote Composer and Artisan steps..."
COMPOSER_BIN="$(printf '%q' "$composer_bin")" \
RUN_REMOTE_MIGRATIONS="$run_remote_migrations" \
SKIP_MAINTENANCE="$skip_maintenance" \
DEPLOY_MODE="$(printf '%q' "$deploy_mode")" \
RUN_MEILISEARCH_SETUP="$run_meilisearch_setup" \
FULL_UPGRADE_PRE_HOOK="$(printf '%q' "$full_upgrade_pre_hook")" \
FULL_UPGRADE_POST_HOOK="$(printf '%q' "$full_upgrade_post_hook")" \
MEILISEARCH_MODELS_CSV="$(printf '%q' "$meilisearch_models_csv")" \
'bash -s' <<'EOF'
set -euo pipefail
@@ -341,21 +405,29 @@ cd "$REMOTE_FOLDER"
ensure_php_runtime_dir() {
local target_dir="$1"
local -a privileged_cmd=()
if command -v sudo >/dev/null 2>&1; then
if [[ ! -d "$target_dir" ]]; then
mkdir -p "$target_dir"
fi
chown -R skinbase:skinbase "$target_dir"
chmod 770 "$target_dir"
return
if command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
privileged_cmd=(sudo -n)
elif [[ "$(id -u)" -eq 0 ]]; then
privileged_cmd=()
fi
if [[ ! -d "$target_dir" ]]; then
mkdir -p "$target_dir"
if [[ ${#privileged_cmd[@]} -gt 0 ]]; then
"${privileged_cmd[@]}" mkdir -p "$target_dir"
else
mkdir -p "$target_dir"
fi
fi
chown -R skinbase:skinbase "$target_dir"
chmod 770 "$target_dir"
if [[ ${#privileged_cmd[@]} -gt 0 || "$(id -u)" -eq 0 ]]; then
"${privileged_cmd[@]}" chown -R skinbase:skinbase "$target_dir"
"${privileged_cmd[@]}" chmod 770 "$target_dir"
return
fi
chmod 770 "$target_dir" >/dev/null 2>&1 || true
}
ensure_php_runtime_dir "$REMOTE_FOLDER/var/php-tmp"
@@ -367,22 +439,50 @@ bring_app_up() {
fi
}
run_remote_hook() {
local hook_name="$1"
local hook_command="$2"
[[ -n "$hook_command" ]] || return 0
echo "Running ${hook_name}..."
bash -lc "$hook_command"
}
trap bring_app_up EXIT
if [[ "$DEPLOY_MODE" == "full-upgrade" ]]; then
run_remote_hook "full-upgrade pre-hook" "${FULL_UPGRADE_PRE_HOOK:-}"
fi
"$COMPOSER_BIN" install --no-dev --prefer-dist --optimize-autoloader --no-interaction
if [[ "$SKIP_MAINTENANCE" -eq 0 ]]; then
"$PHP_BIN" artisan down --retry=60 || true
fi
"$COMPOSER_BIN" install --no-dev --prefer-dist --optimize-autoloader --no-interaction
if [[ "$RUN_REMOTE_MIGRATIONS" -eq 1 ]]; then
"$PHP_BIN" artisan migrate --force
fi
"$PHP_BIN" artisan optimize:clear
"$PHP_BIN" artisan config:cache
"$PHP_BIN" artisan view:cache
"$PHP_BIN" artisan optimize
if [[ "$SKIP_MAINTENANCE" -eq 0 ]]; then
"$PHP_BIN" artisan up
trap - EXIT
fi
if ! "$PHP_BIN" artisan homepage:warm-guest-cache; then
echo "Warning: homepage guest cache warm failed during deploy." >&2
fi
if ! "$PHP_BIN" artisan posts:warm-trending; then
echo "Warning: post trending cache warm failed during deploy." >&2
fi
"$PHP_BIN" artisan queue:restart || true
"$PHP_BIN" artisan horizon:terminate || true
if [[ "$RUN_MEILISEARCH_SETUP" -eq 1 ]]; then
if [[ -z "${MEILISEARCH_MODELS_CSV:-}" ]]; then
@@ -402,9 +502,8 @@ if [[ "$RUN_MEILISEARCH_SETUP" -eq 1 ]]; then
echo "Meilisearch setup complete."
fi
if [[ "$SKIP_MAINTENANCE" -eq 0 ]]; then
"$PHP_BIN" artisan up
trap - EXIT
if [[ "$DEPLOY_MODE" == "full-upgrade" ]]; then
run_remote_hook "full-upgrade post-hook" "${FULL_UPGRADE_POST_HOOK:-}"
fi
EOF