The Lapis web framework is amazing. Setting up your development environment is a bit involved. This post is my attempt to gather links and useful tidbits regarding the process process of preparing for Lapis.
If your only OS is Windows, you've ended up on the wrong side of the metaphorical tracks. First install Linux and gain a basic familiarity, then we'll talk. If you're on OSX you almost certainly want to be using Homebrew. If you're a Linux user, you're good to go.
These instructions are just meant to get your system prepared for Lapis development. At the end we'll have links to the next steps.
Only OpenResty is actually required, but LuaRocks and PostgreSQL are pretty fundamental.
Running Lapis requires OpenResty, which is basically the Nginx web server and a custom bundle of specially configured modules. For our purposes, suffice to say it's fast and easy to use.
In order to install Lapis, we must first install LuaRocks, "a deployment and management system for Lua modules." Essentially, LuaRocks allows us to install things like Lapis and MoonScript without worry or hassle. Follow the LuaRocks installation instructions. Of course LuaRocks requires Lua, but that should be installed automatically.
Once you've got LuaRocks, we want to be using version 5.1, you can very easily install MoonScript and Lapis with the intuitive commands:
luarocks install moonscript luarocks install lapis
A web framework, like Lapis, requires a database for most interesting purposes. Lapis uses PostgreSQL.
Installing PostgreSQL is simple, but setting it up is not entirely trivial. The official documentation is not very helpful, so here are some links that are:
The bottom line is that PostgreSQL is managed by the
postgres user. As
postgres we need to run these commands with appropriate arguments:
initdb createuser createdb
Following the Arch Wiki, this process is pain free.
If you see errors like
module 'lapis' not found you may be experiencing a path expectation disconnect between LuaRocks and OpenResty. I discuss this issue in this post on the Arch Linux forum.
While these are not required, they make the task of developing with Lapis and MoonScript much more convenient.
Sass allows you to craft complex CSS in a much more programmatic style, with variables, nested rules, inheritance, mathematical operators, and more.
We can either follow the Sass official installation guide, or we can eschew Ruby and use LibSass + SassC instead. If that is a troubling thought, you can follow these straightforward SassC installation instructions.
Installing Git is very easy. Using it can be somewhat challenging, but there's this incredible Code School - Try Git tutorial make the learning process fun and painless. Version control is incredibly important, not just for collaboration, but also for your own sanity.
Learn about MoonScript, a gentler, kinder Lua.
Read the Lapis documentation. It's excellent.
Check out this list of Lapis tips, tutorials, snippets, and examples.
Most importantly, watch this video (at 720p or 1080p), where you can see all the software mentioned above put to awesome good use.
Many thanks for this. I agree this is a nightmare on Windows, is there any way around it? I'm so enjoying using moonscript with sqlite, but I can't get any modules installed. Just loads of errors, looks like I'm stuck with coffeescript..