Closed karllhughes closed 4 years ago
OpenResty notes
The big thing here is structural, for users its probably better to talk about what you are deploying and then deploy it.
So...
How to Deploy OpenResty to Fly would be
Configuring the Dockerfile
Setting up the Nginx Configuration
noting you are listening on port 80
Then deploying on Fly with
flyctl init --port 80
(--port 80 sets the internal port to 80 so you can lose the section on editing services)
and then straight into deploying the app.
Other items:
To set up your reverse proxy, create a default.conf file in your root directory and add the following:
s/root/fly-openresty/
Suggest that the various iterations of default.conf are in the repository too, so create ratelimit-default.conf, redisapikeys-default.conf - saves cutting and pasting and leaves reference versions in the repo.
Fly will build and run your Docker image as a container on the edge, but you need to update your Dockerfile first.
Suggest "in a Firecracker VM on the edge" and "you'll need to create your Dockerfile file first" with the reordering.
Oh extra note... you can use flyctl open
and flyctl open /api
to view the app.
Thanks for the feedback @codepope, I'll update it this weekend and ping you when it's done.
@codepope updated this in the repo, here's the commit: https://github.com/fly-examples/openresty-basic/commit/bf0551d2c093872b18d54b7b07ea7e5a09b98596
Also, just realized this convo should be on the other OpenResty issue (#278) instead. This issue is for another possible future OpenResty article. 😬
Thanks again, let me know if I missed anything.
Well, and this should head over to community.fly.io but before we do that....
rather than go note by note, here's a PR - https://github.com/fly-examples/openresty-basic/pull/1
There was some non-linear activity in the process (create a docker file.... make a directory :) ) that I've fixed up.
Moved to Discord: https://community.fly.io/t/using-openresty-for-authentication-on-fly/91
In #278 we talked about authentication being a good example for OpenResty, but it is a little more complex than just "getting started": https://github.com/zmartzone/lua-resty-openidc
So, I propose we do this article as a standalone topic after the introductory OpenResty one so we can reference it. This is sort of the 200-level content whereas the other one is more 100-level.
I'll add a rough outline later after I dig into this more.