truecharts / public

Community Helm Chart Repository
https://truecharts.org
GNU Affero General Public License v3.0
1.14k stars 617 forks source link

Strapi - Admin page returns error when fetching from localhost:1337 #7368

Closed dimamarkus closed 1 year ago

dimamarkus commented 1 year ago

App Name

strapi

SCALE Version

22.12.0

App Version

4.6.1_8.0.29

Application Events

2023-02-18 0:10:27
Startup probe failed: dial tcp 172.16.1.224:1337: connect: connection refused
2023-02-18 0:10:14
Successfully pulled image "tccr.io/truecharts/strapi:4.6.1@sha256:60da6fd6c07d2e0c27ad9f807cbbaccbad50c16a7ea8d20a76b103bba0f644c6" in 405.181039ms
2023-02-18 0:10:14
Created container strapi
2023-02-18 0:10:14
Started container strapi
2023-02-18 0:10:13
Pulling image "tccr.io/truecharts/strapi:4.6.1@sha256:60da6fd6c07d2e0c27ad9f807cbbaccbad50c16a7ea8d20a76b103bba0f644c6"
2023-02-18 0:10:12
Updated LoadBalancer with new IPs: [] -> [192.168.50.236]
2023-02-18 0:10:10
Job completed
2023-02-18 0:10:10
Ensuring load balancer
2023-02-18 0:10:10
Applied LoadBalancer DaemonSet kube-system/svclb-strapi-67ee6c79
2023-02-18 0:10:01
Add eth0 [172.16.1.225/16] from ix-net
2023-02-18 0:10:01
Container image "tccr.io/truecharts/kubectl:v1.26.0@sha256:6d6e0e50f28b961ed1c1c6a9c140553238641591fbdc9ac7c1a348636f78c552" already present on machine
2023-02-18 0:10:01
Created container strapi-manifests
2023-02-18 0:10:01
Started container strapi-manifests

Application Logs

Pod Connection Error: kubernetes.pod_log_follow:{"release_name":"strapi", "pod_name":"strapi-postgresql-0", "container_name":"strapi-postgresql", "tail_lines": 500} nosub

Then what IS in the log is: 

2023-02-18 05:09:48.620356+00:00postgresql 05:09:48.61 
2023-02-18 05:09:48.621989+00:00postgresql 05:09:48.62 Welcome to the Bitnami postgresql container
2023-02-18 05:09:48.623551+00:00postgresql 05:09:48.62 Subscribe to project updates by watching https://github.com/bitnami/containers
2023-02-18 05:09:48.625228+00:00postgresql 05:09:48.62 Submit issues and feature requests at https://github.com/bitnami/containers/issues
2023-02-18 05:09:48.626890+00:00postgresql 05:09:48.62 
2023-02-18 05:09:48.644063+00:00postgresql 05:09:48.64 INFO  ==> ** Starting PostgreSQL setup **
2023-02-18 05:09:48.698738+00:00postgresql 05:09:48.66 INFO  ==> Validating settings in POSTGRESQL_* env vars..
2023-02-18 05:09:48.707201+00:00postgresql 05:09:48.70 INFO  ==> Loading custom pre-init scripts...
2023-02-18 05:09:48.712116+00:00postgresql 05:09:48.71 INFO  ==> Initializing PostgreSQL database...
2023-02-18 05:09:48.732422+00:00postgresql 05:09:48.73 INFO  ==> pg_hba.conf file not detected. Generating it...
2023-02-18 05:09:48.734476+00:00postgresql 05:09:48.73 INFO  ==> Generating local authentication configuration
2023-02-18 05:09:48.927862+00:00postgresql 05:09:48.92 INFO  ==> Deploying PostgreSQL with persisted data...
2023-02-18 05:09:48.940438+00:00postgresql 05:09:48.93 INFO  ==> Configuring replication parameters
2023-02-18 05:09:48.971801+00:00postgresql 05:09:48.97 INFO  ==> Configuring fsync
2023-02-18 05:09:48.980073+00:00postgresql 05:09:48.97 INFO  ==> Configuring synchronous_replication
2023-02-18 05:09:48.999534+00:00postgresql 05:09:48.99 INFO  ==> Loading custom scripts...
2023-02-18 05:09:49.004591+00:00postgresql 05:09:49.00 INFO  ==> Enabling remote connections
2023-02-18 05:09:49.015977+00:00postgresql 05:09:49.01 INFO  ==> ** PostgreSQL setup finished! **
2023-02-18 05:09:49.016027+00:002023-02-18T05:09:49.016027333Z
2023-02-18 05:09:49.038357+00:00postgresql 05:09:49.03 INFO  ==> ** Starting PostgreSQL **
2023-02-18 05:09:49.059636+00:002023-02-18 05:09:49.059 GMT [1] LOG:  pgaudit extension initialized
2023-02-18 05:09:49.070734+00:002023-02-18 05:09:49.070 GMT [1] LOG:  starting PostgreSQL 14.6 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-02-18 05:09:49.071252+00:002023-02-18 05:09:49.071 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-02-18 05:09:49.071282+00:002023-02-18 05:09:49.071 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2023-02-18 05:09:49.080319+00:002023-02-18 05:09:49.080 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2023-02-18 05:09:49.094924+00:002023-02-18 05:09:49.094 GMT [85] LOG:  database system was shut down at 2023-02-18 05:03:37 GMT
2023-02-18 05:09:49.109493+00:002023-02-18 05:09:49.109 GMT [1] LOG:  database system is ready to accept connections
failed to create fsnotify watcher: too many open files

