crater-invoice / crater

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

Onboarding failed with docker and traefik #452

Open loranger opened 3 years ago

loranger commented 3 years ago

Describe the bug I can't get onboarding complete : Once I'm redirected to the mail setting step, I am logged out and forwarded to the login form

Expected behavior I would be able to fill in the mail settings and finish the setup wizard

Screenshots Here is the login form where I'm always redirected

Capture d’écran 2021-05-04 à 09 13 25

Please complete the following information:

Optional info

Additionally, here are the setting files I use to make it run

docker-compose.yml ```yaml version: '3.7' services: app: build: args: user: crater-user uid: 1000 context: ./ dockerfile: Dockerfile image: crater-php container_name: ${APP_PROJECT}-php restart: unless-stopped env_file: - .env working_dir: /var/www/ volumes: - ./:/var/www - ./docker-compose/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini:rw,delegated networks: - crater db: image: mariadb container_name: ${APP_PROJECT}-db restart: always env_file: - .env volumes: # - db:/var/lib/mysql # If you want to persist data on the host, comment the line above this one... # and uncomment the line under this one. - ./docker-compose/db/data:/var/lib/mysql:rw,delegated environment: MYSQL_USER: ${DB_USERNAME} MYSQL_PASSWORD: ${DB_PASSWORD} MYSQL_DATABASE: ${DB_DATABASE} MYSQL_ROOT_PASSWORD: crater # ports: # - '33006:3306' networks: - crater nginx: image: nginx:stable-alpine container_name: ${APP_PROJECT}-nginx env_file: - .env restart: unless-stopped # ports: # - 80:80 volumes: - ./:/var/www # - ./docker-compose/nginx:/etc/nginx/conf.d/ - ./docker-compose/nginx/nginx.conf:/etc/nginx/templates/default.conf.template labels: - "traefik.http.routers.${APP_PROJECT}.rule=Host(`${APP_URL}`)" - "traefik.http.services.${APP_PROJECT}-service.loadbalancer.server.port=80" networks: - crater volumes: db: networks: crater: external: name: web ```
nginx.conf ```nginx server { client_max_body_size 64M; listen 80; index index.php index.html; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /var/www/public; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass ${APP_PROJECT}-php:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } location / { try_files $uri $uri/ /index.php?$query_string; gzip_static on; } } ```
.env ```shell APP_ENV=production APP_KEY=base64:8+zkgs1jtpHldms7D4J/QZp8L1qudRVluXBzRldwSuQ= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=crater.rock APP_PROJECT=crater DB_CONNECTION=mysql DB_HOST=${APP_PROJECT}-db DB_PORT=3306 DB_DATABASE=crater DB_USERNAME=crater-user DB_PASSWORD="crater-secret" BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_DRIVER=sync SESSION_DRIVER=cookie SESSION_LIFETIME=1440 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST= MAIL_PORT= MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION= PUSHER_APP_ID= PUSHER_KEY= PUSHER_SECRET= SANCTUM_STATEFUL_DOMAINS=crater.rock SESSION_DOMAIN=crater.rock ```
loranger commented 3 years ago

I dig a little deeper and used the default credentials I found in the UserTableSeeder.

I was able to login, and then return to /on-boarding in order to complete the setup, but I'm quite sure that's not the way it should work

patricklucas commented 3 years ago

@loranger I was fighting this most of the day until I found this post. I tried this, and the login was successful, but the 401s then continued.

I did notice that some requests were failing due to a too-large header being sent to Nginx, and indeed the cookies being sent were enormous—and there were many redundant cookies from my iterations on trying to get onboarding working, since Crater (or Laravel?) seem to use random cookie names which don't get cleaned up. Once I deleted all cookies and tried again, I was able to get through the onboarding.

loranger commented 3 years ago

I still have this issue with the homepage : I can't login and get an error message. But as soon as I refresh the page, I get logged on the dashboard.

I think there is an issue with sanctum, but I can't figure out which one (domaine are correct in .env, and cookies seems legits…)

realitymolder commented 1 year ago

Is there a need to create that with nginx when using traefik? or this nginx only use for the crater self network ?