alextselegidis / plainpad

📓 Plainpad - Self Hosted Note Taking App
https://alextselegidis.com/get/plainpad
GNU General Public License v3.0
289 stars 26 forks source link

Nginx reverse proxy for docker container #68

Closed proudhon closed 6 months ago

proudhon commented 11 months ago

Any documentation/template for an nginx proxy to the docker container?

this is my nginx config on the host:

server {
    listen 80;
    server_name plainpad.mydomain.com;

    location / {
        proxy_pass http://127.0.0.1:3080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Only php-my-admin works if i point to port 3000. If i point to nginx or php-fpm i get 502.

Note that i have changed port 80 to 3080 and 8080 to 3880 in the docker-compose file. are those ports hard-coded anywhere?

proudhon commented 11 months ago

update:

nginx container logs return:

2023/12/14 16:26:24 [error] 29#29: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 172.27.0.1, server: localhost, request: "GET / HTTP/1.0", upstream: "http://172.27.0.4:3000/", host: "plainpad.[REDACTED]"

Launching curl on http://172.27.0.1:3000 (plainpad-php-fpm) returns connection refused.

plainpad-php-fpm container logs return this error:

➜ Install NPM Dependencies
ERROR: npm v10.2.5 is known not to run on Node.js v14.21.3.  This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.

ERROR:
/usr/lib/node_modules/npm/node_modules/@npmcli/agent/lib/agents.js:105
    options.lookup ??= this.#options.lookup
                   ^^^

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/agent/lib/index.js:7:15)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
alextselegidis commented 11 months ago

Hello!

The logs state an npm installation problem, which probably means that the client dependencies were not installed.

Are you using the default docker config from the github repo or a different one?

Alex Tselegidis, Plainpad Creator
Need a customization? Get a free quote!

proudhon commented 11 months ago

Hi, Yes, i've seen the npm installation problems but i was on a rush and i couldn't elaborate further. Yes, i'm using the default docker-compose file downloaded by cloning the git repo. The only thing i've changed are the db credentials and the exposed ports of the container.

alextselegidis commented 10 months ago

Hello!

Thanks for providing this info.

I will take a closer look at that.

Alex Tselegidis, Plainpad Creator
Need a customization? Get a free quote!

wurst44 commented 9 months ago

Hi, pls keep the development up, looks slick and promising. Sub folders would be a nice feature 👍

Using version 4b24fe9 and docker compose build and run. Same issue, but the npm v10.2.5 is known not to run on Node.js v14.21.3. error seems to be fixed by removing install of npm.

Dockerfile:

    && apt-get install -y nodejs \
    # && npm install -g npm \
    && apt-get install -q -y ssmtp mailutils \

Also having the same issu with the php-fpm:3000 not reachable, php-admin is reachable, no visible error:

php-fpm_1         | audited 1796 packages in 14.675s
php-fpm_1         | 
php-fpm_1         | 287 packages are looking for funding
php-fpm_1         |   run `npm fund` for details
php-fpm_1         | 
php-fpm_1         | found 3 vulnerabilities (1 low, 1 moderate, 1 high)
php-fpm_1         |   run `npm audit fix` to fix them, or `npm audit` for details
php-fpm_1         | ➜ Listen To Incoming Requests
php-fpm_1         | [06-Feb-2024 17:53:11] NOTICE: fpm is running, pid 49
php-fpm_1         | [06-Feb-2024 17:53:11] NOTICE: ready to handle connections
alextselegidis commented 9 months ago

Hello!

Thanks for the updated info.

I will take a look into the current set up.

  Alex Tselegidis, Plainpad Creator
  Need a customization? Contact me in person!

alextselegidis commented 6 months ago

UPDATE: After I tag the first stable versions there will be some major changes in the app, which include the creation of an updated docker-compose configuration that works slightly differently

I will therefore close this ticket for now as it will not apply to the new setup

  Alex Tselegidis, Plainpad Creator
  Need a customization? Contact me in person!