Giter VIP home page Giter VIP logo

statique's Introduction

Statique - Static Site Server

  • 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.

Installation

  • 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

Usage

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.

Authentication

Passwords are located on config/passwords.txt file of the hugo project in the username:password format, one at each line.

Authorization

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.

Development

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.

TODO

  • 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.

Contributing

  1. Fork it ( https://github.com/fikrimuhal/statique/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • aladagemre Ahmet Emre Aladağ - creator, maintainer

statique's People

Contributors

aladagemre avatar

Stargazers

Ilgaz Şumnulu avatar Ray avatar Serdar Dogruyol - Sedo セド avatar

Watchers

 avatar James Cloos avatar

statique's Issues

Make statique independent of git/dropbox

Most up-to-date branch ise dropbox now. Yet we can make statique independent of dropbox/git.

Git might start a hook.
Dropbox script might sync dropbox and call the hook periodically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.