Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User deploys with their own nginx.config #10

Open
mrmicahcooper opened this issue Oct 4, 2016 · 6 comments
Open

User deploys with their own nginx.config #10

mrmicahcooper opened this issue Oct 4, 2016 · 6 comments

Comments

@mrmicahcooper
Copy link
Collaborator

mrmicahcooper commented Oct 4, 2016

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
Copy link
Collaborator Author

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.

@dennisreimann
Copy link
Contributor

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.

@denic
Copy link

denic commented Jan 12, 2017

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?

@dennisreimann
Copy link
Contributor

@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.

@denic
Copy link

denic commented Jan 12, 2017

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

@dennisreimann
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants