njdowdy

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by njdowdy

  1. @aptalca, after digging around further, I stumbled on some resources for setting up the stream module (e.g., https://www.nginx.com/blog/tcp-load-balancing-udp-load-balancing-nginx-tips-tricks/. However, I still haven't been able to get it up and running, mainly because I'm not sure what the proxy-conf file should look like for a docker needing to utilize the stream module. I added the following to my nginx.conf (previous was default nginx.conf that comes with the letsencrypt docker): http{ #default stuff } stream { upstream stream_backend { # 10.20.30.222:5432 is the postgres docker address that is functioning on local network server 10.20.30.222:5432; } server { listen 5432; proxy_pass stream_backend; } } I tried many variations of "postgres.subdomain.conf" files, however none of them worked. My naive thinking is that nginx would be taking traffic from 443 and the stream module would somehow map that to a local address as if the remote location was inside the local network (10.20.30.222:5432 in this case). So, I expected it to look something like the below code. Attempting to connect remotely with pgadmin4 requires a hostname and a specified port. If I pass "5432" I get "Unable to connect to server: timeout expired" and passing port "443" gives me "Unable to connect to server: received invalid response to SSL negotiation: H" (this one is probably not surprising). server { listen 443 ssl; listen [::]:443 ssl; server_name postgres.*; include /config/nginx/ssl.conf; proxy_redirect off; proxy_buffering off; client_max_body_size 0; location / { include /config/nginx/proxy.conf; resolver 127.0.0.11 valid=30s; #TCP traffic should be forwarded to the "stream_backend" upstream group set $upstream_postgres stream_backend; proxy_pass http://$upstream_postgres; } } I don't understand how to tell nginx to take in an address like "postgres.mydomain.com" and resolve that as if it were localhost:5432 on my local network. I really appreciate any guidance! I'm excited to learn how the stream module works, because I think it will open up a lot of new potential for my server. Thanks!
  2. Ah, well that would make sense then. I wasn't aware of this. Two questions: 1. How would one determine when a docker does and does not come with a webserver? (in case I run into this again in the future) 2. Would you mind posting or linking some info on setting up the stream plugin/module and/or a .conf for these types of dockers? I did some forum searches, but it wasn't clear to me what the correct steps are. I saw you post on the subject elsewhere but I don't think I have interpreted your instruction correctly. Thanks so much, yet again!
  3. Hey aptalca, Thanks for your help with setting up pgadmin4. My users now want to access postgres via subdomain directly, rather than through pgadmin4. I think I might have the ports messed up again, because my attempt at setting it up failed. I can access via local network on port 5432, but the subdomain functionality doesn't work yet. Here's my custom postgres.subdomain.conf (which I want to give access to my postgres docker using postgres.mydomain.com): server { listen 443 ssl; listen [::]:443 ssl; server_name postgres.*; include /config/nginx/ssl.conf; proxy_redirect off; proxy_buffering off; client_max_body_size 0; location / { include /config/nginx/proxy.conf; resolver 127.0.0.11 valid=30s; set $upstream_postgres myPostgresDocker; proxy_pass http://$upstream_postgres:5432; } } My error before was using the incorrect port, but I thought postgres used port 5432. I believe I have the docker ports set up correctly as: 172.18.0.8:5432/TCP <-> mylocalhost:5432 Thanks so much in advance!
  4. What is the recommended way of serving a database connection to this docker outside of the local network? Is it possible to set it up via a subdomain with something like LetsEncrypt? Thanks in advance!
  5. Yup! That solved it. Thanks! I was still thinking about passing the forwarded port (5050) from when I was hosting it on my local network. Thanks so much!
  6. I'm looking for advice on how to setup a subdomain.conf for a custom docker. I'm trying to emulate what's described here: https://pgsnake.blogspot.com/2019/07/reverse-proxying-to-pgadmin.html I've also tried to use some other of the provided templates to build from. Here's what I have: # filename: pgsql.subdomain.conf server { listen 443 ssl; listen [::]:443 ssl; server_name pgsql.*; include /config/nginx/ssl.conf; proxy_redirect off; proxy_buffering off; client_max_body_size 0; location / { include /config/nginx/proxy.conf; resolver 127.0.0.11 valid=30s; # custom docker's name: pgadmin4 set $upstream_pgadmin4 pgadmin4; proxy_pass http://$upstream_pgadmin4:5050; } } In the custom docker the network type is set to custom and pointed at my proxy network. Letsencrypt docker has pgsql as a subdomain to look out for. When I restart letsencrypt docker and visit the subdomain (pgsql.mydomain.com) I get an nginx 502 bad gateway. Have I forgotten something in my configuration? The only thing I can see from other templates is not including any "proxy_set_header"'s, but I'm not really sure what those are and if they are needed. Thanks in advance!
  7. I'm having trouble setting up pg_restore. There is no pg_restore bin that I can find, so I pulled a copy from the Linux (other version) EnterpriseDB tar.gz archive for Postgres10. I used the Postgres10 docker (by postgres) to ensure the pg_restore matched the PostgreSQL version. I placed the pg_restore bin in the /appdata/pgadmin/config/storage/pgadmin4 which I found mapped to "/" in pgadmin4 (for some reason the additional paths I setup in the docker configuration are not working). In pgadmin4, I set the File > Preferences > Paths > Binary Paths all to "/" since that is there I placed the pg_restore bin. When I setup a server and attempt to restore my .backup file the process starts and runs infinitely. Upon checking the logs, I get the following message: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/pgadmin4/pgadmin/misc/bgprocess/process_executor.py", line 312, in execute command, stdout=PIPE, stderr=PIPE, stdin=None, **kwargs File "/usr/local/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/local/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/pg_restore': '/pg_restore' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/pgadmin4/pgadmin/misc/bgprocess/process_executor.py", line 533, in <module> execute() File "/usr/local/lib/python3.6/site-packages/pgadmin4/pgadmin/misc/bgprocess/process_executor.py", line 349, in execute info = _log_exception() File "/usr/local/lib/python3.6/site-packages/pgadmin4/pgadmin/misc/bgprocess/process_executor.py", line 70, in _log_exception fp.write('EXCEPTION::\n{0}'.format(res)) TypeError: a bytes-like object is required, not 'str' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/pgadmin4/pgadmin/misc/bgprocess/process_executor.py", line 535, in <module> _log_exception() File "/usr/local/lib/python3.6/site-packages/pgadmin4/pgadmin/misc/bgprocess/process_executor.py", line 70, in _log_exception fp.write('EXCEPTION::\n{0}'.format(res)) TypeError: a bytes-like object is required, not 'str' Obviously, pgadmin4 can't find my pg_restore binary, or something else is wrong. I'd appreciate any help in restoring my .backup so I can store and serve it from unraid. Cheers,