Skip to content

Commit 7c4e220

Browse files
committed
Add: OpnForm
1 parent 9af5e09 commit 7c4e220

3 files changed

Lines changed: 355 additions & 0 deletions

File tree

‎ct/opnform.sh‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
3+
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
4+
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
5+
# Copyright (c) 2021-2026 community-scripts ORG
6+
# Author: MickLesk (CanbiZ)
7+
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
8+
# Source: https://github.com/OpnForm/OpnForm
9+
10+
APP="OpnForm"
11+
var_tags="${var_tags:-forms;survey}"
12+
var_cpu="${var_cpu:-2}"
13+
var_ram="${var_ram:-6144}"
14+
var_disk="${var_disk:-8}"
15+
var_os="${var_os:-debian}"
16+
var_version="${var_version:-13}"
17+
var_arm64="${var_arm64:-yes}"
18+
var_unprivileged="${var_unprivileged:-1}"
19+
20+
header_info "$APP"
21+
variables
22+
color
23+
catch_errors
24+
25+
function update_script() {
26+
header_info
27+
check_container_storage
28+
check_container_resources
29+
30+
if [[ ! -d /opt/opnform ]]; then
31+
msg_error "No ${APP} Installation Found!"
32+
exit
33+
fi
34+
35+
if check_for_gh_release "opnform" "OpnForm/OpnForm"; then
36+
msg_info "Stopping OpnForm"
37+
systemctl stop opnform-client opnform-worker opnform-scheduler
38+
msg_ok "Stopped OpnForm"
39+
40+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "opnform" "OpnForm/OpnForm" "tarball"
41+
42+
msg_info "Building OpnForm API"
43+
rm -rf /opt/opnform/api/storage
44+
ln -s /opt/opnform_data/storage /opt/opnform/api/storage
45+
ln -sf /opt/opnform_data/api.env /opt/opnform/api/.env
46+
cd /opt/opnform/api
47+
$STD composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
48+
$STD php artisan storage:link
49+
$STD php artisan migrate --force
50+
$STD php artisan optimize:clear
51+
$STD php artisan optimize
52+
chown -R www-data:www-data /opt/opnform/api /opt/opnform_data/storage
53+
msg_ok "Built OpnForm API"
54+
55+
msg_info "Building OpnForm Client"
56+
cd /opt/opnform/client
57+
export NODE_OPTIONS="--max-old-space-size=4096" NUXT_TELEMETRY_DISABLED=1
58+
$STD npm ci
59+
$STD npm run build
60+
rm -rf /opt/opnform/client/node_modules
61+
msg_ok "Built OpnForm Client"
62+
63+
msg_info "Starting OpnForm"
64+
systemctl restart php8.3-fpm
65+
systemctl start opnform-client opnform-worker opnform-scheduler
66+
msg_ok "Started OpnForm"
67+
msg_ok "Updated successfully!"
68+
fi
69+
exit
70+
}
71+
72+
start
73+
build_container
74+
description
75+
76+
msg_ok "Completed Successfully!\n"
77+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
78+
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
79+
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"

‎install/opnform-install.sh‎

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
6+
# Source: https://github.com/OpnForm/OpnForm
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
nginx \
19+
redis-server
20+
msg_ok "Installed Dependencies"
21+
22+
PG_VERSION="17" setup_postgresql
23+
PG_DB_NAME="opnform" PG_DB_USER="opnform" PG_DB_CREDS_FILE="/dev/null" setup_postgresql_db
24+
PHP_VERSION="8.3" PHP_FPM="YES" PHP_MEMORY_LIMIT="1G" PHP_UPLOAD_MAX_FILESIZE="64M" PHP_POST_MAX_SIZE="64M" PHP_MAX_EXECUTION_TIME="600" setup_php
25+
setup_composer
26+
NODE_VERSION="24" setup_nodejs
27+
fetch_and_deploy_gh_release "opnform" "OpnForm/OpnForm" "tarball"
28+
29+
msg_info "Configuring OpnForm"
30+
FRONT_API_SECRET=$(random_password 40)
31+
mkdir -p /opt/opnform_data
32+
mv /opt/opnform/api/storage /opt/opnform_data/storage
33+
ln -s /opt/opnform_data/storage /opt/opnform/api/storage
34+
cat <<EOF >/opt/opnform_data/api.env
35+
APP_NAME="OpnForm"
36+
APP_ENV=production
37+
APP_KEY=
38+
APP_DEBUG=false
39+
APP_URL=http://${LOCAL_IP}
40+
FRONT_URL=http://${LOCAL_IP}
41+
FRONT_API_SECRET=${FRONT_API_SECRET}
42+
43+
LOG_CHANNEL=daily
44+
LOG_LEVEL=warning
45+
46+
DB_CONNECTION=pgsql
47+
DB_HOST=127.0.0.1
48+
DB_PORT=5432
49+
DB_DATABASE=opnform
50+
DB_USERNAME=opnform
51+
DB_PASSWORD=${PG_DB_PASS}
52+
53+
REDIS_HOST=127.0.0.1
54+
REDIS_PORT=6379
55+
CACHE_DRIVER=redis
56+
QUEUE_CONNECTION=redis
57+
SESSION_DRIVER=redis
58+
59+
FILESYSTEM_DRIVER=local
60+
LOCAL_FILESYSTEM_VISIBILITY=public
61+
62+
MAIL_MAILER=log
63+
MAIL_HOST=
64+
MAIL_PORT=
65+
MAIL_USERNAME=
66+
MAIL_PASSWORD=
67+
MAIL_ENCRYPTION=
68+
MAIL_FROM_ADDRESS=forms@example.com
69+
MAIL_FROM_NAME=OpnForm
70+
71+
JWT_TTL=1440
72+
JWT_SECRET=$(random_password 40)
73+
JWT_SKIP_IP_UA_VALIDATION=false
74+
PUBLIC_UPLOADS_RATE_LIMIT_PER_MINUTE=30
75+
PUBLIC_UPLOADS_RATE_LIMIT_PER_HOUR=300
76+
77+
TRUSTED_PROXIES=
78+
SHOW_OFFICIAL_TEMPLATES=true
79+
EOF
80+
cat <<EOF >/opt/opnform_data/client.env
81+
NODE_ENV=production
82+
NITRO_HOST=127.0.0.1
83+
NITRO_PORT=3000
84+
NUXT_PUBLIC_APP_URL=/
85+
NUXT_PUBLIC_API_BASE=/api
86+
NUXT_PRIVATE_API_BASE=http://127.0.0.1/api
87+
NUXT_PUBLIC_ENV=dev
88+
NUXT_API_SECRET=${FRONT_API_SECRET}
89+
NUXT_PUBLIC_H_CAPTCHA_SITE_KEY=
90+
NUXT_PUBLIC_RE_CAPTCHA_SITE_KEY=
91+
NUXT_PUBLIC_ROOT_REDIRECT_URL=
92+
EOF
93+
chmod 600 /opt/opnform_data/api.env /opt/opnform_data/client.env
94+
ln -sf /opt/opnform_data/api.env /opt/opnform/api/.env
95+
msg_ok "Configured OpnForm"
96+
97+
msg_info "Building OpnForm API"
98+
cd /opt/opnform/api
99+
$STD composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
100+
$STD php artisan key:generate --force
101+
$STD php artisan storage:link
102+
$STD php artisan migrate --force
103+
$STD php artisan passport:keys --force
104+
$STD php artisan telemetry:initialize-instance
105+
$STD php artisan optimize
106+
chown -R www-data:www-data /opt/opnform/api /opt/opnform_data/storage /opt/opnform_data/api.env
107+
chmod 600 /opt/opnform_data/storage/oauth-private.key
108+
msg_ok "Built OpnForm API"
109+
110+
msg_info "Building OpnForm Client"
111+
cd /opt/opnform/client
112+
export NODE_OPTIONS="--max-old-space-size=4096" NUXT_TELEMETRY_DISABLED=1
113+
$STD npm ci
114+
$STD npm run build
115+
rm -rf /opt/opnform/client/node_modules
116+
msg_ok "Built OpnForm Client"
117+
118+
msg_info "Configuring Nginx"
119+
PHP_SOCK=$(get_php_fpm_socket)
120+
cat <<EOF >/etc/nginx/sites-available/opnform
121+
map \$request_uri \$opnform_api_uri {
122+
~^/api(/.*\$) \$1;
123+
default \$request_uri;
124+
}
125+
126+
server {
127+
listen 80;
128+
listen [::]:80;
129+
server_name _;
130+
root /opt/opnform/api/public;
131+
index index.html index.htm index.php;
132+
client_max_body_size 64m;
133+
134+
location / {
135+
proxy_http_version 1.1;
136+
proxy_pass http://127.0.0.1:3000;
137+
proxy_set_header Host \$host;
138+
proxy_set_header X-Real-IP \$remote_addr;
139+
proxy_set_header X-Forwarded-Host \$host;
140+
proxy_set_header X-Forwarded-Port \$server_port;
141+
proxy_set_header Upgrade \$http_upgrade;
142+
proxy_set_header Connection "Upgrade";
143+
}
144+
145+
location ^~ /api/_nuxt_icon/ {
146+
proxy_http_version 1.1;
147+
proxy_pass http://127.0.0.1:3000;
148+
proxy_set_header Host \$host;
149+
proxy_set_header X-Real-IP \$remote_addr;
150+
proxy_set_header X-Forwarded-Host \$host;
151+
proxy_set_header X-Forwarded-Port \$server_port;
152+
}
153+
154+
location ~/(api|open|local\/temp|forms\/assets)/ {
155+
try_files \$uri \$uri/ /index.php\$is_args\$args;
156+
}
157+
158+
location ~ \.php\$ {
159+
fastcgi_split_path_info ^(.+\.php)(/.+)\$;
160+
fastcgi_pass unix:${PHP_SOCK};
161+
fastcgi_index index.php;
162+
include fastcgi_params;
163+
fastcgi_param SCRIPT_FILENAME \$document_root/index.php;
164+
fastcgi_param REQUEST_URI \$opnform_api_uri;
165+
}
166+
167+
location ~ /\. {
168+
deny all;
169+
}
170+
}
171+
EOF
172+
nginx_enable_site "opnform"
173+
msg_ok "Configured Nginx"
174+
175+
msg_info "Creating Services"
176+
cat <<EOF >/etc/systemd/system/opnform-client.service
177+
[Unit]
178+
Description=OpnForm Client
179+
After=network.target
180+
181+
[Service]
182+
Type=simple
183+
WorkingDirectory=/opt/opnform/client
184+
EnvironmentFile=/opt/opnform_data/client.env
185+
ExecStart=/usr/bin/node .output/server/index.mjs
186+
Restart=on-failure
187+
RestartSec=5
188+
189+
[Install]
190+
WantedBy=multi-user.target
191+
EOF
192+
cat <<EOF >/etc/systemd/system/opnform-worker.service
193+
[Unit]
194+
Description=OpnForm Queue Worker
195+
After=network.target postgresql.service redis-server.service
196+
197+
[Service]
198+
Type=simple
199+
User=www-data
200+
WorkingDirectory=/opt/opnform/api
201+
ExecStart=/usr/bin/php artisan queue:work
202+
Restart=always
203+
RestartSec=5
204+
205+
[Install]
206+
WantedBy=multi-user.target
207+
EOF
208+
cat <<EOF >/etc/systemd/system/opnform-scheduler.service
209+
[Unit]
210+
Description=OpnForm Scheduler
211+
After=network.target postgresql.service redis-server.service
212+
213+
[Service]
214+
Type=simple
215+
User=www-data
216+
WorkingDirectory=/opt/opnform/api
217+
ExecStart=/usr/bin/php artisan schedule:work
218+
Restart=always
219+
RestartSec=5
220+
221+
[Install]
222+
WantedBy=multi-user.target
223+
EOF
224+
systemctl enable -q --now redis-server opnform-client opnform-worker opnform-scheduler
225+
msg_ok "Created Services"
226+
227+
motd_ssh
228+
customize
229+
cleanup_lxc

‎json/opnform.json‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "OpnForm",
3+
"slug": "opnform",
4+
"categories": [
5+
25
6+
],
7+
"date_created": "2026-11-13",
8+
"type": "ct",
9+
"platforms": ["pve"],
10+
"updateable": true,
11+
"privileged": false,
12+
"architectures": ["amd64", "arm64"],
13+
"interface_port": 80,
14+
"documentation": "https://docs.opnform.com/",
15+
"website": "https://opnform.com/",
16+
"repository": "https://github.com/OpnForm/OpnForm",
17+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/opnform.webp",
18+
"description": "OpnForm is an open-source form builder and alternative to Typeform and Google Forms. Forms support conditional logic, file uploads, payments, custom themes and embedding, and submissions land in a dashboard or go out to email, webhooks, Slack, Discord and Google Sheets.",
19+
"install_methods": [
20+
{
21+
"type": "default",
22+
"script": "ct/opnform.sh",
23+
"config_path": "/opt/opnform_data/api.env",
24+
"resources": {
25+
"cpu": 2,
26+
"ram": 6144,
27+
"hdd": 8,
28+
"os": "Debian",
29+
"version": "13"
30+
}
31+
}
32+
],
33+
"default_credentials": {
34+
"username": null,
35+
"password": null
36+
},
37+
"notes": [
38+
{
39+
"text": "Open the URL and create the admin account on the setup page; public registration closes afterwards and free self-hosted instances allow 2 users.",
40+
"type": "info"
41+
},
42+
{
43+
"text": "For a domain or reverse proxy, set APP_URL and FRONT_URL in /opt/opnform_data/api.env, then run `php artisan optimize` in /opt/opnform/api.",
44+
"type": "info"
45+
}
46+
]
47+
}

0 commit comments

Comments
 (0)