Stan is a little tool that helps you to deploy static sites to a centralized host.
Install Stan with
$ gem install stan
In order to build the dependencies please make sure you installed the ruby headers.
$ apt install ruby-dev
Commands:
stan compress DIRECTORY # compress given directory
stan deploy DIRECTORY NAME # deploys given directory to stan server
stan help [COMMAND] # Describe available commands or one specific command
stan server # start the server to receive and serve pages
stan version # display the stan version
There are a few variables you have to set:
STAN_UPLOAD_DIR=/tmp/stan/upload
is the directory where Stan will temporarly store sites before deploying them.STAN_PUBLIC_DIR=/srv/stan
is the directory where the final site will be deployed.STAN_BIND=127.0.0.1
is the ip to bind to.STAN_PORT=4567
is the port to use.
Please note that Stan will create a directory for each deployed site within that folder.
The final site will then be deployed to /srv/stan/my-site
for example.
upstream pages {
server localhost:4567 fail_timeout=0;
}
server {
listen 443;
listen [::]:443;
# replace with server name config and ssl settings
client_max_body_size 100m;
location / {
root /srv/stan;
}
location /upload {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://pages/upload;
}
}
STAN_SERVER=pages.example.com
is the URL of the remote Stan server which must expose the/upload
route. Define ports like usual.STAN_TEMP_DIR=/tmp/stan
is the directory where Stan will store the site after compressing it. The archive will be removed after upload.
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/Flipez/static-stan.
The gem is available as open source under the terms of the MIT License.
Look at the awesome logo I made at: onlinelogomaker.com