Meteor - Custom Deployment - meteor

I have deployed my Meteor Application on my local machine using:
https://guide.meteor.com/deployment.html#custom-deployment
Now during the process I used:
$ export ROOT_URL='http://192.168.100.2:9000'
Now my is not accessible on http://192.168.100.2:9000, but instead it is accessible on http://192.168.100.2:46223, so every time I do node main.js, it choose some random port for my application.
How can I specify a port of my own choice here?

You should also supply the PORT environment variable to instruct the app which port to listen on, as it is not inferred from the ROOT_URL. It is also not necessarily the same, as apps may have a reverse proxy in front of them.
See the official documentation for more environment variables.

Related

Bypass internal application calls to proxy

I have created a windows VM in GCloud and have updated proxy settings to ensure all calls go through the proxy.
There are two cases:
I set the Proxy setting to call the proxy server. This ensure all the calls that are made through any browser, go through the proxy.
I have setup http_proxy and https_proxy environment variables, with this, any curl commands I hit through Command Prompt or Bash also go via the proxy.
Now I have a case where I need to bypass a few calls and not allow them through the proxy.
This is only required by some desktop Apps I have in my VM and not for the browser call.
CASE1: From some research, in order to bypass browsers call, there is a .pac file where we can added domains to bypass
CASE2: But for non-browser calls, I could only find a way to add a no_proxy environment variable.
Following are my questions related to CASE2
Question 1? When I setup no_proxy env variable, git bash does not seem to respect that unless I set it explicitly in git bash before making any call. So is this the right way to do? or I am missing something.
Question 2: Google internal makes a few calls from the VM to get Metadata, those calls are getting proxied. But even though I update the no_proxy env variable, it still does not respect and calls still go through the proxy. where should I set this up so that I can bypass these internal VM calls to go through without being proxied?
Following is my setup
VM is on GCP with windows image
Proxy server is Squid setup on a static public IP.
The applications are calling some internal APIs
The vm calls http://metadata.google.internal API
Nay help on this would be highly appreciated.
TIA

Multiple dokku apps one domain

The behavior I want:
If the user goes to http://www.example.com/{anything-but-admin} one dokku app responds.
However if the user goes to http://www.example.com/admin a different dokku app responds.
Does dokku provide a simple way to do this? I believe I would have to disable the proxy port mapping and add a custom nginx implementation, but even if I do that, the docs specify
If a proxy is disabled, Dokku will bind your container's port to a random port on the host for every deploy, e.g. 0.0.0.0:32771->5000/tcp.
If this is the correct thing to do, how do I force a static port number, so I can add that port number to my custom nginx configuration?
You can deploy two apps and have one of the apps reference the other's upstream.

Automatically append docker container to upstream config of nginx load balancer

I'm running Docker Compose (v2) and have a node service (website) and python based api deployed with nginx sitting in front of them.
One thing I would like to do is be able to scale the services by adding more containers. If I know ahead of time how many containers I will have, I can hardcode the nginx upstream config with the references to the IPs of the containers which docker makes available. However, the problem is that I want the upstream nginx config to be dynamic e.g. if I add another Docker container, it simply adds appends the location of the container to the upstream list of IPs in the upstream block.
My idea was to create a script which will automatically append the upstream servers using env variables when the containers change but I'm unsure where to start and can't find a good example.
There are a couple ways to achieve this. What you are referring to is usually called service discovery and comes in many forms. I'll describe two of them that I have used before.
The first and simplest one (which works fine for single servers or only discovering containers locally on one server) is a local proxy which makes use of the Docker socket or API. https://github.com/jwilder/nginx-proxy is one of the popular ones and should work well for prototyping scalable services in Compose.
Another way (which is more multi-host friendly but more complicated) would be registering services in a registry (such as etcd or Consul) and then dynamically writing out the configuration. To do this, you can use a registration system (such as https://github.com/gliderlabs/registrator) to register the containers and their ports. Then your proxy or application can consume a configuration file written out using a template system like https://github.com/kelseyhightower/confd.

How to get the PORT number it is listening on?

I tried process.env['PORT'], but this returns an unrelated number.
I'm using Meteor 0.9.2.2.
I guess you're running your app using meteor command. When you do that, it will first start a proxy server which will listen on the port you give (by default 3000) and forward requests to your meteor application which listens on some random available port. Meteor does this to automatically refreshes the server when you modify a file and for some other cool features.
If you build your app using meteor build --directory /my/build/path/ and run it, process.env.PORT will have the correct port number.

Specify an ip for an url in a Jenkins Job

I have the following situation.
The webapp in my company is deployed to several environments before reaching live. Every testing environment is called qa-X and has a different IP Address. What I would like to do is to specify in the jenkins job "test app in qa-x" the app's IP for the x environment so that my tests start running only knowing the apps url.
Jenkins itself is outside the qa-x environments.
I have been looking around for solutions but all of them destroy the other tests of qa-X. For instance, changing /etc/hosts, or changing the dns server. What would be great is that I can specify in that job only the ip as a config parameter and that that definition remains local.
Any thoughts/ideas?
If I'm understanding your query correctly, you should look into creating a Parameterized build which would expose an environment variable with the desired server IP, which your test script could consume.

Resources