1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-02-02 00:51:51 +00:00
ProxmoxVE/install/grist-install.sh
Carl Furrow 13a52878ab
Add new script: Grist (#1076)
* feat: create grist helper scripts, and json

create new scripts for https://github.com/gristlabs/grist-core
based on homarr scripts

* fix: move rm of zip into "clean up"

* fix: remove second source

* fix: include 'v' in release messages

* fix: use full path to remove release zip

* fix: update copyright

* fix: combine nodejs installers into one section

* fix: comment spacing

* fix: copy .env file from existing grist_bak dir

* fix: ensure "install:python" is run to install python deps
2024-12-29 10:40:19 +01:00

85 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2024 community-scripts ORG
# Author: cfurrow
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/gristlabs/grist-core
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
curl \
sudo \
make \
gnupg \
ca-certificates \
mc \
python3.11-venv
msg_ok "Installed Dependencies"
msg_info "Installing Node.js"
mkdir -p /etc/apt/keyrings
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
$STD apt-get update
$STD apt-get install -y nodejs
msg_ok "Installed Node.js"
msg_info "Installing yarn"
$STD npm install -g yarn
msg_ok "Installed yarn $(yarn --version)"
msg_info "Installing Grist"
RELEASE=$(curl -s https://api.github.com/repos/gristlabs/grist-core/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
cd /opt
wget -q https://github.com/gristlabs/grist-core/archive/refs/tags/v${RELEASE}.zip
unzip -q v$RELEASE.zip
mv grist-core-${RELEASE} grist
cd grist
$STD yarn install
$STD yarn run build:prod
$STD yarn run install:python
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
cat <<EOF >/opt/grist/.env
NODE_ENV=production
GRIST_HOST=0.0.0.0
EOF
msg_ok "Installed Grist"
cat <<EOF >/etc/systemd/system/grist.service
[Unit]
Description=Grist
After=network.target
[Service]
Type=exec
WorkingDirectory=/opt/grist
ExecStart=/usr/bin/yarn run start:prod
EnvironmentFile=-/opt/grist/.env
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now grist.service
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -rf /opt/v${RELEASE}.zip
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"