Git Product home page Git Product logo

staticland-api's Introduction

staticland-api

A secure home for your static sites.

Features

  • One command to deploy a site.
  • Automatic SSL using Let's Encrypt.
  • Use any static site generator.
  • MIT licensed. Host it yourself. Use it how you want.

Install

Installing on Ubuntu 16.10

Install system dependencies

sudo apt-get update
sudo apt-get install git bc build-essential nginx
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Install nvm & node

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
. ~/.bashrc
nvm install v6

Install certbot

wget https://dl.eff.org/certbot-auto
chmod a+x ./certbot-auto
./certbot-auto

Install staticland-api

git clone https://github.com/staticland/staticland-api.git
cd staticland-api
npm i

staticland config

Copy the example config file and make changes if needed:

cp example.config.js config.js

set NODE_ENV to production

In the .bashrc file of the user that will run the staticland server add:

export NODE_ENV="production"

nginx config

You can use the nginx config files found in staticland/config.

Make sure to:

  • replace any references to api.static.land to the hostname you're using
  • change directory references if you place staticland or the sites in a different directory

Create cert for api server

cd ~
./certbot-auto certonly --standalone --agree-tos --redirect --duplicate --text --email [email protected] -d api.static.land

restart nginx

sudo service nginx restart

install forever

npm i -g forever

set the STATICLAND_SECRET environment variable

export STATICLAND_SECRET=SomethingMoreSecretThanThis

start the staticland server

forever start index.js

renewing certificates

crontab -e
add a cron job for renewing site certificates
00 00 * * * node /home/ubuntu/staticland-api/bin/renew

Sites will get cert renewals based on the renewEvery value of the config.js file. The default value of 30 means certs will be renewed every 30 days.

add a con job for renewing the api server certificate
* 00 * * 1 /home/ubuntu/certbot-auto renew --standalone --pre-hook "service nginx stop" --post-hook "service nginx start" --quiet

Every Monday at midnight certbot will check to see if the certificate needs to be renewed.

License

MIT

staticland-api's People

Contributors

aral avatar johanholmerin avatar jonburger avatar sethvincent avatar theel0ja avatar

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.