
* fix: create default media folder structure on install * feat: add link to open exposed app to domain * [ImgBot] Optimize images *Total -- 2,048.42kb -> 1,263.43kb (38.32%) /screenshots/darkmode.png -- 998.43kb -> 609.77kb (38.93%) /screenshots/appstore.png -- 1,006.73kb -> 620.12kb (38.4%) /packages/dashboard/public/error.png -- 42.38kb -> 32.70kb (22.84%) /packages/dashboard/public/empty.svg -- 0.87kb -> 0.85kb (2.35%) Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com> * chore: bump version 0.8.1 * refactor: move all dashboard's files into a client folder * feat: setup trpc and create system router * test: split jest config for client and server * refactor: replace grapqhl queries with trpc in the frontend * refactor: remove now un-used system queries/mutations/resolvers from both client and server * chore: bump dependencies * feat: setup prisma and configure it for tests and development * feat: create trpc router for auth service * refactor: migrate client auth queries to trpc procedures * refactor: cleanup now un-used graphql resolvers and services * feat: create sql migrations by replicating typeorm ones in an idempotent manner * feat: create server-preload script to run migrations upon server start * chore: remove legacy migrations steps * feat: add redis_host as an env variable * refactor: remove prisma from context and use client directly in service * feat: create trpc router & service for apps * refactor: migrate client app queries/mutations to trpc * refactor: removal and replace usage of old graphql generated types * refactor: move from node --require to custom next server * test: fix tests and bump various dependencies * chore: cleanup system-api from now un-used files * refactor(dashboard): remove code related to apollo * refactor: serve static files through next's server instead of system-api * refactor(server): move auth and system services to class * refactor(client): remove layoutv2 abstraction * fix: return correct update info * chore: remove legacy system-api folder * refactor: remove system-api from docker files * feat: create scheduler to run cron jobs and setup periodic repo update * fix: failing build caused by remark-mdx * refactor: move migrations to server folder * feat: compile server using esbuild * refactor: ts issue mis-used file from client in server * ci: make pipeline pass by cd into dashboard before each step (temp) * chore: drop armv7 support * refactor: move dashboard files in root folder * feat(db): create migration to add operator field on user * feat(user): create routes and services for password reset * feat(auth): add reset password page, container & form * refactor(dashboard): change layout and page of auth to be url based instead of state based * feat(script): add reset-password script * fix(dashboard): only check status if restart or update has been requested * test: increase coverage for get-server-auth-session * fix(start.sh): prompt for network interface only if there is not an internal ip set * feat(script): support user docker-compose.yml and app.env * chore: bump version * fix: add missing postgres variables to start script * fix: check for 32 bits before installing/starting * fix: create default media folder structure on install * Updated demo instance link Changed demo.runtipi.com to https://demo.runtipi.com * feat: adding config for codespaces * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com> Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com> Co-authored-by: Freddie Sackur <github@dustyfox.uk> Co-authored-by: Kieran Klukas <92754843+kcoderhtml@users.noreply.github.com> Co-authored-by: alwerner <alexander.werner@bonprix.net> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
126 lines
4.7 KiB
Bash
Executable file
126 lines
4.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
if [[ "${TRACE-0}" == "1" ]]; then
|
|
set -o xtrace
|
|
fi
|
|
|
|
source "${BASH_SOURCE%/*}/common.sh"
|
|
|
|
clean_logs
|
|
|
|
### --------------------------------
|
|
### General variables
|
|
### --------------------------------
|
|
ROOT_FOLDER="${PWD}"
|
|
STATE_FOLDER="${ROOT_FOLDER}/state"
|
|
SED_ROOT_FOLDER="$(echo "$ROOT_FOLDER" | sed 's/\//\\\//g')"
|
|
NGINX_PORT=3000
|
|
NGINX_PORT_SSL=443
|
|
DOMAIN=tipi.localhost
|
|
DNS_IP="9.9.9.9" # Default to Quad9 DNS
|
|
ARCHITECTURE="$(uname -m)"
|
|
TZ="UTC"
|
|
JWT_SECRET=secret
|
|
POSTGRES_PASSWORD=postgres
|
|
POSTGRES_USERNAME=tipi
|
|
POSTGRES_DBNAME=tipi
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_HOST=tipi-db
|
|
REDIS_HOST=tipi-redis
|
|
TIPI_VERSION=$(get_json_field "${ROOT_FOLDER}/package.json" version)
|
|
INTERNAL_IP=localhost
|
|
storage_path="${ROOT_FOLDER}"
|
|
STORAGE_PATH_ESCAPED="$(echo "${storage_path}" | sed 's/\//\\\//g')"
|
|
if [[ "$ARCHITECTURE" == "aarch64" ]]; then
|
|
ARCHITECTURE="arm64"
|
|
elif [[ "$ARCHITECTURE" == "armv7l" ]]; then
|
|
ARCHITECTURE="arm"
|
|
elif [[ "$ARCHITECTURE" == "x86_64" ]]; then
|
|
ARCHITECTURE="amd64"
|
|
fi
|
|
# If none of the above conditions are met, the architecture is not supported
|
|
if [[ "$ARCHITECTURE" != "arm64" ]] && [[ "$ARCHITECTURE" != "arm" ]] && [[ "$ARCHITECTURE" != "amd64" ]]; then
|
|
echo "Architecture not supported!"
|
|
exit 1
|
|
fi
|
|
|
|
### --------------------------------
|
|
### Apps repository configuration
|
|
### --------------------------------
|
|
apps_repository="https://github.com/meienberger/runtipi-appstore"
|
|
APPS_REPOSITORY_ESCAPED="$(echo ${apps_repository} | sed 's/\//\\\//g')"
|
|
REPO_ID="$("${ROOT_FOLDER}"/scripts/git.sh get_hash ${apps_repository})"
|
|
|
|
# Override configs with settings.json
|
|
if [[ -f "${STATE_FOLDER}/settings.json" ]]; then
|
|
if [[ "$(get_json_field "${STATE_FOLDER}/settings.json" appsRepoUrl)" != "null" ]]; then
|
|
apps_repository=$(get_json_field "${STATE_FOLDER}/settings.json" appsRepoUrl)
|
|
APPS_REPOSITORY_ESCAPED="$(echo "${apps_repository}" | sed 's/\//\\\//g')"
|
|
REPO_ID="$("${ROOT_FOLDER}"/scripts/git.sh get_hash "${apps_repository}")"
|
|
fi
|
|
fi
|
|
|
|
### --------------------------------
|
|
### Watcher and system-info
|
|
### --------------------------------
|
|
if [[ ! -f "${ROOT_FOLDER}/state/events" ]]; then
|
|
touch "${ROOT_FOLDER}/state/events"
|
|
fi
|
|
|
|
if [[ ! -f "${ROOT_FOLDER}/state/system-info.json" ]]; then
|
|
echo "{}" >"${ROOT_FOLDER}/state/system-info.json"
|
|
fi
|
|
|
|
chmod -R a+rwx "${ROOT_FOLDER}/state/events"
|
|
chmod -R a+rwx "${ROOT_FOLDER}/state/system-info.json"
|
|
kill_watcher
|
|
"${ROOT_FOLDER}/scripts/watcher.sh" &
|
|
|
|
### --------------------------------
|
|
### env file generation
|
|
### --------------------------------
|
|
ENV_FILE=$(mktemp)
|
|
[[ -f "${ROOT_FOLDER}/.env" ]] && rm -f "${ROOT_FOLDER}/.env"
|
|
[[ -f "$ROOT_FOLDER/templates/env-sample" ]] && cp "$ROOT_FOLDER/templates/env-sample" "$ENV_FILE"
|
|
|
|
OS=$(uname)
|
|
sed_args=(-i)
|
|
# If os is macos, use gnu sed
|
|
if [[ "$OS" == "Darwin" ]]; then
|
|
echo "Using gnu sed"
|
|
sed_args=(-i '')
|
|
fi
|
|
|
|
for template in ${ENV_FILE}; do
|
|
sed "${sed_args[@]}" "s/<dns_ip>/${DNS_IP}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<internal_ip>/${INTERNAL_IP}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<tz>/${TZ}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<jwt_secret>/${JWT_SECRET}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<root_folder>/${SED_ROOT_FOLDER}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<tipi_version>/${TIPI_VERSION}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<architecture>/${ARCHITECTURE}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<nginx_port>/${NGINX_PORT}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<nginx_port_ssl>/${NGINX_PORT_SSL}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<apps_repo_id>/${REPO_ID}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<apps_repo_url>/${APPS_REPOSITORY_ESCAPED}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<domain>/${DOMAIN}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<storage_path>/${STORAGE_PATH_ESCAPED}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<postgres_password>/${POSTGRES_PASSWORD}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<postgres_username>/${POSTGRES_USERNAME}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<postgres_dbname>/${POSTGRES_DBNAME}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<postgres_port>/${POSTGRES_PORT}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<postgres_host>/${POSTGRES_HOST}/g" "${template}"
|
|
sed "${sed_args[@]}" "s/<redis_host>/${REDIS_HOST}/g" "${template}"
|
|
done
|
|
|
|
mv -f "$ENV_FILE" "$ROOT_FOLDER/.env.dev"
|
|
cp "$ROOT_FOLDER/.env.dev" "$ROOT_FOLDER/.env"
|
|
chmod a+rwx "$ROOT_FOLDER/.env"
|
|
chmod a+rwx "${ROOT_FOLDER}/.env.dev"
|
|
|
|
### --------------------------------
|
|
### Start the project
|
|
### --------------------------------
|
|
docker compose -f docker-compose.dev.yml --env-file "${ROOT_FOLDER}/.env.dev" up --build
|