Compare commits

..

No commits in common. "e4d342c8196c541d673ebffce53eb80297c78130" and "80feaf6fa51a5a24887b833b3238e67736aa45b4" have entirely different histories.

2 changed files with 33 additions and 20 deletions

View File

@ -62,7 +62,7 @@ $STD pip3 wheel --wheel-dir=/wheels -r /opt/frigate/docker/main/requirements-whe
cp -a /opt/frigate/docker/main/rootfs/. / cp -a /opt/frigate/docker/main/rootfs/. /
export TARGETARCH="amd64" export TARGETARCH="amd64"
echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections
#wget -q -O /opt/frigate/docker/main/install_deps.sh https://raw.githubusercontent.com/blakeblackshear/frigate/dev/docker/main/install_deps.sh wget -q -O /opt/frigate/docker/main/install_deps.sh https://raw.githubusercontent.com/blakeblackshear/frigate/dev/docker/main/install_deps.sh
$STD /opt/frigate/docker/main/install_deps.sh $STD /opt/frigate/docker/main/install_deps.sh
$STD apt update $STD apt update
$STD ln -svf /usr/lib/btbn-ffmpeg/bin/ffmpeg /usr/local/bin/ffmpeg $STD ln -svf /usr/lib/btbn-ffmpeg/bin/ffmpeg /usr/local/bin/ffmpeg

View File

@ -15,7 +15,7 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \ $STD apt-get install -y \
postgresql \ postgresql \
build-essential \ build-essential \
@ -28,17 +28,34 @@ $STD apt-get install -y \
mc mc
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Node.js, pnpm & pm2" msg_info "Setting up Node.js Repository"
mkdir -p /etc/apt/keyrings mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
$STD apt-get update $STD apt-get update
msg_ok "Set up Repositories"
msg_info "Installing Node.js, pnpm & pm2"
$STD apt-get install -y nodejs $STD apt-get install -y nodejs
$STD npm install -g pnpm@9.7.1 $STD npm install -g pnpm@9.7.1
$STD npm install -g pm2 $STD npm install -g pm2
msg_ok "Installed Node.js, pnpm & pm2" msg_ok "Installed Node.js, pnpm & pm2"
msg_info "Setting up PostgreSQL"
msg_info "Setup Tianji (Patience)"
cd /opt
RELEASE=$(curl -s https://api.github.com/repos/msgbyte/tianji/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q "https://github.com/msgbyte/tianji/archive/refs/tags/v${RELEASE}.zip"
unzip -q v${RELEASE}.zip
mv tianji-${RELEASE} /opt/tianji
cd tianji
export NODE_OPTIONS=--max_old_space_size=4096
$STD pnpm install
$STD pnpm build
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Initial Setup complete"
msg_info "Setting up Database"
DB_NAME=tianji_db DB_NAME=tianji_db
DB_USER=tianji DB_USER=tianji
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
@ -53,37 +70,33 @@ echo -e "Tianji Database User: $DB_USER" >>~/tianji.creds
echo -e "Tianji Database Password: $DB_PASS" >>~/tianji.creds echo -e "Tianji Database Password: $DB_PASS" >>~/tianji.creds
echo -e "Tianji Database Name: $DB_NAME" >>~/tianji.creds echo -e "Tianji Database Name: $DB_NAME" >>~/tianji.creds
echo -e "Tianji Secret: $TIANJI_SECRET" >>~/tianji.creds echo -e "Tianji Secret: $TIANJI_SECRET" >>~/tianji.creds
msg_ok "Set up PostgreSQL" msg_ok "Set up PostgreSQL database"
msg_info "Installing Tianji (Extreme Patience)" msg_info "Setting up Tianji Env"
cd /opt
RELEASE=$(curl -s https://api.github.com/repos/msgbyte/tianji/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q "https://github.com/msgbyte/tianji/archive/refs/tags/v${RELEASE}.zip"
unzip -q v${RELEASE}.zip
mv tianji-${RELEASE} /opt/tianji
cd tianji
export NODE_OPTIONS=--max_old_space_size=4096
$STD pnpm install
$STD pnpm build
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
cat <<EOF >/opt/tianji/src/server/.env cat <<EOF >/opt/tianji/src/server/.env
DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?schema=public" DATABASE_URL="postgresql://$DB_USER:$DB_PASS@127.0.0.1:5432/$DB_NAME?schema=public"
JWT_SECRET="$TIANJI_SECRET" JWT_SECRET="$TIANJI_SECRET"
EOF EOF
msg_ok ".env successfully set up"
msg_info "Initialize Application"
cd /opt/tianji cd /opt/tianji
$STD npm install pm2 -g $STD npm install pm2 -g
$STD pm2 install pm2-logrotate $STD pm2 install pm2-logrotate
cd src/server cd src/server
$STD pnpm db:migrate:apply $STD pnpm db:migrate:apply
msg_ok "Application Initialized"
msg_info "Activate PM2 Service"
$STD pm2 start /opt/tianji/src/server/dist/src/server/main.js --name tianji $STD pm2 start /opt/tianji/src/server/dist/src/server/main.js --name tianji
$STD pm2 save $STD pm2 save
msg_ok "Installed Tianji" msg_ok "Service activated"
motd_ssh motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -R /opt/v${RELEASE}.zip rm -R /opt/v${RELEASE}.zip
$STD apt-get -y autoremove $STD apt-get autoremove -y
$STD apt-get -y autoclean $STD apt-get autoclean -y
msg_ok "Cleaned" msg_ok "Cleaned"