- Statique is a static site server written with Crystal language and Kemal Web Framework.
- It pulls a Hugo site from a git repository, builds it and then serves as a static site.
- It provides a hook URL so that it can fetch and rebuild the Markdown files of Hugo project upon git push.
- Access can be restricted with passwords and permissions.
- Each folder can be assigned special permissions via files in config folder.
- Sample Hugo site source code can be found here.
- Create a public/private key pair: id_rsa and id_rsa.pub.
- Add the public key content to your git repo's Deployment Keys section.
- Add webhook for your git repo (like /abcd)
- We will provide webhook, public key, private key, git repo URLs as environment variables.
docker build -t fikrimuhal/statique .
docker run -d -e WEBHOOK_PATH="/abcd" -e PRIVATE_KEY_URL="https://somehost/id_rsa" -e PUBLIC_KEY_URL="https://somehost/id_rsa.pub" -e GIT_REPO="https://github.com/fikrimuhal/hugo-sample" -p 3000:3000 --name statique fikrimuhal/statique
Navigate to the server URL. If you are using for the first time, it will fetch git repo, build it and start displaying. Sample repo can be navigated starting from the root (/) with admin:admin credentials.
Passwords are located on config/passwords.txt file of the hugo project in the username:password format, one at each line.
Permissions are located on config/permissions.yml file of the hugo project.
- This file has a tree structure.
- root represents path /.
- Each item may contain users and children options.
- users option is a list of usernames who has the access to this path and its children.
- ['*'] represents anybody can access to this folder.
- /__kemal__ and paths like /css /js should have users: ['*'] so that anyone can use the static assets.
- children option is a list of subpaths underneath that folder.
- users option is a list of usernames who has the access to this path and its children.
If you want to run Statique on your local machine:
git clone http://github.com/fikrimuhal/statique && cd statique
shards install
crystal build.cr
crystal src/statique.cr
Navigate to http://localhost:3000 to see the result. You can use admin:admin password to access all the site.
- Webhook / build for the first time doesn't work on local development.
- MD5 Hashing for passwords
- Hook Queue: if another build request comes, do not reject it but put it into the queue. If multiple requests are come, use the last one.
- Fork it ( https://github.com/fikrimuhal/statique/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- aladagemre Ahmet Emre Aladağ - creator, maintainer