yongjhih / docker-parse-server

Provide docker images and docker stack for parse-server npm versions and latest commit
https://hub.docker.com/r/yongjhih/parse-server/
Apache License 2.0
475 stars 166 forks source link

Dashboard unable to connect to server #62

Open TAProgramming opened 7 years ago

TAProgramming commented 7 years ago

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Dashboard!

I'm running Ubuntu 14.04 with Docker 1.11.2 on a Digital Ocean server.

docker run -d \ -e DATABASE_URI=${DATABASE_URI:-xxxx} \ -e APP_ID=${APP_ID:-xxxx} \ -e MASTER_KEY=${MASTER_KEY:-xxxx} \ -e FILE_KEY=${FILE_KEY:-xxxx} \ -p 127.0.0.1:1337:1337 \ --name parse-server \ yongjhih/parse-server

docker run -d \ -p 127.0.0.1:2022:22 \ --volumes-from parse-server \ --name parse-cloud-code-git \ yongjhih/parse-server:git

docker run -d -e PARSE_DASHBOARD_CONFIG='{ "apps": [ { "serverURL": "https://localhost:1337/parse/", "appId": "xxxx, "masterKey": "xxxx", "appName": "xxxx" } ], "users": [ { "user":"Admin", "pass":"Qwerty" } ] }' -p 4040:4040 --link parse-server --name parse-dashboard yongjhih/parse-dashboard

I have parse server, cloud code and dashboard running on localhost as per configuration. I have SSL set up with Lets-Encrypt and my domain is connecting to localhost via an Nginx wrapper.

My Nginx config:

# HTTPS - serve HTML from /usr/share/nginx/html, proxy requests to /parse/
# through to Parse Server
server {
        listen 443;
        server_name xxxx.com;

        root /usr/share/nginx/html;
        index index.html index.htm;

        ssl on;
        # Use certificate and key provided by Let's Encrypt:
        ssl_certificate /etc/letsencrypt/live/xxxx.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/xxxx.com/privkey.pem;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers 'xxxx';

        # Pass requests for /parse/ to Parse Server instance at localhost:1337
        location /parse/ {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-NginX-Proxy true;
                proxy_pass http://localhost:1337/parse/;
                proxy_ssl_session_reuse off;
                proxy_set_header Host $http_host;
                proxy_redirect off;
        }

    location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-NginX-Proxy true;
                proxy_pass http://localhost:4040/;
                proxy_ssl_session_reuse off;
                proxy_set_header Host $http_host;
                proxy_redirect off;
        }
}

Steps to reproduce

My Javascript Parse Web App connects to Parse Server and my MongoDB perfectly. Dashboard is the problem. Localhost won't even connect, even if I try via HTTP. If I stop securing the ports by removing "127.0.0.1", use the serverURL in the dashboard config as my server's IP "http://xx.xxx.xxx.xx:1337/parse" and add -e PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1. Then I can connect via HTTP. However I need to connect via HTTPS. My domain name set up via Nginx won't work either as the server URL option, even though I'm using my domain URL to connect my javascript web app to my parse server.

Please help. Thanks. :)

yongjhih commented 7 years ago

Ok, you wrapped a https proxy (https://your-parse-sever/parse) for parse-server (:1337). I think you must make https proxy work correctly first.

Try to run parse-server and parse-dashboard with -e SERVER_URL=https://your-parse-sever/parse

TAProgramming commented 7 years ago

Thanks for replying. I have tried your suggestion, however it now comes up with "unauthorized" on Parse Dashboard. If I remove -e PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1 from the config then it comes up with this error even though it definitely is going through https: "Parse Dashboard can only be remotely accessed via HTTPS". My Master Keys are identical on both configurations for Parse server and dashboard. Parse Server still functions correctly with my javascript web app though. Dashboard still not playing nice.

TAProgramming commented 7 years ago

SOLVED. Problem was incompatibility with parse server version - BUG. Solution: used yongjhih/parse-server:dev (v. 2.2.18) Also used yongjhih/parse-dashboard:1.0.15

This combination works. No need for SERVER_URL on parse server config. Used https://xxx.com/parse/ on parse dashboard config. This is the domain with SSL configured with letsencrypt and is a wrapper through Nginx proxy to http://localhost:1337/parse/

TAProgramming commented 7 years ago

Update on bug. If I call yongjhih/parse-server:2.2.18 directly when starting docker container for parse server, then parse dashboard comes up with unauthorized again and no longer connects to server.

However if I call yongjhih/parse-server:dev when starting docker container then dashboard connects through HTTPS to the server and it all works correctly. This is despite yongjhih/parse-server:dev using version 2.2.18 anyway.

agordeev commented 7 years ago

I'm having the same issue. parse-server:dev and parse-dashboard:1.0.18.