Docker build + installation (Help)

hello, i am trying to setup parse server and i am getting this issue:

docker run --name sync-server -v cloud-code-vol:/sync-config/cloud -v config-vol:/sync-config/config -p 1337:1337 -d sync-server --appId appid --masterKey ***REDACTED*** --databaseURI postgres://sync:[email protected]/sync-serve r

cacheMaxSize: 10000
cacheTTL: 5000
customPages: {}
databaseURI: postgres://sync:[email protected]/sync-server
enableAnonymousUsers: true
expireInactiveSessions: true
graphQLPath: /graphql
host: localhost
logsFolder: ./logs
masterKey: ***REDACTED***
masterKeyIps: []
maxUploadSize: 20mb
mountPath: /parse
objectIdSize: 10
playgroundPath: /playground
port: 1337
protectedFields: {"_User":{"*":["email"]}}
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
sessionLength: 31536000
allowCustomObjectId: false
collectionPrefix:
directAccess: false
enableExpressErrorHandler: false
enableSingleSchemaCache: false
mountGraphQL: false
mountPlayground: false
preserveFileName: false
preventLoginWithUnverifiedEmail: false
scheduledPush: false
verifyUserEmails: false
jsonLogs: false
verbose: false
level: undefined
serverURL: http://localhost:1337/parse

[1] parse-server running on http://localhost:1337/parse
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}

WARNING, Unable to connect to 'http://localhost:1337/parse'. Cloud code and push notifications may be unavailable!

warn: Unable to ensure uniqueness for usernames: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to create case insensitive username index: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to ensure uniqueness for user email addresses: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to create case insensitive email index: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to ensure uniqueness for role name: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}

i can do psql postgres://sync:[email protected]/sync-server and will connect to the DB.

if someone can give me some tips thank you.

I think your parse-server config need to set the “cloud: /absolute/path/code.js”, that on your Docker command will be at the volume “/sync-config/cloud/your-file.js”.

Another issue that I see by the log is the usage of the port “5432”, but your DB is running on por “123456”…

123456 is the password, @localhost will give the host and the port will use the default 5432, so i dont need to put it.

i put absolute path but have the same error:

docker run --name sync-server -v cloud-code-vol:/opt/aservices/apps/sync-server/sync-config/cloud -v config-vol:/opt/aservices/apps/sync-server/sync-config/config -p 1337:1337 -d sync-server --appId appID --masterKey key --databaseURI postgres://sync:[email protected]/sync-server

docker logs sync-server 
allowClientClassCreation: true
appId: appid
cacheMaxSize: 10000
cacheTTL: 5000
customPages: {}
databaseURI: postgres://sync:[email protected]/sync-server
enableAnonymousUsers: true
expireInactiveSessions: true
graphQLPath: /graphql
host: 0.0.0.0
logsFolder: ./logs
masterKey: ***REDACTED***
masterKeyIps: []
maxUploadSize: 20mb
mountPath: /parse
objectIdSize: 10
playgroundPath: /playground
port: 1337
protectedFields: {"_User":{"*":["email"]}}
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
sessionLength: 31536000
allowCustomObjectId: false
collectionPrefix: 
directAccess: false
enableExpressErrorHandler: false
enableSingleSchemaCache: false
mountGraphQL: false
mountPlayground: false
preserveFileName: false
preventLoginWithUnverifiedEmail: false
scheduledPush: false
verifyUserEmails: false
jsonLogs: false
verbose: false
level: undefined
serverURL: http://localhost:1337/parse

[1] parse-server running on http://localhost:1337/parse
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}
warn: Unable to ensure uniqueness for usernames: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to create case insensitive username index: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to ensure uniqueness for user email addresses: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to create case insensitive email index: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
warn: Unable to ensure uniqueness for role name: connect ECONNREFUSED 127.0.0.1:5432 {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":"Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}

Well, if the DB server is on another Docker container “localhost” (on container localhost mean the container itself, not the host) will not work, you can use the container name, or your local IP address, like “192.168.0.10:5432” on the DB param.

Is on the host and not on a container

Ok, use the host IP (local IP) to connect to DB, because can be a Docker issue to understand “localhost” as the Host inside the container.

how can i do that?, sorry for bothering.

Replace “localhost” by your local IP address like this: databaseURI: postgres://sync:[email protected]/sync-server - in this case 192.168.0.10 is the IP.

If you don’t know your local network ip, search on google how “how to get my local IP on Windows/Mac/Linux”… :+1:

