From 9268b44dde0da9ab2f4a0e46145ea1a90952e3f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 13:30:39 -0300 Subject: [PATCH 1/7] Create paymenter.json --- json/paymenter.json | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 json/paymenter.json diff --git a/json/paymenter.json b/json/paymenter.json new file mode 100644 index 00000000..990eb788 --- /dev/null +++ b/json/paymenter.json @@ -0,0 +1,34 @@ +{ + "name": "Paymenter", + "slug": "paymenter", + "categories": [ + 21 + ], + "date_created": "2025-01-28", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://paymenter.org/docs", + "website": "https://paymenter.org/", + "logo": "https://avatars.githubusercontent.com/u/115177786?s=200&v=4", + "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.", + "install_methods": [ + { + "type": "default", + "script": "ct/paymenter.sh", + "resources": { + "cpu": 2, + "ram": 1024, + "hdd": 5, + "os":"Ubuntu", + "version":"24.04" + } + } + ], + "default_credentials": { + "username": "admin@paymenter.org", + "password": "paymenter" + }, + "notes": [] +} From 03d44f9574aa4db2aa00e622b104fe5aa693a860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 13:31:28 -0300 Subject: [PATCH 2/7] Create paymenter.sh --- ct/paymenter.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 ct/paymenter.sh diff --git a/ct/paymenter.sh b/ct/paymenter.sh new file mode 100644 index 00000000..0579d3d5 --- /dev/null +++ b/ct/paymenter.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: NĂ­colas Pastorello (opastorello) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +# App Default Values +APP="Paymenter" +var_tags="hosting;ecommerce;marketplace;" +var_cpu="2" +var_ram="1024" +var_disk="5" +var_os="Ubuntu" +var_version="24.04" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/paymenter ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/paymenter/paymenter/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Updating ${APP} to ${RELEASE}" + cd /opt/paymenter + php artisan p:upgrade --no-interaction &>/dev/null + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at ${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}:80${CL}" From 1455f9e00cfd752b0715e2e3ce5885bf97fd5e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 13:35:50 -0300 Subject: [PATCH 3/7] Create paymenter-install.sh --- install/paymenter-install.sh | 145 +++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 install/paymenter-install.sh diff --git a/install/paymenter-install.sh b/install/paymenter-install.sh new file mode 100644 index 00000000..73fad3a6 --- /dev/null +++ b/install/paymenter-install.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: NĂ­colas Pastorello (opastorello) +# 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 \ + git \ + sudo \ + mc \ + tar \ + unzip \ + software-properties-common \ + apt-transport-https \ + ca-certificates \ + gnupg +$STD add-apt-repository -y ppa:ondrej/php +$STD apt-get update -y +$STD apt-get install -y \ + php8.2 \ + php8.2-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip} \ + mariadb-server \ + nginx \ + redis-server +$STD curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +msg_ok "Installed Dependencies" + +msg_info "Installing Paymenter" +RELEASE=$(curl -s https://api.github.com/repos/paymenter/paymenter/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') +echo "${RELEASE}" >/opt/paymenter_version.txt +mkdir -p /opt/paymenter +cd /opt/paymenter +wget -q "https://github.com/paymenter/paymenter/releases/download/${RELEASE}/paymenter.tar.gz" +$STD tar -xzvf paymenter.tar.gz +chmod -R 755 storage/* bootstrap/cache/ +msg_ok "Installed Paymenter" + +msg_info "Setting up database" +DB_NAME=paymenter +DB_USER=paymenter +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql +mysql -u root -e "CREATE DATABASE $DB_NAME;" +mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +mysql -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost' WITH GRANT OPTION;" +{ + echo "Paymenter Database Credentials" + echo "Database: $DB_NAME" + echo "Username: $DB_USER" + echo "Password: $DB_PASS" +} >> ~/paymenter_db.creds +cp .env.example .env +$STD composer install --no-dev --optimize-autoloader --no-interaction +$STD php artisan key:generate --force +$STD php artisan storage:link +sed -i "s/^DB_DATABASE=.*/DB_DATABASE=${DB_NAME}/" .env +sed -i "s/^DB_USERNAME=.*/DB_USERNAME=${DB_USER}/" .env +sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/" .env +$STD php artisan migrate --force --seed +msg_ok "Set up database" + +msg_info "Creating Admin User" +$STD php artisan p:user:create </etc/nginx/sites-available/paymenter.conf +server { + listen 80; + listen [::]:80; + server_name localhost; + root /opt/paymenter/public; + + index index.php; + + location / { + try_files \$uri \$uri/ /index.php?\$query_string; + } + + location ~ \.php\$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; + fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } +} +EOF +ln -s /etc/nginx/sites-available/paymenter.conf /etc/nginx/sites-enabled/ +rm -f /etc/nginx/sites-enabled/default +$STD systemctl restart nginx +chown -R www-data:www-data /opt/paymenter/* +msg_ok "Configured Nginx" + +msg_info "Setting up Cronjob" +echo "* * * * * php /opt/paymenter/artisan schedule:run >> /dev/null 2>&1" | crontab - +msg_ok "Setup Cronjob" + +msg_info "Setting up Service" +cat </etc/systemd/system/paymenter.service +[Unit] +Description=Paymenter Queue Worker + +[Service] +User=www-data +Group=www-data +Restart=always +ExecStart=/usr/bin/php /opt/paymenter/artisan queue:work +StartLimitInterval=180 +StartLimitBurst=30 +RestartSec=5s + +[Install] +WantedBy=multi-user.target +EOF +$STD systemctl enable --now paymenter.service +msg_ok "Setup Service" + +msg_info "Cleaning up" +rm -rf /opt/paymenter/paymenter.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize From 1873eba413b9e77193ea00e5d184a4bdd86c3295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 15:41:07 -0300 Subject: [PATCH 4/7] Update paymenter-install.sh Removed some unnecessary dependencies --- install/paymenter-install.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/install/paymenter-install.sh b/install/paymenter-install.sh index 73fad3a6..8e0622a9 100644 --- a/install/paymenter-install.sh +++ b/install/paymenter-install.sh @@ -16,10 +16,6 @@ msg_info "Installing Dependencies" $STD apt-get install -y \ curl \ git \ - sudo \ - mc \ - tar \ - unzip \ software-properties-common \ apt-transport-https \ ca-certificates \ From d2b2ffa3d5164dfab2abcb772d6a17c92882ed65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 15:41:46 -0300 Subject: [PATCH 5/7] Update install/paymenter-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- install/paymenter-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/paymenter-install.sh b/install/paymenter-install.sh index 8e0622a9..6b1abdf0 100644 --- a/install/paymenter-install.sh +++ b/install/paymenter-install.sh @@ -103,7 +103,7 @@ server { EOF ln -s /etc/nginx/sites-available/paymenter.conf /etc/nginx/sites-enabled/ rm -f /etc/nginx/sites-enabled/default -$STD systemctl restart nginx +$STD systemctl reload nginx chown -R www-data:www-data /opt/paymenter/* msg_ok "Configured Nginx" From 5ccff2a5b6334ad4bc95ac187504c1cd6835dea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 15:48:05 -0300 Subject: [PATCH 6/7] Update paymenter.sh Add line to update version file --- ct/paymenter.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ct/paymenter.sh b/ct/paymenter.sh index 0579d3d5..29464831 100644 --- a/ct/paymenter.sh +++ b/ct/paymenter.sh @@ -36,6 +36,7 @@ function update_script() { RELEASE=$(curl -s https://api.github.com/repos/paymenter/paymenter/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then msg_info "Updating ${APP} to ${RELEASE}" + echo "${RELEASE}" >/opt/${APP}_version.txt cd /opt/paymenter php artisan p:upgrade --no-interaction &>/dev/null msg_ok "Updated Successfully" From 66d808024f70f797c0817a7f91cbe647d366ff6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Tue, 28 Jan 2025 15:48:20 -0300 Subject: [PATCH 7/7] Update paymenter-install.sh Updated line to create version file --- install/paymenter-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/paymenter-install.sh b/install/paymenter-install.sh index 6b1abdf0..1e232de1 100644 --- a/install/paymenter-install.sh +++ b/install/paymenter-install.sh @@ -33,7 +33,7 @@ msg_ok "Installed Dependencies" msg_info "Installing Paymenter" RELEASE=$(curl -s https://api.github.com/repos/paymenter/paymenter/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') -echo "${RELEASE}" >/opt/paymenter_version.txt +echo "${RELEASE}" >/opt/${APP}_version.txt mkdir -p /opt/paymenter cd /opt/paymenter wget -q "https://github.com/paymenter/paymenter/releases/download/${RELEASE}/paymenter.tar.gz"