Skip to content

Instantly share code, notes, and snippets.

@ldoguin
Last active June 11, 2020 16:12
Show Gist options
  • Save ldoguin/b02a9d6af825013224e6c82f025ef1b9 to your computer and use it in GitHub Desktop.
Save ldoguin/b02a9d6af825013224e6c82f025ef1b9 to your computer and use it in GitHub Desktop.
Clever gist for static site deployer
CC_PHP_VERSION="7"
CC_PRE_RUN_HOOK="./hugo.sh"
CC_RUN_SUCCEEDED_HOOK="clever stop"
CC_WEBROOT="/public"
CLEVER_SECRET="xxxx"
CLEVER_TOKEN="xxxxx"
DL_RCLONE_VERSION="1.52.1"
HUGO_ENV="production"
HUGO_VERSION="0.62.0"
PORT="8080"
MY_DOMAIN="mystaticsite.cleverapps.io/"
mkdir hugo-cellar-static
cd hugo-cellar-static/
hugo new site .
git init
git submodule add https://github.com/jakewies/hugo-theme-codex themes/codex
cp themes/codex/exampleSite/config.toml config.toml
cp -r themes/codex/exampleSite/content/ .
gedit config.toml
clever create --type static-apache myapp
git add .
git commit -m"init"
clever service link-addon acellar
cat ~/.config/clever-cloud
clever deploy
export RCLONE_CONFIG_MYS3_ACCESS_KEY_ID=$CELLAR_ADDON_KEY_ID
export RCLONE_CONFIG_MYS3_SECRET_ACCESS_KEY=$CELLAR_ADDON_KEY_SECRET
export RCLONE_CONFIG_MYS3_ENDPOINT=$CELLAR_ADDON_HOST
export RCLONE_CONFIG_MYS3_TYPE="s3"
wget https://downloads.rclone.org/v$DL_RCLONE_VERSION/rclone-v$DL_RCLONE_VERSION-linux-amd64.zip
unzip rclone-v$DL_RCLONE_VERSION-linux-amd64.zip
wget https://github.com/gohugoio/hugo/releases/download/v$HUGO_VERSION/hugo_extended_"$HUGO_VERSION"_Linux-64bit.tar.gz
tar xvf hugo_extended_"$HUGO_VERSION"_Linux-64bit.tar.gz
chmod +x ./hugo
./hugo --gc --minify
./rclone-v$DL_RCLONE_VERSION-linux-amd64/rclone sync ./public mys3:$MY_DOMAIN --progress --s3-acl=public-read
Create a cellar addon, create a bucket named after your domain name.
Create a static app and link it to cellar.
Add the right environment variable, easiest wqy to get CLever secret and token is to cat ~/.config/clever-cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment