/ghost.sh

Instructions and code to easily upgrade or migrate a Ghost blog in production.

Primary LanguageHCLMIT LicenseMIT

⚡️ ghost.sh

Twitter Follow GitHub Repo stars

ghost.sh is a 1-Click solution that makes it a breeze ⚡️ to self-host Ghost on Ubuntu Linux.

Still a WIP!

Important

Targeting a v1.0 release but not there yet because I've not had time to finish up the TODOs I left in the code.

Why?

Ghost offers an easy-to-use 1-Click App on the DigitalOcean Marketplace but the 1-Click App is not available on other cloud providers. ghost.sh plans to fix that by being a 1-Click solution for installing Ghost on any cloud provider, starting with AWS.

You can read more about what motivated me to start this project on my blog: ghost.sh.

Dependencies

You will need to have to following CLI tools installed:

  • Terraform (tested on v1.5.2+)

Install Terraform on your machine.

  • On macOS use brew:

    brew tap hashicorp/tap
    brew install hashicorp/tap/terraform
    
    terraform --version
    Terraform v1.5.2
    on darwin_amd64
  • On Ubuntu use snap:

    sudo snap install terraform --classic
    
    terraform -version
    Terraform v1.5.3
    on linux_amd64

Getting Started

  1. Clone this repo to the path ~/ghost.sh/ on your machine:

    mkdir ~/ghost.sh && cd ~/ghost.sh
    git clone https://github.com/ayewo/ghost.sh .
  2. Create SSH keys for administering the instance that will be created by Terraform:

    mkdir -p ~/ghost.sh_ssh/
    ssh-keygen -t ed25519 -C "ghost-mgr@ghost.sh" -f ~/ghost.sh_ssh/ghost_admin_ssh_key

    Alternatively, if you have existing SSH keys, you can specify them in terraform.tfvars inside the ~/ghost.sh/ folder:

    cat << EOF > terraform.tfvars
    ghost_admin_email           = "admin@example.com"
    ghost_admin_ssh_public_key  = "path/to/ssh/key.pub"
    ghost_admin_ssh_private_key = "path/to/ssh/key"%
    EOF
  3. Specify your AWS credentials1 inside ~/.aws/credentials:

    mkdir -p ~/.aws && cat << EOF > ~/.aws/credentials
    # iam-user-with-admin-privileges
    [default]
    aws_access_key_id=AKIAIOSFODNN7EXAMPLE
    aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
    EOF

    Alternatively, you can use environment variables:

    export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
    export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  4. Run the code:

    terraform init
    terraform apply -auto-approve

Trivia

The name ghost.sh can be expanded to mean "Ghost Self Hosting".

License

Licensed under the MIT License.

Ghost is a trademark of The Ghost Foundation. This project is not affiliated with The Ghost Foundation.

Footnotes

  1. ☂️ Please use an IAM user with the ability to create resources in your AWS organization, otherwise you will receive the dreaded "UnauthorizedOperation: You are not authorized to perform this operation" error and the deploymnent will fail.