From 1c2e0ff75a7053ed57aef221fe64e2c553a76c1c Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Wed, 23 Jun 2021 19:01:42 +0100 Subject: [PATCH] docs: movs docs to /docs, add deploy docs --- README.md | 2 +- APIs.md => docs/APIs.md | 0 docs/deploy.md | 37 +++++++++++++++++++++++++++++++++ help.md => docs/help.md | 0 services.md => docs/services.md | 0 5 files changed, 38 insertions(+), 1 deletion(-) rename APIs.md => docs/APIs.md (100%) create mode 100644 docs/deploy.md rename help.md => docs/help.md (100%) rename services.md => docs/services.md (100%) diff --git a/README.md b/README.md index f8c9e60..8eecbd6 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ sudo ./bank ## Connected Services -Go to [here](help.md) to see the API's endpoints. Using the Bank's API allows (you/others) to (make/use) connected services that utilize the bank, a couple ideas can be found [here](services.md) +Go to [here](docs/help.md) to see the API's endpoints. Using the Bank's API allows (you/others) to (make/use) connected services that utilize the bank, a couple ideas can be found [here](docs/services.md) ## FAQ **Q:** how is money initially injected into the economy diff --git a/APIs.md b/docs/APIs.md similarity index 100% rename from APIs.md rename to docs/APIs.md diff --git a/docs/deploy.md b/docs/deploy.md new file mode 100644 index 0000000..f6c4b52 --- /dev/null +++ b/docs/deploy.md @@ -0,0 +1,37 @@ +# Deploying CCash + +CCash can deployed to a remote machine pretty simply. + +A pre-built docker image is supplied in the repos [GitHub Packages](https://github.com/features/packages) container registry [EntireTwix/CCash](https://github.com/EntireTwix/CCash/packages/851105). + +It can be run with docker like so: + +``` +docker pull docker.pkg.github.com/entiretwix/ccash/ccash:latest +``` + +## Build + +The CCash repo provides a GitHub Workflow to build, release and publish the docker image in [.github/workflows/build.yaml](https://github.com/EntireTwix/CCash/blob/main/.github/workflows/build.yaml) to the GitHub Packages container registry. + +You can build and publish your own images using this workflow by forking [EntireTwix/CCash](https://github.com/EntireTwix/CCash). + +## Deploy + +You can deploy this docker image to be run on a remote machine in a few steps. In this case we are using [Debian OS](https://www.debian.org/) running on the [Linode](https://www.linode.com/) cloud provider, but most OS and cloud providers will work, assuming the machine can run an SSH server and Docker. + +Similarly, the CCash repo also provides a GitHub Workflow to deploy the latest docker image to a remote machine in [.github/workflows/deploy.yaml](https://github.com/EntireTwix/CCash/blob/main/.github/workflows/deploy.yaml). + +### Configure the machine + +* Create a machine using your chosen cloud provider. +* Configure DNS to point your chosen domain name to the machines IP address. _(Without this, TLS/SSL will not work)_. +* Create an SSH key-pair by running `ssh-keygen` locally. Make sure you **don't** set a password. +* Add the `*.pub` public key to the servers `~/.ssh/authorized_keys` file. +* Install Docker Engine following [official docs](https://docs.docker.com/engine/install/). +* Add the private key _(not `*.pub`)_ to a [GitHub secret](https://docs.github.com/en/actions/reference/encrypted-secrets) named `CCASH_SSH_KEY` in your CCash repo. +* Add the domain name pointing to the remote machine to a GitHub secret named `CCASH_DOMAIN`. + +You are now ready to run the "Deploy" workflow mentioned above. This workflow will SSH in to the `CCASH_DOMAIN` machine, using the `CCASH_SSH_KEY` and `docker run` the latest `entiretwix/ccash` image, binding to port 80 and 443. It will also handle the creation of a TLS/SSL certificate for you. + +Visiting `https://$SSH_TARGET/BankF/ping` in your browser should verify that it has been deployed correctly. diff --git a/help.md b/docs/help.md similarity index 100% rename from help.md rename to docs/help.md diff --git a/services.md b/docs/services.md similarity index 100% rename from services.md rename to docs/services.md