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

NGINX + lua + Hashing for asset server upload #1

Open
pharaun opened this issue Nov 16, 2014 · 0 comments
Open

NGINX + lua + Hashing for asset server upload #1

pharaun opened this issue Nov 16, 2014 · 0 comments

Comments

@pharaun
Copy link

pharaun commented Nov 16, 2014

I have found a lots of resources on this:

  1. https://github.com/openresty/lua-resty-upload
  2. https://github.com/pgaertig/nginx-big-upload
  3. http://stackoverflow.com/questions/22461341/nginx-1-5-file-upload-best-practices
  4. http://leafo.net/posts/creating_an_image_server.html
  5. http://bl.ocks.org/justincormack/948423

Anyway the basic outline is:

  1. We are going to need nginx with lua/luajit compiled in.
  2. Since we don't want to buffer the entire file in memory we are going to need a way to store it in a temp location on disk till we have a complete hash of the file then we can move it.
  3. nginx+lua supports file-upload so we can make it as trivial as curl --binary-data file.foo http://resource/uri for uploading new content/new versions :)

So what we need to do:

  1. Compile nginx with lua and maybe some of the lua framework
  2. Setup a basic file-send/share directory with the uri + hash (ie asset/game1/logic.lua/) for fetching that specific file+version
  3. Add in a hook for PUT/POST to the asset uri (PUT asset/game1/logic.lua) which will store the file in a temp loc, and generate the hash, move it into the final loc, return the hashed uri/hash.
  4. Can later have lua ping the specific game-server and be like yo you got a new version of X asset.
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

1 participant