Application Configuration

App Config - Part 1 App Config - Part 2

Describe the bug

By default, Strapi runs on port 1337. This TrueNAS chart App leaves that default configuration. The problem is that TrueNAS requires app containers to expose ports 9000 and above. If I change the exposed port of the container (to 10337 for example), the app boots up but because of some internal configuration still has code pointing to port '1337'. Attempting to pass in a configuration ENV variable into the container to fix this yields the error submitted here.

Resulting Error

To Reproduce

  1. Install the app with a port higher than 9000.
  2. Go to the admin section
  3. Encounter error

Expected Behavior

I expected the apps internal API calls to the database to match the PORT I assigned.

Screenshots

Screen Shot 2023-02-18 at 12 19 18 AM App Pod Logs App DB Pod Logs

Additional Context

*

I've read and agree with the following

xstar97 commented 1 year ago

The issue here is not the assigned port... you need to shell into the app and run a command to build the admin panel.

Also set it to development mode too.

npm run build

Our code actually keeps the port as 1337 internally since we set the target port to 1337... the expose port can be anything you want 1337 or over 9000.

Join our discord if you want to chat about apps or get help faster in our support channel ;)

You might have some issues fsnotify you can resolved, plenty of threads on that in our discord.

Our min requirements for our apps is for the app pool to have an ssd or hdd with a special metadata vdev(ssd). Read more here.

dimamarkus commented 1 year ago

@xstar97

Hi. Thank you for your reply.

Screen Shot 2023-02-18 at 1 22 22 AM
xstar97 commented 1 year ago

@xstar97

Hi. Thank you for your reply.

  • My server meets the minimum requirements and im running many others apps successfully through TrueCharts.
  • I have followed your npm run build instructions but the result is the same error. The console mentions the CSRP. Maybe that is the issue?
Screen Shot 2023-02-18 at 1 22 22 AM

My apologies, did you turn the app off and then back on afterwards?

This might be better conversation for our discord 😅.

dimamarkus commented 1 year ago

✅ SOLUTION:

Running npm run build inside the shell of the app container, followed by a restart of the App from TrueNAS UI solved this issue for me even with the default port 1337.

PrivatePuffin commented 1 year ago

@xstar97 can you add the restart to docs?

truecharts-admin commented 1 year ago

This issue is locked to prevent necro-posting on closed issues. Please create a new issue or contact staff on discord of the problem persists