menu

Clever Beagle

Chat with other product developers and get help with Clever Beagle's tools and resources.

Channels
Team

Bug deployment on heroku

January 14, 2019 at 4:37pm

Bug deployment on heroku

January 14, 2019 at 4:37pm
Hi,
**1) In the first time,** when I deployed the origin code to heroku server with git clone https://github.com/cleverbeagle/pup <my-project-name>
The launching application didn't work.
I managed to correct this with to copy the content of 'settings-development.json' file and paste in Heroku => myProject => Setttings => Reveal Config Vars => Key : METEOR_SETTINGS and Value : I pasted here the content.
thanks to :
So, now, the app is showing on server.
**2) On Chrome console, I have this error :**
> `50d72c91808ef7fba57f920b67d152d2d57698eb.js?meteor_js_resource=true:9 WebSocket connection to 'ws://localhost:4001/graphql' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED`
so I changed this in METEOR_SETTINGS
```
"graphQL": {
"wsUri": "ws://localhost:4001/graphql"
},
to
"graphQL": {
"wsUri": "wss://myproject.herokuapp.com:4001/graphql"
},
Note without https and wss, the app is not showing
```
**3) Now on Chrome Console, I have :**
this warning :
> 50d72c91808ef7fba57f920b67d152d2d57698eb.js?meteor_js_resource=true:9 WebSocket connection to 'wss://myproject.herokuapp.com:4001/graphql' failed: WebSocket is closed before the connection is established.
and after several warning above, I have this error :
> 50d72c91808ef7fba57f920b67d152d2d57698eb.js?meteor_js_resource=true:9 WebSocket connection to 'wss://myproject.herokuapp.com:4001/graphql' failed: WebSocket opening handshake timed out
**By using the origin source code from Pup, I can signup on server but I cannot create a new document.**
**Any help, please ?**
Thank you

January 15, 2019 at 8:52am

January 19, 2019 at 9:58pm
Hi Fabrice, did you end up working this out or are you still stuck?
  • reply
  • like

January 20, 2019 at 2:31pm
thank you but I prefer to stop PUP because I think with GraphQL we lost DDP ?
In my app, I have got a part when I need a chat with DDP
  • reply
  • like

January 21, 2019 at 3:20pm
DDP wasn't removed, it's just not utilized for data operations any longer. GraphQL does support real-time data if you need it: https://cleverbeagle.com/pup/v2/graphql/using-subscriptions
like-fill
1
  • reply
  • like
I think same problem in deploying to Meteor Galaxy. The GraphQL URL is not working.
"the connection to wss://my.domain:4001/graphql was interrupted while the page was loading."
also tried wss://my.domain:443/graphql
So nobody cannot deploy pup 2.0 to heroku or to the galaxy. That is sad, because pup 1 worked very well out of the box.
Edited
like-fill
1
  • reply
  • like

January 22, 2019 at 4:22pm
Now I tried meteor up and deploy to EC2.. same poblem .. this is sad, my customer is waiting :D
  • reply
  • like

February 3, 2019 at 4:57pm
I'm at the same point: trying to deploy to AWS EC2 using MUP and the abernix/meteord:node-8.11.3-base docker image. I'm getting 502 Bad Gateway response from GET request to the wss:// websocket url. Leads me to believe that the nginx server is not configured properly to serve responses when using SSL on main url. Scratching my head on this one since this is the first time I've tried to deploy GraphQL + Websocket over SSL (and wss). Maybe a custom docker image for MUP is on order (?) Any advice or insight would be appreciated. I did notice that port 4001 is hardcoded in pupql as websocketServer.listen(4001) on line 108. PUP is great, by the way...!! Thanks.
  • reply
  • like

February 5, 2019 at 2:37pm
Hey the fix for this involves a patch to PupQL. The only (preliminary) way I've found to get around this is to attach Meteor's websockets to PupQL directly instead of spinning a separate server. I also need to add some filtering to the websockets so Meteor/GraphQL don't confuse each other. I've got something on my calendar to look at it all this week.
  • reply
  • like

February 5, 2019 at 9:02pm
Great! That would be a great addition to PupQL. Would you use the NODE_ENV or some other environment variable to configure PupQL? I was going to test a solution this week that involves reconfiguring the / locations section of the Nginx config for the MUP deployment to proxy the secure web socket to ws://localhost:4001. Not sure if that is going to work but worth a try. THANKS!! Easy deployment would make PUP the perfect template!
  • reply
  • like

