Skip to content

Commit 58a2ece

Browse files
authored
New Script: Paymenter (#1827)
1 parent aa16f93 commit 58a2ece

File tree

3 files changed

+230
-0
lines changed

3 files changed

+230
-0
lines changed

ct/paymenter.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
4+
# Copyright (c) 2021-2025 community-scripts ORG
5+
# Author: Nícolas Pastorello (opastorello)
6+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
# App Default Values
9+
APP="Paymenter"
10+
var_tags="hosting;ecommerce;marketplace;"
11+
var_cpu="2"
12+
var_ram="1024"
13+
var_disk="5"
14+
var_os="Debian"
15+
var_version="12"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
32+
if [[ ! -d /opt/paymenter ]]; then
33+
msg_error "No ${APP} Installation Found!"
34+
exit
35+
fi
36+
RELEASE=$(curl -s https://api.github.com/repos/paymenter/paymenter/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
37+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
38+
msg_info "Updating ${APP} to ${RELEASE}"
39+
echo "${RELEASE}" >/opt/${APP}_version.txt
40+
cd /opt/paymenter
41+
php artisan p:upgrade --no-interaction &>/dev/null
42+
msg_ok "Updated Successfully"
43+
else
44+
msg_ok "No update required. ${APP} is already at ${RELEASE}."
45+
fi
46+
exit
47+
}
48+
49+
start
50+
build_container
51+
description
52+
53+
msg_ok "Completed Successfully!\n"
54+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
55+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
56+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

install/paymenter-install.sh

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Nícolas Pastorello (opastorello)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
7+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
8+
color
9+
verb_ip6
10+
catch_errors
11+
setting_up_container
12+
network_check
13+
update_os
14+
15+
msg_info "Installing Dependencies"
16+
$STD apt-get install -y \
17+
curl \
18+
sudo \
19+
mc \
20+
git \
21+
software-properties-common \
22+
apt-transport-https \
23+
ca-certificates \
24+
gnupg \
25+
php8.2 \
26+
php8.2-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip} \
27+
mariadb-server \
28+
nginx \
29+
redis-server
30+
$STD curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
31+
msg_ok "Installed Dependencies"
32+
33+
msg_info "Installing Paymenter"
34+
RELEASE=$(curl -s https://api.github.com/repos/paymenter/paymenter/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
35+
echo "${RELEASE}" >/opt/${APP}_version.txt
36+
mkdir -p /opt/paymenter
37+
cd /opt/paymenter
38+
wget -q "https://github.com/paymenter/paymenter/releases/download/${RELEASE}/paymenter.tar.gz"
39+
$STD tar -xzvf paymenter.tar.gz
40+
chmod -R 755 storage/* bootstrap/cache/
41+
msg_ok "Installed Paymenter"
42+
43+
msg_info "Setting up database"
44+
DB_NAME=paymenter
45+
DB_USER=paymenter
46+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
47+
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql
48+
mysql -u root -e "CREATE DATABASE $DB_NAME;"
49+
mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
50+
mysql -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost' WITH GRANT OPTION;"
51+
{
52+
echo "Paymenter Database Credentials"
53+
echo "Database: $DB_NAME"
54+
echo "Username: $DB_USER"
55+
echo "Password: $DB_PASS"
56+
} >> ~/paymenter_db.creds
57+
cp .env.example .env
58+
$STD composer install --no-dev --optimize-autoloader --no-interaction
59+
$STD php artisan key:generate --force
60+
$STD php artisan storage:link
61+
sed -i "s/^DB_DATABASE=.*/DB_DATABASE=${DB_NAME}/" .env
62+
sed -i "s/^DB_USERNAME=.*/DB_USERNAME=${DB_USER}/" .env
63+
sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/" .env
64+
$STD php artisan migrate --force --seed
65+
msg_ok "Set up database"
66+
67+
msg_info "Creating Admin User"
68+
$STD php artisan p:user:create <<EOF
69+
70+
paymenter
71+
admin
72+
paymenter
73+
0
74+
EOF
75+
msg_ok "Created Admin User"
76+
77+
msg_info "Configuring Nginx"
78+
cat <<EOF >/etc/nginx/sites-available/paymenter.conf
79+
server {
80+
listen 80;
81+
listen [::]:80;
82+
server_name localhost;
83+
root /opt/paymenter/public;
84+
85+
index index.php;
86+
87+
location / {
88+
try_files \$uri \$uri/ /index.php?\$query_string;
89+
}
90+
91+
location ~ \.php\$ {
92+
include snippets/fastcgi-php.conf;
93+
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
94+
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
95+
include fastcgi_params;
96+
}
97+
98+
location ~ /\.ht {
99+
deny all;
100+
}
101+
}
102+
EOF
103+
ln -s /etc/nginx/sites-available/paymenter.conf /etc/nginx/sites-enabled/
104+
rm -f /etc/nginx/sites-enabled/default
105+
$STD systemctl reload nginx
106+
chown -R www-data:www-data /opt/paymenter/*
107+
msg_ok "Configured Nginx"
108+
109+
msg_info "Setting up Cronjob"
110+
echo "* * * * * php /opt/paymenter/artisan schedule:run >> /dev/null 2>&1" | crontab -
111+
msg_ok "Setup Cronjob"
112+
113+
msg_info "Setting up Service"
114+
cat <<EOF >/etc/systemd/system/paymenter.service
115+
[Unit]
116+
Description=Paymenter Queue Worker
117+
118+
[Service]
119+
User=www-data
120+
Group=www-data
121+
Restart=always
122+
ExecStart=/usr/bin/php /opt/paymenter/artisan queue:work
123+
StartLimitInterval=180
124+
StartLimitBurst=30
125+
RestartSec=5s
126+
127+
[Install]
128+
WantedBy=multi-user.target
129+
EOF
130+
$STD systemctl enable --now paymenter.service
131+
msg_ok "Setup Service"
132+
133+
msg_info "Cleaning up"
134+
rm -rf /opt/paymenter/paymenter.tar.gz
135+
$STD apt-get -y autoremove
136+
$STD apt-get -y autoclean
137+
msg_ok "Cleaned"
138+
139+
motd_ssh
140+
customize

json/paymenter.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Paymenter",
3+
"slug": "paymenter",
4+
"categories": [
5+
21
6+
],
7+
"date_created": "2025-01-28",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://paymenter.org/docs",
13+
"website": "https://paymenter.org/",
14+
"logo": "https://avatars.githubusercontent.com/u/115177786?s=200&v=4",
15+
"description": "Paymenter is an open source webshop solution for hosting companies. It's developed to provide an more easy way to manage your hosting company.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/paymenter.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 1024,
23+
"hdd": 5,
24+
"os":"Debian",
25+
"version":"12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": "[email protected]",
31+
"password": "paymenter"
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)