rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.84k stars 272 forks source link

Unable run a node application on rancher Deskstop v1.14.1 for our client #7058

Closed adishM98 closed 2 months ago

adishM98 commented 2 months ago

Actual Behavior

Hi Team,

The issue is faced by one of our clients who is using Rancher Desktop on Mac. The same application works perfectly fine on Docker Desktop.

Steps to Reproduce

Application run command:

nerdctl run --name tooljet \
  --restart unless-stopped \
  -p 80:80 \
  --platform linux/amd64 \
  -v tooljet_data:/var/lib/postgresql/13/main \
  --entrypoint /custom-entrypoint.sh \
  --mount type=bind,source="$(pwd)"/custom-entrypoint.sh,target=/custom-entrypoint.sh \
  tooljet/try:EE-LTS-latest

custom-entrypoint.sh:

#!/bin/bash
set -e

# Start Redis (already running in the Dockerfile setup)
service redis-server start

# Change ownership of PostgreSQL data directory (if necessary, adjust based on container setup)
chown -R postgres:postgres /var/lib/postgresql/13/main

# Backup pg_wal directory if exists (assuming it might not exist initially)
mv /var/lib/postgresql/13/main/pg_wal /var/lib/postgresql/13/main/pg_wal_backup 2>/dev/null || echo 'pg_wal directory does not exist, skipping...'

# Create necessary directories and configuration files (assuming these are already set up by Dockerfile)
mkdir -p /var/lib/postgresql/13/main/pg_wal
mkdir -p /var/lib/postgresql/13/main/pg_wal/archive_status
touch /var/lib/postgresql/13/main/postgresql.conf
echo 'local all all trust' > /var/lib/postgresql/13/main/pg_hba.conf
touch /var/lib/postgresql/13/main/pg_ident.conf

# No need to stop PostgreSQL or reset WAL because it's managed by supervisord

# Start Supervisor (already started in Dockerfile setup)
echo 'Starting Supervisor...'

# Do not start PostgreSQL manually here, as it's managed by supervisord
# PostgreSQL start and management are handled by supervisord configuration

supervisord -c /etc/supervisor/supervisord.conf

# # Keep the container running
# tail -f /dev/null

Result

--------------------------------------------------------------------------------------------------------------------------
error message:
nerdctl run --name tooljet \                                                                                             ─╯
  --restart unless-stopped \
  -p 80:80 \
  --platform linux/amd64 \
  -v tooljet_data:/var/lib/postgresql/13/main \
  --entrypoint /custom-entrypoint.sh \
  --mount type=bind,source="$(pwd)"/custom-entrypoint.sh,target=/custom-entrypoint.sh \
  tooljet/try:EE-LTS-latest
Starting redis-server: redis-server.
pg_wal directory does not exist, skipping...
Starting Supervisor...
2024-06-17 06:54:59,663 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-06-17 06:54:59,664 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2024-06-17 06:54:59,673 INFO RPC interface 'supervisor' initialized
2024-06-17 06:54:59,673 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-06-17 06:54:59,674 INFO supervisord started with pid 65
2024-06-17 06:55:00,690 INFO spawned: 'postgrest' with pid 68
2024-06-17 06:55:00,702 INFO spawned: 'tooljet' with pid 70
Initializing database..
This may take a couple of minutes
2024-06-17 06:55:01,786 INFO success: postgrest entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-06-17 06:55:01,786 INFO success: tooljet entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
/app/server/scripts/init-db-boot.sh: line 7:    82 Segmentation fault      (core dumped) npm run db:create:prod --silent > /dev/null
2024-06-17 06:55:07,226 INFO exited: tooljet (exit status 139; not expected)
2024-06-17 06:55:07,800 INFO spawned: 'tooljet' with pid 128
Initializing database..
This may take a couple of minutes
2024-06-17 06:55:08,925 INFO success: tooljet entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
^CSegmentation fault (core dumped)
Segmentation fault (core dumped)
/app/server/scripts/init-db-boot.sh: line 7:   132 Segmentation fault      (core dumped) npm run db:create:prod --silent > /dev/null

--------------------------------------------------------------------------------------------------------------------------

Expected Behavior

The migration script would start once the services are up. These are logs when running on docker desktop.

docker run \                                                                                                             ─╯
  --name tooljet \
  --restart unless-stopped \
  -p 80:80 \
  --platform linux/amd64 \
  -v tooljet_data:/var/lib/postgresql/13/main \
  tooljet/try:EE-LTS-latest
Starting redis-server: redis-server.
Starting PostgreSQL 13 database server: main.
/usr/lib/python3/dist-packages/supervisor/options.py:474: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  self.warnings.warn(
2024-06-17 07:23:21,097 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-06-17 07:23:21,098 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2024-06-17 07:23:21,100 INFO RPC interface 'supervisor' initialized
2024-06-17 07:23:21,100 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-06-17 07:23:21,100 INFO supervisord started with pid 55
2024-06-17 07:23:22,108 INFO spawned: 'postgrest' with pid 56
2024-06-17 07:23:22,113 INFO spawned: 'tooljet' with pid 57
Initializing database..
This may take a couple of minutes
2024-06-17 07:23:23,396 INFO success: postgrest entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-06-17 07:23:23,396 INFO success: tooljet entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
(node:147) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
(node:192) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
#######################   (100%)

   _____           _   ___      _
  |_   _|         | | |_  |    | |
    | | ___   ___ | |   | | ___| |_
    | |/ _ \ / _ \| |   | |/ _ \ __|
    | | (_) | (_) | /\__/ /  __/ |_
    \_/\___/ \___/|_\____/ \___|\__|

Everything you need to build internal tools!
GitHub: https://github.com/ToolJet/ToolJet

(node:249) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
ToolJet Database enabled: true
The module has been initialized.
Version: 2.50.4.4
Initializing server modules 📡

Additional Information

No response

Rancher Desktop Version

na

Rancher Desktop K8s Version

na

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

macOS

Operating System / Build Version

Sonoma 14.4.1

What CPU architecture are you using?

arm64 (Apple Silicon)

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

jandubois commented 2 months ago

Is there a specific reason to run with CPU emulation: --platform linux/amd64? First thing I would try to use the native image, if available. There are some database engines that don't work correctly in emulation.

Another idea would be switching from QEMU to VZ with Rosetta (or vice versa) to see if that makes a difference. But trying a native image should be a priority, as it would also offer (probably much) better performance.

adishM98 commented 2 months ago

Hi @jandubois,

Thank you for recommending the use of VZ with Rosetta. It resolved the issue we were facing. Thank you again. I will close this issue.

ryanrupp commented 1 month ago

Ran into this as well when upgrading from 1.13.1 to 1.14.1 using mysql:5.7 (which only has linux/amd64 support so runs under emulation) - starts to segfault on startup. Oddly, switching to the debian image mysql:5.7-debian works (but it's also only linux/amd64) - chose this as the solution just to avoid telling all developers to switch over to Rosetta (did not test myself if switching the emulation would fix this but am familiar with various quirks with emulation on ARM based Macs).