Closed changchichung closed 9 months ago
I have the same problem.
See #283
Hi, can you try setting your docker client env to:
NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false
We probably need to update the default settings to this
Hi, can you try setting your docker client env to:
NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false NUXT_PUBLIC_ENV=local NUXT_PUBLIC_PAID_PLANS_ENABLED=false NUXT_PUBLIC_S3_ENABLED=false
We probably need to update the default settings to this
still not working , the same error messages.
my docker command
NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false NUXT_PUBLIC_ENV=local NUXT_PUBLIC_PAID_PLANS_ENABLED=false NUXT_PUBLIC_S3_ENABLED=false docker run --name opnform -v $PWD/.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 km/opnform
docker logs
192.168.100.55 - - [31/Jan/2024:07:35:29 +0000] "GET / HTTP/1.1" 301 138 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0"
Redirecting to main domain {
reason: 'header_mismatch',
customDomainHeaderValue: undefined,
host: '192.168.100.2'
}
The issue comes from this code: /client/lib/utils.js#L75-L81
export const customDomainUsed = function() {
const config = useRuntimeConfig()
const appDomain = getDomain(config.public.appUrl)
const host = getHost()
return host !== appDomain && getDomain(host) !== appDomain
}
Please make sure that NUXT_PUBLIC_APP_URL
has the right value? It should be the same as your app URL, so I believe 192.168.100.2
in your case
my docker command
docker run --name opnform -v $PWD/.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 jhumanj/opnform
my .env file
2024-01-31 16:59:56 [administrator@ubuntu-jammy-server OpnForm main ]$ cat .env
APP_NAME="OpnForm"
APP_ENV=local
APP_KEY=base64:HR7785OpccUnYEk6Mbkl4rnkB22ggfkTzNuGCUTO/4A=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://localhost
LOG_CHANNEL=errorlog
LOG_LEVEL=debug
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres
FILESYSTEM_DRIVER=s3
FILESYSTEM_DISK=s3
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
JWT_TTL=1440
JWT_SECRET=9yaUSlRlBcdmiHoYL59i4XPtsmmGKS5dQt5Hhb2dwGphZAmqPJmhcQvmrADt9vkh
MUX_WORKSPACE_ID=
MUX_API_TOKEN=
OPEN_AI_API_KEY=
#FRONT_URL="http://192.168.100.2:8007"
NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false
NUXT_PUBLIC_APP_URL="http://192.168.100.2:8007"
FRONT_API_SECRET=TiZMuWIF
same error in docker log
Redirecting to main domain {
reason: 'header_mismatch',
customDomainHeaderValue: undefined,
host: '192.168.100.2'
}
@changchichung there are 2 .env
files, one for client and one for Nuxt, please make sure to pass the nuxt .env to nuxt
Custom Laravel .env file:
docker run --name opnform -v $PWD/custom-laravel-env-file.env:/app/.env -v $PWD/my-opnform-data:/persist -p 80:80 jhumanj/opnform
Custom Nuxt .env file:
docker run --name opnform -v $PWD/custom-nuxt-env-file.env:/app/client/.env -v $PWD/my-opnform-data:/persist -p 80:80 jhumanj/opnform
even with Custom Nuxt .env file , the error was still there.
but in docker logs , I found something interseting .
Now using node v20.11.0 (npm v10.2.4)
Creating default alias: default -> 20 (-> v20.11.0 *)
Now using node v20.11.0 (npm v10.2.4)
/usr/local/bin/nuxt-wrapper.sh: line 12: /app/.nuxt.env: No such file or directory
/usr/local/bin/nuxt-wrapper.sh: line 14: env.sh: No such file or directory
Listening on http://[::]:3000
so I mapping .env file to /app/.nuxt.env instead of mapping to /app/client/.env , and now it works ! I can see the homepage now , but some imgs are missing.
I'll give this a proper try this afternoon, could you please try to send me all the steps to reproduce?
git clone https://github.com/JhumanJ/OpnForm
cd OpnForm
add a start.sh
#!/bin/bash
#docker run --name opnform -v ./.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 jhumanj/opnform
docker run --name opnform -d -v ./.env:/app/client/.env -v ./.env:/app/.nuxt.env -v $PWD/my-opnform-data:/persist -p 8007:80 jhumanj/opnform
cp .env.docker .env append
NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false
NUXT_PUBLIC_APP_URL="192.168.100.2"
to .env file
then run start.sh to bring up the container.
and when I try to open the image URL , there are some error in browser .
{"error":{"message":"[500] [IPX_ERROR] Could not load the \"sharp\" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install"}}
Hi there, I just went through the process again, without changing any .env files and it worked just fine. I only ran docker run --name opnform -v $PWD/my-opnform-data:/persist -p 8000:80 --platform linux/amd64 jhumanj/opnform
Can you please try this yourself without customizing the .env files?
ok , here is complete log of my steps , just git clone and docker run , it's the same error.
I just simplified the custom domain handling for docker environment to avoid this issue, can please try again pulling the latest docker image?
ok , with the latest docker image , the container works ! thanks !
but some images are still missing.
when I try to directly open the img file , it throw out some error
{
"error": {
"message": "[500] [IPX_ERROR] Could not load the \"sharp\" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install"
}
}
We're working on it!
Fixed! I'll draft the release now! https://github.com/JhumanJ/OpnForm/pull/312
docker logs
I also try cp .docker.env .env and mapping .env to container, my docker command
and part of my .env file
so , where should I modify the customdomain value ? ?