March 13, 2019 at 2:35am
For anyone interested, I now have a configuration working on a Ubuntu 18.04 EC2 AWS instance with MUP. I have a websockets proxy to 4001 working with Cloudflare SSL (couldn't get it working with Let's Encrypt), however, I had to install/configure Nginx sort of by hand (with custom configuration for Mechanic, https://github.com/punkave/mechanic). I'm running Redis in a separate docker container for pub/sub (deployed via MUP) -- since the Apollo doc recommends against using in-memory graphql-subscriptions for production apps. Lastly, I am using a MongoDB Atlas cluster for the database. You can run all this on free versions of everything for development and stage. Then, easily migrate to production with a bit more horespower.
like-fill
1
  • reply
  • like

May 1, 2019 at 9:25pm
Hey the fix for this involves a patch to PupQL. The only (preliminary) way I've found to get around this is to attach Meteor's websockets to PupQL directly instead of spinning a separate server. I also need to add some filtering to the websockets so Meteor/GraphQL don't confuse each other. I've got something on my calendar to look at it all this week.
Hey - did you get time to look at this issue?
  • reply
  • like

May 2, 2019 at 5:05am
Hi everyone,
  • reply
  • like
I'm having similar issues with deploying Pup v2 to Digital Ocean. The app is up and running, but I'm getting WebSocket connection to 'wss://countme.outrun.io/graphql' failed: Error during WebSocket handshake: Unexpected response code: 502
  • reply
  • like
Noticed on Stack Overflow yesterday that was having a similar issue
  • reply
  • like
I've just installed the app on Galaxy platform and am getting a similar error message WebSocket connection to '<URL>' failed: WebSocket is closed before the connection is established.
  • reply
  • like

May 2, 2019 at 10:40pm
Hey — I had similar issues using Let’s Encrypt SSL and letting MUP configure my proxy. My deployment is now working via MUP using Cloudflare SSL and I configured the Nginx web proxy by hand (using Mechanic). My proxy settings for the /subscription path looks like this:
location /subscription {
# Redirect all /subscription traffic to app server port 4001
proxy_pass http://{IP_of_Docker_Container_Running_Meteor_App}:4001/subscription;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support (nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
Note that this proxy pass uses the IP of the docker container running the meteor app where the subscription server was created and is running (on port 4001). Unfortunately, in my configuration, I have to enter this IP into the Nginx config file manually after deployment via MUP — no big deal, but it is the only annoying manual deployment step!
Also, I used ideas from the PupQL code to create my own Apollo server and websocket server setup code. The main reason was I wanted to use a Redis server for pub/sub and also have the option of a local default in-memory implementation for development that was controllable via the settings.json file for each of my deployments (dev, stage, and prod).
Hope this helps!
Edited
  • reply
  • like

May 6, 2019 at 1:30pm
Hi folks, the solution for this is to migrate the PupQL code into Pup (and remove the package). This is planned here: https://github.com/cleverbeagle/pup/issues/284
  • reply
  • like

May 10, 2019 at 3:13am

October 19, 2019 at 6:11pm
This looks like the issue I am running into with my galaxy deployment. Is there a solution?
  • reply
  • like

February 2, 2020 at 9:20pm
Hi folks, I am using the latest version of Pup (2.1.0). I need a reverse proxy based on nginx to off load https requests. Unfortunately websocket connection fails. I have also looked pup github issue #284 https://github.com/cleverbeagle/pup/issues/284 , and

Bug deployment on heroku

thumbsup
1
message-simple
26
but it does not help ... The configuration is the Client ----> https://www.mysite.com ---> Nginx --- http://localhost:3000 ---> Pup (2.1.0)Both nginx and meteor are running on the same server.
Here is my configuration for nginx reverse proxy :
`server { listen 443 ssl http2; server_name www.mysite.com;
SSL
ssl_certificate /etc/nginx/ssl/www_mysite_com.crt; ssl_certificate_key /etc/nginx/ssl/www_mysite_com.key;
security
logging
access_log /var/log/nginx/mysite.access.log; error_log /var/log/nginx/mysite.error.log warn;
reverse proxy
location / { proxy_pass http://localhost:3000; include nginxconfig.com/proxy.conf; }
location /graphql/ { proxy_pass http://localhost:3000/graphql/; include nginxconfig.com/proxy.conf; }
additional config
non-www, subdomains redirect
server { listen 443 ssl http2;
server_name .mysite.com;
SSL
ssl_certificate /etc/nginx/ssl/www_mysite_com.crt; ssl_certificate_key /etc/nginx/ssl/www_mysite_com.key;
return 301 https://www.mysite.com$request_uri; }
HTTP redirect
server { listen 80;
server_name .mysite.com;
return 301 https://www.mysite.com$request_uri; }`
with proxy.conf `proxy_http_version 1.1; proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; 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; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port;`
I launch meteor with the command : ROOT\_URL="https://www.mysite.com" meteor --port localhost:3000 --settings settings-development.json
and the settings-development.json is : '"public": { "ROOT\_URL": "https://www.mysite.com", "environment": "development", "graphQL": { "httpUri": "http://127.0.0.1:3000/graphql" },
So the problem is (and I have tried BUNCH of configurations) that my browser returns the following error :POST http://127.0.0.1:3000/graphql net::ERR_CONNECTION_REFUSED
Setting the httpUri to https://www.mysite.com/graphql raises also an error GET https://www.mysite.com/graphql/ 400 (Bad Request)
How to address this issue ? Does Pup (2.1.0) support reverse proxy ?Can someone post a working configuration to get websocket working with ngnix ? I am really stucked in that nightmare and I have spent a lot of time and I need help ... Many thanks, Trapasky
Edited
  • reply
  • like

February 3, 2020 at 4:56pm
Hi , Pup doesn't make any changes to how reverse proxy should behave. Based on this part of your NGNIX config, it looks like a change may be required here:
reverse proxy
location / {
proxy_pass http://localhost:3000;
include nginxconfig.com/proxy.conf;
}
location /graphql/ {
proxy_pass http://localhost:3000/graphql/;
include nginxconfig.com/proxy.conf;
}
  • reply
  • like

February 5, 2020 at 9:33pm
Hello, indeed there is something wrong with the nginx but I cannot figure out what's wrong. What puzzles me is the fact that if is set as "httpUri": "http://192.168.13.93:3000/graphql" , browser is requested to connect to that url and it will fail because it's a fall back with http instead of https. I am blocked and really I need help
  • reply
  • like

February 14, 2020 at 2:15pm
did you get this resolved? From what I can tell this may be a DNS issue combined with the Nginx config. Not something I know very well so can't offer a ton of help.
  • reply
  • like

February 15, 2020 at 9:02am
Howdy folks, yes it's been fixed and you are right it was an nginx and dns issue, I'll post my configuration by next week.
  • reply
  • like

February 23, 2020 at 4:00pm
Howdy folks,
Here is the way to setup nginx reverse proxy https over meteor + graphql Please notice that the config is not harden, I'll post a harden one later. My proxy is running a dedicated host (later in a docker, I'll post the config as soon as it is ready) Meteor is running on another one.
From client www.mydomain.com is resolved with the proxy's IP. On the proxy, the /etc/hosts config looks like this : reverseproxyipaddress www.mydomain.com www On meteor server, the /etc/hosts config looks like this : meteoripaddress www.mydomain.com www
Meteor is launch with the following command: ROOT_URL="https://www.domain.com" meteor --settings settings-development.json --port ipofmeteor:8080
The config of settings-development.json is the following: { "public": { ROOT_URL": "https://www.mydomain.com", "PORT": "443", "graphQL": { "httpUri": "https://www.mydomain.com/graphql", "wsUri": "ws://wwww.mydomain.com:4001/graphql" }, ... }
Reverse proxy config (sites-enabled):
http to https redirect missing here but it is quite easy do do
server { listen 443 ssl http2 ; server_name www.mydomain.com;
# SSL
ssl_certificate /etc/nginx/ssl/www_mydomain_com.crt;
ssl_certificate_key /etc/nginx/ssl/www_mydomain_com.key;
# logging
access_log /var/log/nginx/mydomain.com.access.log;
error_log /var/log/nginx/mydomain.com.error.log warn;
# reverse proxy
location / {
if ($scheme = "http") {
rewrite ^(/graphql/.*)$ https://www.mydomain.com$1 permanent;
}
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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://meteoripaddress:8080;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
Hope this helps !
Edited
  • reply
  • like
Show more messages