ok, that worked, but now i try to install parse-dashboard too on docker, but i am getting blank page.

You can use the Parse Dashboard imagem from docker-hub, the oficial image, then just configure the settings to connect with your parse server (not DB), using the same local IP address with the parse server port.

tryed the same withe docker pull parseplatform/dashboard:

docker run -d -p 4040:4040 parseplatform/parse-dashboard --dev --appId appid --masterKey key --serverURL http://localhost:1337/parse --publicServerURL ds.astian.org

but:

Apache Vhost Proxy

<VirtualHost *:443>
#ServerAdmin [email protected]
ServerName www.ds.astian.org
ServerAlias ds.astian.org

ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:4040
ProxyPassReverse / http://localhost:4040
#SSLProxyEngine on

<Proxy *>
Require all granted

don’t loose time with IP address lookups

HostnameLookups Off

needed for named virtual hosts

UseCanonicalName Off

configures the footer on server-generated documents

ServerSignature On

SSLCertificateFile fullchain.pem
SSLCertificateKeyFile privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

Error Logs:
[Mon Jul 20 00:26:54.918918 2020] [proxy:error] [pid 27312] [client ip:2822] AH00898: DNS lookup failure for: localhost:4040error returned by /error/HTTP_BAD_GATEWAY.html.var, referer: https://ds.astian.org/
[Mon Jul 20 00:26:55.142398 2020] [proxy:error] [pid 27312] [client ip:2822] AH00898: DNS lookup failure for: localhost:4040favicon.ico returned by /favicon.ico
[Mon Jul 20 00:26:55.142594 2020] [proxy:error] [pid 27312] [client ip:2822] AH00898: DNS lookup failure for: localhost:4040error returned by /error/HTTP_BAD_GATEWAY.html.var
[Tue Jul 21 10:59:13.129313 2020] [ssl:warn] [pid 25192] AH01909: www.ds.astian.org:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jul 21 10:59:13.162889 2020] [ssl:warn] [pid 25192] AH01909: www.ds.astian.org:443:0 server certificate does NOT include an ID which matches the server name
[Tue Jul 21 11:09:52.982948 2020] [proxy:error] [pid 26707] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4040 (localhost) failed
[Tue Jul 21 11:09:52.983003 2020] [proxy_http:error] [pid 26707] [client ip:55246] AH01114: HTTP: failed to make connection to backend: localhost
[Tue Jul 21 11:09:52.983361 2020] [proxy:error] [pid 26707] [client ip:55246] AH00898: DNS lookup failure for: localhost:4040error returned by /error/HTTP_SERVICE_UNAVAILABLE.html.var
[Tue Jul 21 11:11:17.967763 2020] [proxy:error] [pid 27414] [client ip:55260] AH00898: DNS lookup failure for: localhost:4040bundles returned by /bundles/dashboard.bundle.js, referer: https://ds.astian.org/
[Tue Jul 21 11:11:17.968102 2020] [proxy:error] [pid 27414] [client ip:55260] AH00898: DNS lookup failure for: localhost:4040error returned by /error/HTTP_BAD_GATEWAY.html.var, referer: https://ds.astian.org/

Again, do not use “localhost” to connect to others containers, for example: --serverURL http://192.168.0.10:1337/parse --publicServerURL http://192.168.0.10:1337/parse

thank, i am using the ip, but dashboard from the oficial repo on hub.docker.org and the one on the github, appear on blank showing this error.

Well, can be something on your machine, network, to me works fine this Docker image, I’ve tested now.

how can i enable dashboard to access from a subdomain?

like you can see, i created an apache vhost, on the old post, but i am getting this error of loading,

but if i create a tunnel with ssh -L, will work.

docker run -d --network=host parseplatform/parse-dashboard --appName Astian-Sync --appId appid --masterKey masterkey --serverURL http://localhost:1337/parse --allowInsecureHTTP true

<IfModule mod_ssl.c>
<VirtualHost *:443>
#ServerAdmin [email protected]
ServerName www.ds.astian.org
ServerAlias ds.astian.org

ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:4040
ProxyPassReverse / http://localhost:4040
#SSLProxyEngine on

<Proxy *>
Require all granted
</Proxy>

# if not specified, the global error log is used
ErrorLog /var/log/apache2/aservices/sync/ds_error_log
CustomLog /var/log/apache2/aservices/sync/ds_access_log combined

# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On



SSLCertificateFile /etc/letsencrypt/live/ds.astian.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ds.astian.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>