crater-invoice / crater

Open Source Invoicing Solution for Individuals & Businesses
https://craterapp.com
GNU Affero General Public License v3.0
7.84k stars 1.57k forks source link

Selecting different DB breaks the form during installation #688

Open DejfCold opened 2 years ago

DejfCold commented 2 years ago

Describe the bug When selecting a different database type during the installation process, the form including the save & continue button disappears.

Expected behavior The form doesn't disappear and allows to continue the installation process

Screenshots

https://user-images.githubusercontent.com/12591578/147888905-6c07ecfa-7736-4d3e-a235-9462ff1300e6.mp4

If applicable, add screenshots to help explain your problem.

Please complete the following information:

Optional info

/etc/nginx/conf.d/crater.conf (mainly from https://laravel.com/docs/8.x/deployment#nginx)

upstream crater-fpm {
        server unix:/run/php-fpm/crater.sock;
}

server {
  listen 80;
  listen [::]:80;

  server_name crater.gehenna;
  root /usr/share/nginx/crater/public;

  add_header X-Frame-Options "SAMEORIGIN";
  add_header X-Content-Type-Options "nosniff";

  index index.php;

  charset utf-8;

  access_log /var/log/nginx/crater.log;
  error_log /var/log/nginx/crater_error.log;

  location / {
    try_files $uri $uri/ /index.php?query_string;
  }

  location = /favicon.ico {
    log_not_found off;
    access_log off;
  }

  location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
  }

  error_page 404 /index.php;

  location ~ \.php$ {
    fastcgi_pass crater-fpm;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
  }

  location ~ /\.(?!well-known).* {
    deny all;
  }
}

tried also with

fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

/etc/php-fpm.d/crater.conf

[crater]

user = crater
group = crater

listen = /run/php-fpm/crater.sock

listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1

pm = dynamic

pm.max_children = 50

pm.start_servers = 5

pm.min_spare_servers = 5

pm.max_spare_servers = 35

slowlog = /var/log/php-fpm/crater-slow.log

php_admin_value[error_log] = /var/log/php-fpm/crater-error.log
php_admin_flag[log_errors] = on

php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/session
php_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache
;php_value[opcache.file_cache]  = /var/lib/php/opcache
# pwd
/usr/share/nginx/crater
# ls -la
total 1444
drwxr-xr-x. 14 crater crater   4096 Dec 10 13:30 .
drwxr-xr-x.  5 root   root       47 Jan  2 19:46 ..
-rw-r--r--.  1 crater crater    100 Dec  2 14:59 .dockerignore
-rw-r--r--.  1 crater crater    309 Dec  2 14:59 .editorconfig
-rwxrwxr-x.  1 crater crater    621 Dec 10 13:30 .env
-rw-r--r--.  1 crater crater    621 Dec  2 14:59 .env.example
-rw-r--r--.  1 crater crater    315 Dec  2 14:59 .env.testing
-rw-r--r--.  1 crater crater    288 Dec  2 14:59 .eslintrc.js
-rw-r--r--.  1 crater crater     61 Dec  2 14:59 .gitattributes
drwxr-xr-x.  4 crater crater     45 Dec 10 13:30 .github
-rw-r--r--.  1 crater crater    175 Dec 10 12:56 .gitignore
-rw-r--r--.  1 crater crater   1203 Dec  2 14:59 .php-cs-fixer.dist.php
-rwxrwxr-x.  1 crater crater  14343 Dec  9 09:09 .phpunit.result.cache
-rw-r--r--.  1 crater crater     60 Dec  2 14:59 .prettierrc.json
-rw-r--r--.  1 crater crater    868 Dec  9 08:38 Dockerfile
-rw-r--r--.  1 crater crater  34523 Dec  9 14:08 LICENSE
-rw-r--r--.  1 crater crater    324 Dec 10 12:56 SECURITY.md
-rw-r--r--.  1 crater crater 379750 Dec  2 14:59 _ide_helper.php
drwxr-xr-x. 18 crater crater    248 Dec 10 13:30 app
-rw-r--r--.  1 crater crater   1686 Dec  2 14:59 artisan
drwxr-xr-x.  3 crater crater     34 Dec 10 13:30 bootstrap
-rw-r--r--.  1 crater crater   2798 Dec 10 12:56 composer.json
-rw-r--r--.  1 crater crater 449291 Dec 10 12:56 composer.lock
drwxr-xr-x.  2 crater crater   4096 Dec 10 13:30 config
-rw-r--r--.  1 crater crater   1199 Dec  2 14:59 crater.code-workspace
drwxr-xr-x.  5 crater crater     97 Dec 10 13:30 database
drwxr-xr-x.  4 crater crater     84 Dec 10 13:30 docker-compose
-rw-r--r--.  1 crater crater   1260 Dec  9 14:08 docker-compose.yml
-rw-r--r--.  1 crater crater 340932 Dec  2 14:59 package-lock.json
-rw-r--r--.  1 crater crater   1607 Dec 10 12:56 package.json
-rw-r--r--.  1 crater crater   1199 Dec  2 14:59 phpunit.xml
-rw-r--r--.  1 crater crater    127 Dec  9 14:08 postcss.config.js
drwxr-xr-x.  4 crater crater    105 Dec 10 13:30 public
-rw-r--r--.  1 crater crater   2900 Dec  9 14:08 readme.md
drwxr-xr-x.  7 crater crater     72 Dec 10 13:30 resources
drwxr-xr-x.  2 crater crater     75 Dec 10 13:30 routes
-rw-r--r--.  1 crater crater    563 Dec  2 14:59 server.php
drwxr-xr-x.  5 crater crater     46 Dec 10 13:30 storage
-rw-r--r--.  1 crater crater   2714 Dec  9 14:08 tailwind.config.js
drwxr-xr-x.  4 crater crater    118 Dec 10 13:30 tests
-rw-r--r--.  1 crater crater    563 Dec 10 13:11 tsconfig.json
drwxr-xr-x. 69 crater crater   4096 Dec 10 13:30 vendor
-rw-r--r--.  1 crater crater    328 Dec  9 14:08 vite.config.ts
-rw-r--r--.  1 crater crater 136435 Dec 10 12:56 yarn.lock

