Add script: manyfold
This commit is contained in:
parent
bdd8c3266c
commit
40227c2ad4
65
ct/manyfold.sh
Normal file
65
ct/manyfold.sh
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/bvdberg01/ProxmoxVE/manyfold/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: bvdberg01
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/manyfold3d/manyfold
|
||||
|
||||
APP="Manyfold"
|
||||
var_tags="network"
|
||||
var_cpu="2"
|
||||
var_ram="1024"
|
||||
var_disk="15"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/manyfold ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/benjaminjonard/manyfold/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop apache2
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
cd /opt
|
||||
mv /opt/manyfold/ /opt/manyfold-backup
|
||||
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP to v${RELEASE}"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start service
|
||||
msg_ok "Started Service"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -r "/opt/${RELEASE}.zip"
|
||||
rm -r /opt/manyfold-backup
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
34
frontend/public/json/manyfold.json
Normal file
34
frontend/public/json/manyfold.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "Manyfold",
|
||||
"slug": "manyfold",
|
||||
"categories": [
|
||||
24
|
||||
],
|
||||
"date_created": "2025-03-18",
|
||||
"type": "ct",
|
||||
"updateable": false,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"documentation": "https://manyfold.app/sysadmin/",
|
||||
"website": "https://manyfold.app/",
|
||||
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/webp/manyfold.webp",
|
||||
"description": "Manyfold is an open source, self-hosted web application for managing a collection of 3d models, particularly focused on 3d printing.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/manyfold.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 1024,
|
||||
"hdd": 15,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
165
install/manyfold-install.sh
Normal file
165
install/manyfold-install.sh
Normal file
@ -0,0 +1,165 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: bvdberg01
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
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 \
|
||||
mc \
|
||||
gnupg2\
|
||||
postgresql \
|
||||
lsb-release \
|
||||
rbenv \
|
||||
libpq-dev \
|
||||
libarchive-dev \
|
||||
git \
|
||||
libmariadb-dev \
|
||||
redis-server \
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up PostgreSQL"
|
||||
DB_NAME=manyfold
|
||||
DB_USER=manyfold
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
||||
{
|
||||
echo "Manyfold Credentials"
|
||||
echo "Manyfold Database User: $DB_USER"
|
||||
echo "Manyfold Database Password: $DB_PASS"
|
||||
echo "Manyfold Database Name: $DB_NAME"
|
||||
} >> ~/manyfold.creds
|
||||
msg_ok "Set up PostgreSQL"
|
||||
|
||||
msg_info "Setting up Node.js/Yarn"
|
||||
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_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
$STD npm install -g npm@latest
|
||||
$STD npm install -g yarn
|
||||
msg_ok "Installed Node.js/Yarn"
|
||||
|
||||
msg_info "Installing Ruby Version Manager"
|
||||
$STD gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
||||
curl -sSL https://get.rvm.io -o install_rvm.sh
|
||||
chmod +x install_rvm.sh
|
||||
bash install_rvm.sh stable
|
||||
msg_ok "Installed Ruby Version Manager"
|
||||
|
||||
msg_info "Adding manyfold user"
|
||||
useradd -m -s /usr/bin/bash manyfold
|
||||
usermod -a -G rvm manyfold
|
||||
msg_ok "Added manyfold user"
|
||||
|
||||
msg_info "Installing Manyfold"
|
||||
RELEASE=$(curl -s https://api.github.com/repos/manyfold3d/manyfold/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
cd /opt
|
||||
wget -q "https://github.com/manyfold3d/manyfold/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q "v${RELEASE}.zip"
|
||||
mv /opt/manyfold-${RELEASE}/ /opt/manyfold
|
||||
cd /opt/manyfold
|
||||
chown -R manyfold:manyfold /opt/manyfold
|
||||
RUBY_VERSION=$(cat .ruby-version)
|
||||
YARN_VERSION=$(grep '"packageManager":' package.json | sed -E 's/.*"(yarn@[0-9\.]+)".*/\1/')
|
||||
$STD gem install bundler
|
||||
/bin/bash --login -c "rvm install $RUBY_VERSION"
|
||||
/bin/bash --login -c "rvm use --default $RUBY_VERSION"
|
||||
$STD bundle install #do not run as root
|
||||
$STD gem install sidekiq
|
||||
$STD npm install --global corepack
|
||||
corepack enable
|
||||
$STD corepack prepare $YARN_VERSION --activate
|
||||
$STD corepack use $YARN_VERSION --global
|
||||
$STD yarn install
|
||||
cat <<EOF >/opt/.env
|
||||
APP_VERSION=${RELEASE}
|
||||
GUID=1002
|
||||
PUID=1001
|
||||
PUBLIC_HOSTNAME=subdomain.somehost.org
|
||||
PUBLIC_PORT=5000
|
||||
SECRET_KEY_BASE=$(bundle exec rails secret)
|
||||
REDIS_URL=redis://127.0.0.1:6379/1
|
||||
DATABASE_ADAPTER=postgresql
|
||||
DATABASE_HOST=127.0.0.1
|
||||
DATABASE_USER=${DB_USER}
|
||||
DATABASE_PASSWORD=${DB_PASS}
|
||||
DATABASE_NAME=${DB_NAME}
|
||||
DATABASE_CONNECTION_POOL=16
|
||||
MULTIUSER=enabled
|
||||
HTTPS_ONLY=false
|
||||
RAILS_ENV=production
|
||||
EOF
|
||||
chown manyfold:manyfold /opt/.env
|
||||
source /opt/.env && bin/rails db:migrate
|
||||
source /opt/.env && bin/rails assets:precompile
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed manyfold"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/manyfold.service
|
||||
[Unit]
|
||||
Description=Manyfold3d
|
||||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=manyfold
|
||||
Group=manyfold
|
||||
WorkingDirectory=/opt/manyfold
|
||||
EnvironmentFile=/opt/.env
|
||||
ExecStart=/usr/bin/bash -lc '/opt/manyfold/bin/rails server -b 127.0.0.1 --port 5000 --environment production'
|
||||
TimeoutSec=30
|
||||
RestartSec=15s
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now manyfold
|
||||
|
||||
cat <<EOF >/etc/nginx/sites-available/manyfold.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name manyfold;
|
||||
root /opt/manyfold/public;
|
||||
|
||||
location / {
|
||||
try_files \$uri/index.html \$uri @rails;
|
||||
}
|
||||
|
||||
location @rails {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
ln -s /etc/nginx/sites-available/manyfold.conf /etc/nginx/sites-enabled/
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
$STD systemctl reload nginx
|
||||
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"
|
Loading…
x
Reference in New Issue
Block a user