Giter Site home page Giter Site logo

Error running with nginx-proxy about nocodb HOT 6 CLOSED

pavelsr avatar pavelsr commented on April 28, 2024
Error running with nginx-proxy

from nocodb.

Comments (6)

markuman avatar markuman commented on April 28, 2024 1

I've updated the docker image (dockerfile) but haven't pushed it yet.
But let me look into this

from nocodb.

markuman avatar markuman commented on April 28, 2024 1
	-e VIRTUAL_HOST=api.example.com \
	-e VIRTUAL_PORT=3000 \

The xmysql Dockerfile don't know this environment variables.

But nevermind, the docker log xmysql output looks good. The fact that it doesn't response is that I apply new version of xmysql without update the docker-entrypoint.sh file. xmysql is only listen on localhost by default, so it will run inside the docker container and did nothing.

diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 84a52ca..7c00d20 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -1,3 +1,3 @@
 #!/bin/sh
 cd /usr/src/app/
-node index.js -h $DATABASE_HOST -p $DATABASE_PASSWORD -d $DATABASE_NAME -u $DATABASE_USER
\ No newline at end of file
+node index.js -h $DATABASE_HOST -p $DATABASE_PASSWORD -d $DATABASE_NAME -u $DATABASE_USER -n 80 -r 0.0.0.0

The image is already pushed, so you just need to pull and it sould be run. But take care, I've changed the local docker port to 80. So you need to publish -p 3000:80. The benefit is, that you can address xmysql in your other services just with http://xmysql , that's it.

So yes, point taken. we need docker versions which follows xmysql versions. I'll prepare a new merge request with all changes and documentation update.

Here is an minimal example with nginx proxy

1st create nginx.conf

there is no need for upstream the xmysql host.
when you need load balancing, just use docker swarm mode and docker service create --name xmysql --replicas 10 ...

echo '
events {
   worker_connections 1024;
   
}
http {
    server {
        server_name api.example.com 127.0.0.1;
        listen 80 ;
        location / {
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://xmysql;
        }
    }
}
' > /tmp/nginx.conf

2nd create a docker network

make sure you've created a docker network

docker network create local_dev

3rd deploy xmysql

use local_dev network, so other container can reached xmysql by it's name xmysql (the --name value). no need to use ip address in other containers.
we published port 3000 on host system for debugging. internaly the image use now port 80, because then you can easily use wget http://xmysql/

docker run -d \
--network local_dev
--name xmysql
--p 3000:80
-e DATABASE_HOST=example-blog-db-mysql \
-e DATABASE_USER=root \
-e DATABASE_PASSWORD=fab14france \
-e DATABASE_NAME=wordpress \
markuman/xmysql

now check you browser on 127.0.0.1:3000. When not, deploying nginx will fail because the upstream host is not reachable.

4th deploy nginx

docker run -d \
--network local_dev \
--name nginx \
-p 80:80 \
-v /tmp/nginx.conf:/etc/nginx/nginx.conf \
nginx:alpine

from nocodb.

o1lab avatar o1lab commented on April 28, 2024

@markuman : Can you please take a look at this.

from nocodb.

o1lab avatar o1lab commented on April 28, 2024

These stackoverflow questions might be of help.

https://serverfault.com/questions/317393/connect-failed-111-connection-refused-while-connecting-to-upstream

https://stackoverflow.com/questions/36923214/docker-nginx-connection-refused-while-connecting-to-upstream

from nocodb.

o1lab avatar o1lab commented on April 28, 2024

@markuman : well made instructions mate πŸ‘ πŸ™Œ

from nocodb.

o1lab avatar o1lab commented on April 28, 2024

@pavelsr : I hope @markuman 's changes should help resolve with nginx-proxy now. I'll be closing this issue eod. Feel free to reopen if needed.

@markuman - capturing details above of configuring nginx proxy would be useful in documentation ? Could you please help make a pull request to Readme.md. Thank you.

from nocodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.