On selecting the database, it then makes request to /api/v1/installation/database/config?connection=sqlite (or ...?connection=pgsql respectively) which returns:

{"config":[],"success":true}

/var/log/nginx/crater.log contains only:

192.168.0.109 - - [02/Jan/2022:21:51:57 +0100] "GET /installation HTTP/1.1" 200 1279 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:57 +0100] "GET /build/assets/main.f55cd568.js HTTP/1.1" 304 0 "http://crater.gehenna/installation" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:57 +0100] "GET /build/assets/vendor.e9042f2c.js HTTP/1.1" 304 0 "http://crater.gehenna/build/assets/main.f55cd568.js" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /build/assets/LayoutInstallation.1e0eeaed.js HTTP/1.1" 304 0 "http://crater.gehenna/build/assets/main.f55cd568.js" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /build/assets/Installation.dba5af35.js HTTP/1.1" 304 0 "http://crater.gehenna/build/assets/main.f55cd568.js" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /build/img/crater-logo.png HTTP/1.1" 304 0 "http://crater.gehenna/installation" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /build/fonts/Poppins-Semibold.ttf HTTP/1.1" 499 0 "http://crater.gehenna/build/assets/main.5b54a72b.css" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /api/v1/installation/wizard-step HTTP/1.1" 200 33 "http://crater.gehenna/installation" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /build/fonts/Poppins-Semibold.ttf HTTP/1.1" 302 394 "http://crater.gehenna/build/assets/main.5b54a72b.css" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:58 +0100] "GET /installation HTTP/1.1" 200 1279 "http://crater.gehenna/build/assets/main.5b54a72b.css" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:51:59 +0100] "GET /api/v1/installation/requirements HTTP/1.1" 200 226 "http://crater.gehenna/installation" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:52:00 +0100] "GET /api/v1/installation/permissions HTTP/1.1" 200 249 "http://crater.gehenna/installation" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
192.168.0.109 - - [02/Jan/2022:21:52:07 +0100] "GET /api/v1/installation/database/config?connection=pgsql HTTP/1.1" 200 39 "http://crater.gehenna/installation" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
DejfCold commented 2 years ago

So ... I've worked around it by changing /public/build/assets/main.f55cd568.js from

[WHATEVER IS HERE]
r({id:"installation",state:()=>({currentDataBaseData:{database_connection:"mysql"
[WHATEVER IS HERE]

to

[WHATEVER IS HERE]
r({id:"installation",state:()=>({currentDataBaseData:{database_connection:"pgsql"
[WHATEVER IS HERE]

But it would still be nice to have it fixed properly