Merge pull request #47 from meienberger/release/0.1.4

Release/0.1.4
This commit is contained in:
Nicolas Meienberger 2022-05-18 21:59:22 +02:00 committed by GitHub
commit 34c9ced75a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 382 additions and 184 deletions

View file

@ -1,53 +0,0 @@
name: Docker build
on:
push:
branches:
- 'master'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Get tag from VERSION file
id: meta
run: |
VERSION=$(cat VERSION)
TAG=${VERSION}
echo "::set-output name=tag::${TAG}"
-
name: Build and push dashboard
uses: docker/build-push-action@v2
with:
context: ./packages/dashboard
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/tipi-dashboard:latest,meienberger/tipi-dashboard:${{ steps.meta.outputs.TAG }}
cache-from: type=registry,ref=meienberger/tipi-dashboard:latest
cache-to: type=inline
-
name: Build and push api
uses: docker/build-push-action@v2
with:
context: ./packages/system-api
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/tipi-api:latest,meienberger/tipi-api:${{ steps.meta.outputs.TAG }}
cache-from: type=registry,ref=meienberger/tipi-api:latest
cache-to: type=inline

View file

@ -47,4 +47,3 @@ jobs:
- name: Run tests
run: pnpm -r test

98
.github/workflows/release-candidate.yml vendored Normal file
View file

