{"id":16777962,"url":"https://github.com/dgf/lamutib","last_synced_at":"2026-01-02T17:50:33.204Z","repository":{"id":18363340,"uuid":"21543553","full_name":"dgf/lamutib","owner":"dgf","description":"Lapis multi tenancy instance blueprint","archived":false,"fork":false,"pushed_at":"2014-07-07T13:11:24.000Z","size":164,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-10T22:15:16.466Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"MoonScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dgf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-06T16:16:56.000Z","updated_at":"2023-01-14T20:29:37.000Z","dependencies_parsed_at":"2022-07-12T15:14:54.693Z","dependency_job_id":null,"html_url":"https://github.com/dgf/lamutib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgf%2Flamutib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgf%2Flamutib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgf%2Flamutib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgf%2Flamutib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgf","download_url":"https://codeload.github.com/dgf/lamutib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918631,"owners_count":20368745,"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-10-13T07:26:24.991Z","updated_at":"2026-01-02T17:50:33.178Z","avatar_url":"https://github.com/dgf.png","language":"MoonScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lamutib\n\nLapis multi tenancy instance blueprint\n\nA memory aware approach for multi tenancy environments with a dedicated application instance and a database per customer.\n\n## Requirements\n\n * [OpenResty][resty] web server\n * [Lapis][lapis] web framework\n * [PostgreSQL][postgres] database\n\n## Usage\n\nThis setup isn't simple but stable and nearly plattform independent.\nTested on Ubuntu 12.04 64bit\n\n```\nsudo aptitude update\nsudo aptitude -y install build-essential libpcre3-dev libpq-dev\nsudo aptitude -y install luarocks postgresql\n```\n\n### Web server\n\nDownload [OpenResty][resty], unzip, compile and install it.\n```sh\nwget http://openresty.org/download/ngx_openresty-1.7.0.1.tar.gz\ntar xzvf ngx_openresty-1.7.0.1.tar.gz\ncd ngx_openresty-1.7.0.1\n./configure\nmake\nsudo make install\n```\n\nConfigure [nginx][nginx] with [LuaJIT][luajit] compiler, [PostgreSQL][postgres] client and exclude unused modules.\n```sh\n./configure \\\n--with-http_postgres_module \\\n--with-luajit \\\n--without-http_autoindex_module \\\n--without-http_browser_module \\\n--without-http_fastcgi_module \\\n--without-http_geo_module \\\n--without-http_lua_upstream_module \\\n--without-http_map_module \\\n--without-http_memcached_module \\\n--without-http_memc_module \\\n--without-http_proxy_module \\\n--without-http_redis2_module \\\n--without-http_redis_module \\\n--without-http_scgi_module \\\n--without-http_split_clients_module \\\n--without-http_ssi_module \\\n--without-http_upstream_ip_hash_module \\\n--without-http_userid_module \\\n--without-http_uwsgi_module \\\n--without-lua51 \\\n--without-lua_redis_parser \\\n--without-lua_resty_mysql \\\n--without-lua_resty_redis \\\n--without-lua_resty_upstream_healthcheck\n```\n\n### Web Framework\n\nInstall [LuaRocks][luarocks] and [MoonScript][moon]\n```sh\nsudo luarocks install lapis\nsudo luarocks install moonscript\nsudo luarocks install moonrocks\n```\n\n### Database\n\nDownload and install [PostgreSQL][postgres]\n\nCreate a database.\n```sh\nsudo -u postgres psql -c \"CREATE USER \\\"lamutib\\\" WITH ENCRYPTED PASSWORD 'SecreT';\"\nsudo -u postgres createdb -O \"lamutib\" \"lamutib\"\n```\n\n### Boot'em up\n\nClone this repo and step into it.\n```sh\ngit clone https://github.com/dgf/lamutib\ncd lamutib\n```\n\nCompile [MoonScript][moon] files to Lua.\n```sh\nmoonc .\n```\n\nBuild environment, run database migrations and start the server.\n```sh\nlapis build\nlapis migrate\nlapis server\n```\n\nOr start [nginx][nginx] without the wrapper.\n```sh\n/usr/local/openresty/nginx/sbin/nginx -p `pwd`/ -c nginx.conf.compiled\n```\n\n## Specifications\n\nInstall [busted][busted] testing environment.\n```sh\nsudo luarocks install busted 1.11.1-1\n```\n\nRun the specifications.\n```sh\nbusted spec/rest.moon\n```\n\nAnd this is were *Lua rocks* really! It runs the entiry specification\nwith a complete walkthrough in less than one tenth of a second.\n```sh\ntime busted spec/rest.moon\n\n3 successes / 0 failures / 0 pending : 0.084445 seconds.\n\nbusted spec/rest.moon  0.05s user 0.02s system 56% cpu 0.127 total\n```\n\n## Benchmark\n\nAnd now the interesting part of this blueprint.\nThe application runs with one master and one worker process and it\nserves hundert of requests per second with under 30 MB of your RAM!\nTry it out, load the `bench.jmx` file with [JMeter][jmeter] and fire it up.\n\n [busted]: http://olivinelabs.com/busted/\n [jmeter]: https://jmeter.apache.org/\n [lamutib]: https://github.com/dgf/lamutib\n [lapis]: http://leafo.net/lapis/\n [lua]: http://www.lua.org/\n [luajit]: http://luajit.org/\n [luarocks]: http://luarocks.org/\n [moon]: http://moonscript.org/\n [nginx]: http://wiki.nginx.org/Main\n [postgres]: http://www.postgresql.org/\n [resty]: http://openresty.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgf%2Flamutib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgf%2Flamutib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgf%2Flamutib/lists"}