loco icon indicating copy to clipboard operation
loco copied to clipboard

feat: nginx deployment

Open arferreira opened this issue 1 year ago โ€ข 2 comments

Implement and add to our CLI the generation of the nginx conf file for deployment as mentioned in the issue: [(https://github.com/loco-rs/loco/issues/203)]

@jondot I had some questions about whether for now we can start with the simplest implementation and wait for demand, or whether we could think about SSL and TLS. Regarding the current implementation, it is very simple looking directly at the configurations made.

arferreira avatar Dec 27 '23 01:12 arferreira

Looks great! I think simplicity is a fantastic thing :)

What do you think about looking a the docker-compose https://github.com/clowzed/sero/blob/master/docker-compose.yml and trying to customize this one to our needs? then drop the generated docker-compose file in ngnix/ as well. This will be a great "dont make me think" feature that will streamline deploying under nginx.

Only add it if its not too complicated, if you find that it involved some jumping through hoops, we can leave it to later :)

jondot avatar Dec 27 '23 06:12 jondot

You can also look at our docker-compose in the starters template: https://github.com/loco-rs/loco/blob/master/starters/saas/.devcontainer/docker-compose.yml

kaplanelad avatar Dec 27 '23 13:12 kaplanelad

Not to be annoying, I know that nginx is the default for this problem. But maybe it would be nice to add traefik, it integrates nicely with docker-compose (adding a couple of labels) and you can get lets encrypt certificates set up quite easily.

thomas9911 avatar Dec 29 '23 16:12 thomas9911

Hi To learn more about this PR, I revised arferreira's patch into my patches in my forked repository](https://github.com/loco-rs/loco/compare/master...locoabc:loco:adding-Nginx-deployment-template). Please review and confirm.

  • Not sure why (purposely ?) deployment_nginx_config.t is missed in templates dir image
  • content of deployment_nginx_config.t
to: "Nginx.toml"
skip_exists: true
message: "Nginx.toml file created successfully"
---
name = "{{pkg_name}}"
  • testing generate deployment
[me@rocky9t01a myapp04]$ myapp04-cli generate deployment
โœ” โฏ Choose your deployment ยท Nginx
added: "nginx/default.conf"
added: "Nginx.toml"
[me@rocky9t01a myapp04]$

tjyang avatar Dec 30 '23 20:12 tjyang

going to move forward with this one

jondot avatar Dec 31 '23 07:12 jondot