mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-12 01:08:39 +00:00
update
This commit is contained in:
parent
1a3d004a5d
commit
7ad2a2585b
|
|
@ -16,7 +16,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
$modules = \scandir(__DIR__ . '/../../Modules');
|
$modules = \scandir(__DIR__ . '/../../Modules');
|
||||||
|
|
||||||
$allowed = ['ClientManagement'];
|
$allowed = ['Organization'];
|
||||||
|
|
||||||
function createFunction($module, $modelName)
|
function createFunction($module, $modelName)
|
||||||
{
|
{
|
||||||
|
|
@ -41,8 +41,8 @@ function createFunction($module, $modelName)
|
||||||
public function api{$modelName}Create(RequestAbstract \$request, ResponseAbstract \$response, mixed \$data = null) : void
|
public function api{$modelName}Create(RequestAbstract \$request, ResponseAbstract \$response, mixed \$data = null) : void
|
||||||
{
|
{
|
||||||
if (!empty(\$val = \$this->validate{$modelName}Create(\$request))) {
|
if (!empty(\$val = \$this->validate{$modelName}Create(\$request))) {
|
||||||
\$response->data['{$snakeCase}_create'] = new FormValidation(\$val);
|
\$response->header->status = RequestStatusCode::R_400;
|
||||||
\$response->header->status = RequestStatusCode::R_400;
|
\$this->createInvalidCreateResponse(\$request, \$response, \$val);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -121,8 +121,8 @@ function updateFunction($module, $modelName, $helperName = '')
|
||||||
public function api{$modelName}Update(RequestAbstract \$request, ResponseAbstract \$response, mixed \$data = null) : void
|
public function api{$modelName}Update(RequestAbstract \$request, ResponseAbstract \$response, mixed \$data = null) : void
|
||||||
{
|
{
|
||||||
if (!empty(\$val = \$this->validate{$modelName}Update(\$request))) {
|
if (!empty(\$val = \$this->validate{$modelName}Update(\$request))) {
|
||||||
\$response->data[\$request->uri->__toString()] = new FormValidation(\$val);
|
\$response->header->status = RequestStatusCode::R_400;
|
||||||
\$response->header->status = RequestStatusCode::R_400;
|
\$this->createInvalidUpdateResponse(\$request, \$response, \$val);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -201,8 +201,8 @@ function deleteFunction($module, $modelName)
|
||||||
public function api{$modelName}Delete(RequestAbstract \$request, ResponseAbstract \$response, mixed \$data = null) : void
|
public function api{$modelName}Delete(RequestAbstract \$request, ResponseAbstract \$response, mixed \$data = null) : void
|
||||||
{
|
{
|
||||||
if (!empty(\$val = \$this->validate{$modelName}Delete(\$request))) {
|
if (!empty(\$val = \$this->validate{$modelName}Delete(\$request))) {
|
||||||
\$response->data[\$request->uri->__toString()] = new FormValidation(\$val);
|
\$response->header->status = RequestStatusCode::R_400;
|
||||||
\$response->header->status = RequestStatusCode::R_400;
|
\$this->createInvalidDeleteResponse(\$request, \$response, \$val);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -266,7 +266,12 @@ foreach ($modules as $module) {
|
||||||
$delete = [];
|
$delete = [];
|
||||||
|
|
||||||
foreach ($matches[2] as $match) {
|
foreach ($matches[2] as $match) {
|
||||||
if (\strpos($match, 'event') !== false || \strpos($match, 'api') !== 0) {
|
if (\strpos($match, 'event') !== false
|
||||||
|
|| \strpos($match, 'api') !== 0
|
||||||
|
|| \strpos($match, 'To') !== false
|
||||||
|
|| \strpos($match, 'From') !== false
|
||||||
|
|| \strpos($match, 'Setting') !== false
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ a2enmod headers
|
||||||
## Jingga Server
|
## Jingga Server
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
||||||
apt-get install git borgbackup
|
apt-get install borgbackup
|
||||||
|
|
||||||
### Install borg
|
### Install borg
|
||||||
borg init -v --encryption=repokey /var/www/html
|
borg init -v --encryption=repokey /var/www/html
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ foreach ($report as $key => $line) {
|
||||||
$file = \reset($parts);
|
$file = \reset($parts);
|
||||||
$function = \end($parts);
|
$function = \end($parts);
|
||||||
|
|
||||||
$file = __DIR__ . '/../../' . \str_replace('\\', '/', $file) . '.php';
|
$file = __DIR__ . '/../../' . \strtr($file, '\\', '/') . '.php';
|
||||||
|
|
||||||
if (!\is_file($file)) {
|
if (!\is_file($file)) {
|
||||||
$noTestFile[] = $key;
|
$noTestFile[] = $key;
|
||||||
|
|
@ -104,7 +104,7 @@ foreach ($directories as $directory) {
|
||||||
$function = \substr($line, 20, $end - 20);
|
$function = \substr($line, 20, $end - 20);
|
||||||
|
|
||||||
$name = \substr(\realpath($file), \strlen(\realpath(__DIR__ . '/../../')) + 1, -4);
|
$name = \substr(\realpath($file), \strlen(\realpath(__DIR__ . '/../../')) + 1, -4);
|
||||||
$name = \str_replace('/', '\\', $name);
|
$name = \strtr($name, '/', '\\');
|
||||||
|
|
||||||
$reportKey = $name . ':' . $function;
|
$reportKey = $name . ':' . $function;
|
||||||
|
|
||||||
|
|
|
||||||
151
Helper/serverInstall.sh
Normal file
151
Helper/serverInstall.sh
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
## General
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
# For every user .bash_profile
|
||||||
|
|
||||||
|
export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> /var/www/html/backup/bash/$(date "+%Y-%m-%d").log; fi'
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
apt-get install git snapd ufw
|
||||||
|
|
||||||
|
# Security
|
||||||
|
|
||||||
|
apt-get install ufw
|
||||||
|
ufw allow ssh
|
||||||
|
ufw allow http
|
||||||
|
ufw allow https
|
||||||
|
|
||||||
|
apt-get install fail2ban -y
|
||||||
|
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
|
||||||
|
service fail2ban restart
|
||||||
|
|
||||||
|
# SSH
|
||||||
|
|
||||||
|
# TODO: upload ssh key and disable password login if successful
|
||||||
|
# https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-20-04
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
## Web
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
apt-get install php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 mysql-server wkhtmltopdf tesseract-ocr
|
||||||
|
|
||||||
|
a2enmod rewrite
|
||||||
|
a2enmod headers
|
||||||
|
|
||||||
|
# Apache2
|
||||||
|
|
||||||
|
cat << EOF > /etc/apache2/sites-available/000-default.conf
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin info@jingga.app
|
||||||
|
DocumentRoot /var/www/html/jingga
|
||||||
|
|
||||||
|
SetEnv OMS_STRIPE_SECRET 1
|
||||||
|
SetEnv OMS_STRIPE_PUBLIC 2
|
||||||
|
SetEnv OMS_STRIPE_WEBHOOK 3
|
||||||
|
SetEnv OMS_PRIVATE_KEY_I 4
|
||||||
|
|
||||||
|
<Directory /var/www/html/jingga>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF > /etc/apache2/sites-available/001-saas.conf
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin info@jingga.app
|
||||||
|
DocumentRoot /var/www/html/jingga
|
||||||
|
ServerName orw.jingga.app
|
||||||
|
ServerAlias www.orw.jingga.app
|
||||||
|
|
||||||
|
SetEnv OMS_STRIPE_SECRET 1
|
||||||
|
SetEnv OMS_STRIPE_PUBLIC 2
|
||||||
|
SetEnv OMS_STRIPE_WEBHOOK 3
|
||||||
|
SetEnv OMS_PRIVATE_KEY_I 4
|
||||||
|
|
||||||
|
<Directory /var/www/html/jingga>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin info@jingga.app
|
||||||
|
DocumentRoot /var/www/html/jingga
|
||||||
|
ServerName invoicing.jingga.app
|
||||||
|
ServerAlias www.invoicing.jingga.app
|
||||||
|
|
||||||
|
SetEnv OMS_STRIPE_SECRET 1
|
||||||
|
SetEnv OMS_STRIPE_PUBLIC 2
|
||||||
|
SetEnv OMS_STRIPE_WEBHOOK 3
|
||||||
|
SetEnv OMS_PRIVATE_KEY_I 4
|
||||||
|
|
||||||
|
<Directory /var/www/html/jingga>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin info@jingga.app
|
||||||
|
DocumentRoot /var/www/html/jingga
|
||||||
|
ServerName fleetmanagement.jingga.app
|
||||||
|
ServerAlias www.fleetmanagement.jingga.app
|
||||||
|
|
||||||
|
SetEnv OMS_STRIPE_SECRET 1
|
||||||
|
SetEnv OMS_STRIPE_PUBLIC 2
|
||||||
|
SetEnv OMS_STRIPE_WEBHOOK 3
|
||||||
|
SetEnv OMS_PRIVATE_KEY_I 4
|
||||||
|
|
||||||
|
<Directory /var/www/html/jingga>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
a2ensite 001-saas.conf
|
||||||
|
a2ensite 000-saas.conf
|
||||||
|
service apache2 reload
|
||||||
|
service apache2 restart
|
||||||
|
|
||||||
|
snap install --classic certbot
|
||||||
|
ln -s /snap/bin/certbot /usr/bin/certbot
|
||||||
|
certbot --apache
|
||||||
|
certbot renew --dry-run
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
## Security
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
### Install borg
|
||||||
|
|
||||||
|
apt-get install borgbackup
|
||||||
|
|
||||||
|
borg init -v --encryption=repokey /var/www/html
|
||||||
|
borg key export /var/www/html repokey
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
## Content
|
||||||
|
###############################################################
|
||||||
|
|
@ -69,7 +69,7 @@ class GptHelper
|
||||||
return $response->getBody();
|
return $response->getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function handleFile(string $inPath, string $outPath, string $behavior, \Closure $fileReader, bool $bulk = true) : string
|
public static function handleFile(string $inPath, string $outPath, string $behavior, Callable $fileReader, bool $bulk = true) : string
|
||||||
{
|
{
|
||||||
$response = '';
|
$response = '';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user