@ -0,0 +1,98 @@
name: Release candidate
on:
pull_request:
branches:
- master
jobs:
# Build images and publish RCs to DockerHub
build-images:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: technote-space/get-diff-action@v6
with:
FILES: |
VERSION
- name: Ensure env.MATCHED_FILES has VERSION in it
id: check-version
run: |
if [[ -z "${{ env.MATCHED_FILES }}" ]]; then
echo "::error::VERSION not modified"
exit 1
fi
if [[ ! "${{ env.MATCHED_FILES }}" =~ VERSION ]]; then
echo "::error::VERSION not modified"
exit 1
fi
- uses: vishnudxb/cancel-workflow@v1.2
if: failure()
with:
repo: meienberger/runtipi
workflow_id: ${{ github.run_id }}
access_token: ${{ github.token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get tag from VERSION file
id: meta
run: |
VERSION=$(cat VERSION)
TAG=${VERSION}
echo "::set-output name=tag::${TAG}"
- name: Build and push dashboard
uses: docker/build-push-action@v2
with:
context: ./packages/dashboard
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/tipi-dashboard:rc-${{ steps.meta.outputs.TAG }}
cache-from: type=registry,ref=meienberger/tipi-dashboard:latest
cache-to: type=inline
- name: Build and push api
uses: docker/build-push-action@v2
with:
context: ./packages/system-api
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/tipi-api:rc-${{ steps.meta.outputs.TAG }}
cache-from: type=registry,ref=meienberger/tipi-api:latest
cache-to: type=inline
# Test installation script
# test-install:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# - name: Check if user id 1000 exists
# run: |
# if [[ ! $(id -u 1000) -eq 1000 ]]; then
# echo "Creating user 1000"
# sudo useradd -u 1000 test
# fi
# id: check-user-id
# - name: Run install script
# run: sudo ./scripts/start.sh --rc --ci

View file

@ -1,5 +1,5 @@
name: Build & Deploy
name: Publish release
on:
push:
branches:
@ -30,3 +30,49 @@ jobs:
release_name: ${{ steps.create_tag.outputs.version }}
draft: false
prerelease: false
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Get tag from VERSION file
id: meta
run: |
VERSION=$(cat VERSION)
TAG=${VERSION}
echo "::set-output name=tag::${TAG}"
-
name: Build and push dashboard
uses: docker/build-push-action@v2
with:
context: ./packages/dashboard
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/tipi-dashboard:latest,meienberger/tipi-dashboard:${{ steps.meta.outputs.TAG }}
cache-from: type=registry,ref=meienberger/tipi-dashboard:latest
cache-to: type=inline
-
name: Build and push api
uses: docker/build-push-action@v2
with:
context: ./packages/system-api
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/tipi-api:latest,meienberger/tipi-api:${{ steps.meta.outputs.TAG }}
cache-from: type=registry,ref=meienberger/tipi-api:latest
cache-to: type=inline

View file

@ -1,33 +0,0 @@
name: Verify release
on:
pull_request:
branches:
- master
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: technote-space/get-diff-action@v6
with:
FILES: |
VERSION
- name: Ensure env.MATCHED_FILES has VERSION in it
id: check-version
run: |
if [[ -z "${{ env.MATCHED_FILES }}" ]]; then
echo "::error::VERSION not modified"
exit 1
fi
if [[ ! "${{ env.MATCHED_FILES }}" =~ VERSION ]]; then
echo "::error::VERSION not modified"
exit 1
fi

View file

@ -32,8 +32,6 @@ Tipi is a personal homeserver orchestrator. It is running docker containers unde
### Installation Requirements
- Ubuntu 18.04 LTS or higher (or Debian 10)
Make sure your User ID is `1000` (verify it by running `id -u`)
### Step 1. Download Tipi
Run this in an empty directory where you want to install Tipi.
@ -49,6 +47,11 @@ cd runtipi && sudo ./scripts/start.sh
```
The script will prompt you the ip address of the dashboard once configured.
Tipi will run by default on port 80. To select another port you can run the start script with the `--port` argument
```bash
sudo ./scripts/start.sh --port 7000
```
To stop Tipi, run the stop script.

View file

@ -1 +1 @@
0.1.3
0.1.4

View file

@ -21,11 +21,11 @@
when: lsb_release.stdout == 'Debian'
- name: Add deb repo for docker (Ubuntu)
shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
when: lsb_release.stdout == 'Ubuntu'
- name: Add deb repo for docker (Debian)
shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
when: lsb_release.stdout == 'Debian'
- name: Update packages

View file

@ -8,6 +8,10 @@
name: "{{ packages }}"
state: latest
- name: Upgrade packages
apt:
upgrade: yes
- name: Add user to root group
user:
name: "{{ username }}"
@ -26,3 +30,4 @@
user: "{{ username }}"
minute: "*/1"
job: "{{ playbook_dir }}/../scripts/system-info.sh"
ignore_errors: yes

View file

@ -8,7 +8,8 @@ services:
- PUID=1000
- PGID=1000
volumes:
- ${APP_DATA_DIR}/../..:/srv
- ${ROOT_FOLDER_HOST}/app-data:/srv/app-data
- ${ROOT_FOLDER_HOST}/media:/srv/media
- ${APP_DATA_DIR}/data/db:/database
- ${APP_DATA_DIR}/data/config:/config
networks:

60
docker-compose.rc.yml Normal file
View file

@ -0,0 +1,60 @@
version: "3.7"
services:
reverse-proxy:
container_name: reverse-proxy
image: traefik:v2.6
restart: always
ports:
- ${NGINX_PORT}:80
- ${PROXY_PORT}:8080
command: --api.insecure=true --providers.docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${PWD}/traefik:/root/.config
networks:
- tipi_main_network
api:
image: meienberger/tipi-api:rc-${TIPI_VERSION}
container_name: api
ports:
- 3001:3001
volumes:
## Docker sock
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${PWD}:/tipi
environment:
- INTERNAL_IP=${INTERNAL_IP}
- TIPI_VERSION=${TIPI_VERSION}
- JWT_SECRET=${JWT_SECRET}
- ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST}
networks:
- tipi_main_network
dashboard:
image: meienberger/tipi-dashboard:rc-${TIPI_VERSION}
container_name: dashboard
ports:
- 3000:3000
networks:
- tipi_main_network
environment:
- INTERNAL_IP=${INTERNAL_IP}
labels:
traefik.enable: true
traefik.http.routers.dashboard.rule: PathPrefix("/") # Host(`tipi.local`) &&
traefik.http.routers.dashboard.entrypoints: webinsecure
traefik.http.routers.dashboard.service: dashboard
traefik.http.services.dashboard.loadbalancer.server.port: 3000
networks:
tipi_main_network:
driver: bridge
driver_opts:
com.docker.network.bridge.enable_ip_masquerade: "true"
com.docker.network.bridge.enable_icc: "true"
ipam:
driver: default
config:
- subnet: 10.21.21.0/24

View file

@ -6,8 +6,8 @@ services:
image: traefik:v2.6
restart: always
ports:
- 80:80
- 8080:8080
- ${NGINX_PORT}:80
- ${PROXY_PORT}:8080
command: --api.insecure=true --providers.docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
@ -15,7 +15,6 @@ services:
networks:
- tipi_main_network
api:
image: meienberger/tipi-api:${TIPI_VERSION}
container_name: api
@ -30,6 +29,7 @@ services:
- TIPI_VERSION=${TIPI_VERSION}
- JWT_SECRET=${JWT_SECRET}
- ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST}
- NGINX_PORT=${NGINX_PORT}
networks:
- tipi_main_network

View file

@ -1,12 +1,13 @@
{
"name": "runtipi",
"version": "0.1.3",
"version": "0.1.4",
"description": "A homeserver for everyone",
"scripts": {
"prepare": "husky install",
"act:test-install": "act --container-architecture linux/amd64 -j test-install",
"act:docker": "act --container-architecture linux/amd64 --secret-file github.secrets -j docker",
"start:dev": "docker-compose -f docker-compose.dev.yml --env-file .env.dev up --build",
"start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
"start:prod": "docker-compose --env-file .env up --build"
},
"dependencies": {},

View file

@ -1,6 +1,6 @@
module.exports = {
singleQuote: true,
semi: true,
trailingComma: "all",
trailingComma: 'all',
printWidth: 200,
};

View file

@ -1,13 +1,13 @@
FROM node:18
FROM node:18-buster-slim
WORKDIR /app
COPY ./package.json ./
RUN yarn
RUN npm install
COPY ./ ./
RUN yarn build
RUN npm run build
CMD ["yarn", "start"]
CMD ["npm", "run", "start"]

View file

@ -1,4 +1,4 @@
FROM node:latest
FROM node:18-buster-slim
WORKDIR /app

View file

@ -1,6 +1,6 @@
{
"name": "dashboard",
"version": "0.1.3",
"version": "0.1.4",
"private": true,
"scripts": {
"dev": "next dev",

View file

@ -1,6 +1,6 @@
{
"name": "system-api",
"version": "0.1.3",
"version": "0.1.4",
"description": "",
"exports": "./dist/server.js",
"type": "module",

View file

@ -11,13 +11,13 @@ interface IConfig {
dotenv.config();
const { NODE_ENV = 'development', JWT_SECRET = '', INTERNAL_IP = '', TIPI_VERSION = '', ROOT_FOLDER_HOST = '' } = process.env;
const { NODE_ENV = 'development', JWT_SECRET = '', INTERNAL_IP = '', TIPI_VERSION = '', ROOT_FOLDER_HOST = '', NGINX_PORT = '80' } = process.env;
const config: IConfig = {
NODE_ENV,
ROOT_FOLDER: '/tipi',
JWT_SECRET,
CLIENT_URLS: ['http://localhost:3000', `http://${INTERNAL_IP}`, `http://${INTERNAL_IP}:3000`],
CLIENT_URLS: ['http://localhost:3000', `http://${INTERNAL_IP}`, `http://${INTERNAL_IP}:${NGINX_PORT}`, `http://${INTERNAL_IP}:3000`],
VERSION: TIPI_VERSION,
ROOT_FOLDER_HOST,
};

View file

@ -75,7 +75,9 @@ const getVersion = async (_: Request, res: Response<{ current: string; latest: s
version = json.name.replace('v', '');
}
res.status(200).send({ current: config.VERSION, latest: version });
TipiCache.set('latestVersion', version.replace('v', ''));
res.status(200).send({ current: config.VERSION, latest: version.replace('v', '') });
};
export default { getCpuInfo, getDiskInfo, getMemoryInfo, getVersion };

View file

@ -12,7 +12,7 @@ ROOT_FOLDER="$($rdlk -f $(dirname "${BASH_SOURCE[0]}")/..)"
STATE_FOLDER="${ROOT_FOLDER}/state"
show_help() {
cat << EOF
cat <<EOF
app 0.0.1
CLI for managing Tipi apps
@ -31,10 +31,10 @@ EOF
# Get field from json file
function get_json_field() {
local json_file="$1"
local field="$2"
local json_file="$1"
local field="$2"
echo $(jq -r ".${field}" "${json_file}")
echo $(jq -r ".${field}" "${json_file}")
}
list_installed_apps() {

View file

@ -1,8 +1,7 @@
#!/usr/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status.
set -e # Exit immediately if a command exits with a non-zero status.
ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
USERNAME="$(id -nu 1000)"
echo
echo "======================================"
@ -15,19 +14,39 @@ echo "=============== TIPI ================="
echo "======================================"
echo
# Install ansible if not installed
if ! command -v ansible-playbook > /dev/null; then
echo "Installing Ansible..."
sudo apt-get update
sudo apt-get install python3 python3-pip -y
sudo pip3 install ansible
sudo apt-get update
sudo apt-get install -y jq coreutils ca-certificates curl gnupg lsb-release
LSB="$(lsb_release -is)"
# Add docker gpg key (Debian)
if [[ "${LSB}" == "Debian" ]]; then
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
fi
ansible-playbook ansible/setup.yml -i ansible/hosts -K -e username="$USERNAME"
# Add docker gpg key (Ubuntu)
if [[ "${LSB}" == "Ubuntu" ]]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
fi
# echo "Configuring permissions..."
# echo
# find "$ROOT_FOLDER" -path "$ROOT_FOLDER/app-data" -prune -o -exec chown 1000:1000 {} + || true
# Add deb repo for docker (Debian)
if [[ "${LSB}" == "Debian" ]]; then
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
fi
# Add deb repo for docker (Ubuntu)
if [[ "${LSB}" == "Ubuntu" ]]; then
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
fi
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Install docker compose if not here
if ! command -v docker-compose >/dev/null; then
sudo curl -L "https://github.com/docker/compose/releases/download/v2.3.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
# Create configured status
touch "${ROOT_FOLDER}/state/configured"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status.
set -e # Exit immediately if a command exits with a non-zero status.
# use greadlink instead of readlink on osx
if [[ "$(uname)" == "Darwin" ]]; then
@ -8,23 +8,66 @@ else
readlink=readlink
fi
NGINX_PORT=80
PROXY_PORT=8080
while [ -n "$1" ]; do # while loop starts
case "$1" in
--rc) rc="true" ;;
--ci) ci="true" ;;
--port)
port="$2"
if [[ "${port}" =~ ^[0-9]+$ ]]; then
NGINX_PORT="${port}"
else
echo "--port must be a number"
exit 1
fi
shift
;;
--proxy-port)
proxy_port="$2"
if [[ "${proxy_port}" =~ ^[0-9]+$ ]]; then
PROXY_PORT="${proxy_port}"
else
echo "--proxy-port must be a number"
exit 1
fi
shift
;;
--)
shift # The double dash makes them parameters
break
;;
*) echo "Option $1 not recognized" && exit 1 ;;
esac
shift
done
# Check we are on linux
if [[ "$(uname)" != "Linux" ]]; then
echo "Tipi only works on Linux"
exit 1
fi
ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
STATE_FOLDER="${ROOT_FOLDER}/state"
SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
INTERNAL_IP="$(hostname -I | awk '{print $1}')"
DNS_IP=9.9.9.9 # Default to Quad9 DNS
USERNAME="$(id -nu 1000)"
ARCHITECTURE="$(uname -m)"
if [[ "$architecture" == "aarch64" ]]; then
if [[ "$ARCHITECTURE" == "aarch64" ]]; then
ARCHITECTURE="arm64"
fi
if [[ $UID != 0 ]]; then
echo "Tipi must be started as root"
echo "Please re-run this script as"
echo " sudo ./scripts/start"
exit 1
echo "Tipi must be started as root"
echo "Please re-run this script as"
echo " sudo ./scripts/start"
exit 1
fi
# Configure Tipi if it isn't already configured
@ -34,10 +77,10 @@ fi
# Get field from json file
function get_json_field() {
local json_file="$1"
local field="$2"
local json_file="$1"
local field="$2"
echo $(jq -r ".${field}" "${json_file}")
echo $(jq -r ".${field}" "${json_file}")
}
# Deterministically derives 128 bits of cryptographically secure entropy
@ -47,7 +90,7 @@ function derive_entropy() {
tipi_seed=$(cat "${SEED_FILE}") || true
if [[ -z "$tipi_seed" ]] || [[ -z "$identifier" ]]; then
>&2 echo "Missing derivation parameter, this is unsafe, exiting."
echo >&2 "Missing derivation parameter, this is unsafe, exiting."
exit 1
fi
@ -69,8 +112,10 @@ if [[ ! -f "${STATE_FOLDER}/users.json" ]]; then
cp "${ROOT_FOLDER}/templates/users-sample.json" "${STATE_FOLDER}/users.json"
fi
chown -R 1000:1000 "${STATE_FOLDER}/apps.json"
chown -R 1000:1000 "${STATE_FOLDER}/users.json"
# Get current dns from host
if [[ -f "/etc/resolv.conf" ]]; then
TEMP=$(cat /etc/resolv.conf | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -n 1)
fi
# Get dns ip if pihole is installed
str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
@ -83,7 +128,7 @@ fi
# Create seed file with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
echo "Generating seed..."
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 > "${STATE_FOLDER}/seed"
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 >"${STATE_FOLDER}/seed"
fi
export DOCKER_CLIENT_TIMEOUT=240
@ -112,7 +157,8 @@ for template in "${ENV_FILE}"; do
sed -i "s/<root_folder>/${SED_ROOT_FOLDER}/g" "${template}"
sed -i "s/<tipi_version>/$(cat "${ROOT_FOLDER}/VERSION")/g" "${template}"
sed -i "s/<architecture>/${ARCHITECTURE}/g" "${template}"
sed -i "s/<nginx_port>/${NGINX_PORT}/g" "${template}"
sed -i "s/<proxy_port>/${PROXY_PORT}/g" "${template}"
done
mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
@ -121,28 +167,29 @@ mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
echo "Running system-info.sh..."
bash "${ROOT_FOLDER}/scripts/system-info.sh"
# ansible-playbook ansible/start.yml -i ansible/hosts -K -e username="$USERNAME"
## Don't run if config-only
if [[ ! $ci == "true" ]]; then
docker-compose --env-file "${ROOT_FOLDER}/.env" pull
# Run docker-compose
docker-compose --env-file "${ROOT_FOLDER}/.env" up --detach --remove-orphans --build || {
echo "Failed to start containers"
exit 1
}
# str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
# apps_to_start=($str)
# for app in "${apps_to_start[@]}"; do
# "${ROOT_FOLDER}/scripts/app.sh" start $app
# done
# Give permissions 1000:1000 to app data
chown -R 1000:1000 "${ROOT_FOLDER}/app-data"
if [[ $rc == "true" ]]; then
docker-compose -f docker-compose.rc.yml --env-file "${ROOT_FOLDER}/.env" pull
# Run docker-compose
docker-compose -f docker-compose.rc.yml --env-file "${ROOT_FOLDER}/.env" up --detach --remove-orphans --build || {
echo "Failed to start containers"
exit 1
}
else
docker-compose --env-file "${ROOT_FOLDER}/.env" pull
# Run docker-compose
docker-compose --env-file "${ROOT_FOLDER}/.env" up --detach --remove-orphans --build || {
echo "Failed to start containers"
exit 1
}
fi
fi
echo "Tipi is now running"
echo ""
cat << "EOF"
cat <<"EOF"
_,.
,` -.)
'( _/'-\\-.
@ -164,8 +211,12 @@ cat << "EOF"
| {__)
()`
EOF
echo ""
echo "Visit http://${INTERNAL_IP}/ to view the dashboard"
echo ""
port_display=""
if [[ $NGINX_PORT != "80" ]]; then
port_display=":${NGINX_PORT}"
fi
echo ""
echo "Visit http://${INTERNAL_IP}${port_display}/ to view the dashboard"
echo ""

View file

@ -8,12 +8,11 @@ else
readlink=readlink
fi
if [[ $UID != 0 ]]; then
echo "Tipi must be stopped as root"
echo "Please re-run this script as"
echo " sudo ./scripts/stop"
exit 1
echo "Tipi must be stopped as root"
echo "Please re-run this script as"
echo " sudo ./scripts/stop"
exit 1
fi
ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
@ -21,16 +20,14 @@ STATE_FOLDER="${ROOT_FOLDER}/state"
cd "$ROOT_FOLDER"
ansible-playbook ansible/stop.yml -i ansible/hosts -e username="$USER"
export DOCKER_CLIENT_TIMEOUT=240
export COMPOSE_HTTP_TIMEOUT=240
function get_json_field() {
local json_file="$1"
local field="$2"
local json_file="$1"
local field="$2"
echo $(jq -r ".${field}" "${json_file}")
echo $(jq -r ".${field}" "${json_file}")
}
str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
@ -38,9 +35,9 @@ apps_to_start=($str)
# If apps_to_start is not empty, then we're stopping all apps
if [[ ${#apps_to_start[@]} -gt 0 ]]; then
for app in "${apps_to_start[@]}"; do
"${ROOT_FOLDER}/scripts/app.sh" stop $app
done
for app in "${apps_to_start[@]}"; do
"${ROOT_FOLDER}/scripts/app.sh" stop $app
done
fi
echo "Stopping Docker services..."

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status.
set -e # Exit immediately if a command exits with a non-zero status.
ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
STATE_FOLDER="${ROOT_FOLDER}/state"
@ -19,7 +19,7 @@ MEM_USED_BYTES=$(($MEM_TOTAL_BYTES - $MEM_AVAILABLE_BYTES))
# Create temporary json file
TEMP_JSON_FILE=$(mktemp)
echo '{ "cpu": { "load": '"${CPU_LOAD_PERCENTAGE}"' }, "memory": { "total": '"${MEM_TOTAL_BYTES}"' , "used": '"${MEM_USED_BYTES}"', "available": '"${MEM_AVAILABLE_BYTES}"' }, "disk": { "total": '"${TOTAL_DISK_SPACE_BYTES}"' , "used": '"${USED_DISK_SPACE_BYTES}"', "available": '"${AVAILABLE_DISK_SPACE_BYTES}"' } }' > "${TEMP_JSON_FILE}"
echo '{ "cpu": { "load": '"${CPU_LOAD_PERCENTAGE}"' }, "memory": { "total": '"${MEM_TOTAL_BYTES}"' , "used": '"${MEM_USED_BYTES}"', "available": '"${MEM_AVAILABLE_BYTES}"' }, "disk": { "total": '"${TOTAL_DISK_SPACE_BYTES}"' , "used": '"${USED_DISK_SPACE_BYTES}"', "available": '"${AVAILABLE_DISK_SPACE_BYTES}"' } }' >"${TEMP_JSON_FILE}"
# Write to state file
echo "$(cat "${TEMP_JSON_FILE}")" > "${STATE_FOLDER}/system-info.json"
echo "$(cat "${TEMP_JSON_FILE}")" >"${STATE_FOLDER}/system-info.json"

View file

@ -10,3 +10,5 @@ ARCHITECTURE=<architecture>
TIPI_VERSION=<tipi_version>
JWT_SECRET=<jwt_secret>
ROOT_FOLDER_HOST=<root_folder>
NGINX_PORT=<nginx_port>
PROXY_PORT=<proxy_port>