{"id":19212382,"url":"https://github.com/leafo/heroku-openresty","last_synced_at":"2025-05-12T20:37:07.528Z","repository":{"id":5404392,"uuid":"6594416","full_name":"leafo/heroku-openresty","owner":"leafo","description":"Run OpenResty on Heroku with the Lua buildpack","archived":false,"fork":false,"pushed_at":"2015-06-02T20:02:08.000Z","size":24638,"stargazers_count":78,"open_issues_count":8,"forks_count":23,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T17:40:03.548Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leafo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-08T10:02:03.000Z","updated_at":"2023-12-11T06:17:24.000Z","dependencies_parsed_at":"2022-09-25T03:00:21.387Z","dependency_job_id":null,"html_url":"https://github.com/leafo/heroku-openresty","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fheroku-openresty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fheroku-openresty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fheroku-openresty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Fheroku-openresty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafo","download_url":"https://codeload.github.com/leafo/heroku-openresty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253817579,"owners_count":21969007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T13:46:44.575Z","updated_at":"2025-05-12T20:37:07.494Z","avatar_url":"https://github.com/leafo.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenResty for Heroku\n\nThis is a Lua rock containing binaries for running OpenResty on Heroku. It's\ndesigned to be used in conjunction with the [Lua\nbuildpack](https://github.com/leafo/heroku-buildpack-lua).\n\n## What it does\n\nIn addition to a pre compiled openresty, some scripts to start nginx are\nincluded. nginx doesn't support passing in port through argument or reading\nfrom environment variable so we preprocess the config file.\n\nAnything matching `${{NAME}}` is replaced with the environment variable `NAME`\ninside of your nginx configuration config. (note: doesn't apply to included\nfiles)\n\nThe `start_nginx.sh` script will read in `nginx.conf`, compile it to\n`nginx.conf.compiled` then start nginx. It takes two optional arguments, an\nalternative path for the config as the first and and an alternative root\ndirectory to run the server from. The config must be specified relative to the\nroot.\n\nThe `daemon off`; directive must be added to the config for the entire thing to\nwork.\n\n## How to use\n\n### Installing the rock\n\nCreate a new app with the [Lua buildpack](https://github.com/leafo/heroku-buildpack-lua).\n\n```bash\n$ heroku create --buildpack http://github.com/leafo/heroku-buildpack-lua.git\n```\n\nAdd to your rockspec dependencies:\n\n```lua\ndependencies = {\n  \"https://raw.github.com/leafo/heroku-openresty/master/heroku-openresty-1.2.8.6-1.rockspec\"\n}\n```\n\n### Running Nginx\n\n*These directions are for manually running Nginx, if you prefer to use a\nframework then I recommend checking out: \u003chttp://leafo.net/lapis\u003e.*\n\nCreate a basic `nginx.conf`, this is the one from the OpenResty guide (with the\naddition of `daemon off` and `${{PORT}}`):\n\n```\nworker_processes  1;\nerror_log logs/error.log;\ndaemon off;\nevents {\n    worker_connections 1024;\n}\nhttp {\n    server {\n        listen ${{PORT}};\n        location / {\n            default_type text/html;\n            content_by_lua '\n                ngx.say(\"\u003cp\u003ehello, world\u003c/p\u003e\")\n            ';\n        }\n    }\n}\n```\n\nCreate a `Procfile`:\n\n```\nweb: start_nginx.sh\n```\n\nCommit everything and push to deploy. Run `heroku scale web=1` if nginx doesn't\nstart automatically.\n\n## Using PostgreSQL\n\nThis build includes the [Postgres nginx\nmodule](http://labs.frickle.com/nginx_ngx_postgres/), all you need to\ndo is pass in your database configuration.\n\nFirst add a database if you haven't added one already:\n\n```bash\nheroku addons:add heroku-postgresql:dev\n```\n\nThis will set an environment variable inside of your application that looks\nsomething like this:\n\n```bash\nHEROKU_POSTGRESQL_ROSE_URL=\"postgres://user:password@database.domain.com/databasename\"\n```\n\nThe nginx config expects a slightly different format, but no worries the config\npreprocessor has a filter to convert to the correct format.\n\nAdd the database to your config like so: (notice the prefix `pg`)\n\n```\nhttp {\n    upstream database {\n      postgres_server ${{pg HEROKU_POSTGRESQL_ROSE_URL}};\n    }\n}\n```\n\nThat's it, your application can now talk to Postgres through the `database`\nupstream.\n\n## Version\n\n* OpenResty 1.5.11.1 `--with-http_postgres_module`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Fheroku-openresty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafo%2Fheroku-openresty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Fheroku-openresty/lists"}