gatling icon indicating copy to clipboard operation
gatling copied to clipboard

User deploys with their own `nginx.config`

Open mrmicahcooper opened this issue 8 years ago • 6 comments

User adds a file to the root of their project named ./nginx.conf

On a deploy:

If nginx.conf

  • Validate the config file. Exit if invalid.
  • Copy the nginx file to /etc/nginx/sites-available/ if different

mrmicahcooper avatar Oct 04 '16 17:10 mrmicahcooper

This will not be going into the 1.0.0 release as adding the ability to specify your own port in your NGINX file will have to be synced with the systemd file that's already on the server. This work hasn't been planned yet.

mrmicahcooper avatar Oct 12 '16 15:10 mrmicahcooper

Right now there is no option to specify a custom port as the initial deploy task looks up an open port. Though this is nice for the easiest kind of deployment, this leads to problems like described above.

I think it would be good to have a config option for the port so this can be set before the initial deployment. The init script would then use the custom port and the nginx.conf could be provided by the user. The tricky part is handling the case where the initial deployment has already happened and the init scripts needs to be rewritten.

dennisreimann avatar Dec 28 '16 21:12 dennisreimann

Hey guys - especially @mrmicahcooper - thanks for your great work!

I am currently (re)evaluating my Phoenix deployment process and it is nice to have a (leightweight) alternative to edeliver that I used for my first projects.

What keeps me from considering gatling is that I need to have a rather sophisticated nginx.conf in place (SSL termination, static file hosting, ...). I do not see how I could get this to work without setting a custom port for my application.

Is it possible to set the port after the initial deployment, or is this generated on every deploy?

denic avatar Jan 12 '17 10:01 denic

@denic I migrated to a full custom nginx.conf with SSL recently. Here's how you do it:

  • get the current nginx.conf (deployed by Gatling)
  • change it, leaving the upstream port as it is
  • overwrite the existing nginx.conf and restart nginx
  • BOOM 🎉

There isn't anything more to it. Once Gatling has deployed it it won't touch the config anymore – same goes with the port, so you can safely do it this way.

Hope this helps.

dennisreimann avatar Jan 12 '17 10:01 dennisreimann

@dennisreimann That is the answer I hoped for. Thanks! m(_ _)m

denic avatar Jan 12 '17 11:01 denic

@denic I have also written up a detailed article about Configuring NGINX for Phoenix applications. Hope it helps :)

dennisreimann avatar Jan 30 '17 06:01 dennisreimann