A webpage for hosting and serving Lua modules.
The entire site runs on OpenResty, an Nginx based platform with Lua support. The site itself is coded in MoonScript and uses Lapis as a web framework.
Files are stored on Google Cloud Storage. PostgreSQL is used as a database.
Tup is the build system.
This is a bit complicated, tell me if you are doing this and I'll assist you.
Install sassc. (Optionally you can install SASS but you'll need to modify a Tupfile)
Install coffeescript.
Install discount (or something that provides markdown binary).
Install PostgreSQL. Create a database called moonrocks.
Install OpenResty.
Check out this repository.
Install the dependencies listed in https://github.com/leafo/moonrocks-site/blob/master/BoxFile.
If you use MoonBox then you can install all of the files in one go:
moonbox install
source moonbox env enterRun these commands to build.
tup init
tup updCreate the schema:
make schemaStart the server:
lapis serverNow http://localhost:8080 should load.
MoonRocks uses Busted for its tests:
make test_db
bustedYou only need to run make test_db if the schema of the database has changed
(or has just been created).
In production all files are stored on Google Cloud Storage. With no
configuration (default), files are stored on the file system using the storage
bucket mock provided by the cloud_storage rock.
To configure cloud_storage to talk to a live bucket make a file
secret/storage_bucket.moon, it must return a bucket instance. It might look
something like:
-- secret/storage_bucket.moon
import OAuth from require "cloud_storage.oauth"
import CloudStorage from require "cloud_storage.google"
o = OAuth "NUMBER@developer.gserviceaccount.com", "PRIVATEKEY.pem"
CloudStorage(o, "PROJECT_ID")\bucket "BUCKET_NAME"If you want to test sending emails you'll have to provide Mailgun
credentials. A test account is free. Create a file secret/email.moon and
make it look something like this: (it must return a table of options)
{ -- secret/email.moon
key: "api:key-MY_KEY"
domain: "mydomain.mailgun.org"
sender: "MoonRocks <postmaster@mydomain.mailgun.org>"
}Tup has a filesystem monitor, it can rebuild any assets or moon files automatically as you change them. Better than running individual watch scripts for each component.
To use it run:
tup monitor -a -f