From 73a20132df0e7dd72d7e099195404bfd9fbf2b19 Mon Sep 17 00:00:00 2001 From: Nuno do Carmo Date: Thu, 11 Oct 2018 13:02:26 +0200 Subject: [PATCH] Added Docker sub-section to Proxy section in Walkthrough (#650) * added Docker sub-section * Added docker subsection Corrected the typos and, for this PR, the subsection is located before the `Using the proxy` section, it is more streamlined. * Docker intro updated As suggested by @robjloranger, the intro of the docker section has been updated to make it more simple to read. --- docs/content/walkthrough.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/content/walkthrough.md b/docs/content/walkthrough.md index e5ed3960..4c2d4757 100644 --- a/docs/content/walkthrough.md +++ b/docs/content/walkthrough.md @@ -86,9 +86,41 @@ the proxy is using in-memory storage, which is only suitable for trying out the for a short period of time, as you will quickly run out of memory and the storage doesn't persist between restarts. +### With Docker +In order to run the Athens Proxy using docker, we need first to create a directory that will store the persitant modules. +In the example below, the new directory is named `athens-storage` and is located in our userspace (i.e. `$HOME`). +Then we need to set the `ATHENS_STORAGE_TYPE` and `ATHENS_DISK_STORAGE_ROOT` environment variables when we run the Docker container. + +**Bash** +```bash +export ATHENS_STORAGE=$HOME/athens-storage +mkdir -p $ATHENS_STORAGE +docker run -d -v $ATHENS_STORAGE:/var/lib/athens \ + -e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens \ + -e ATHENS_STORAGE_TYPE=disk \ + --name athens-proxy \ + --restart always \ + -p 3000:3000 \ + gomods/proxy:latest +``` + +**PowerShell** +```PowerShell +$env:ATHENS_STORAGE = "$(Join-Path $HOME athens-storage)" +md -Path $env:ATHENS_STORAGE +docker run -d -v "$($env:ATHENS-STORAGE):/var/lib/athens" ` + -e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens ` + -e ATHENS_STORAGE_TYPE=disk ` + --name athens-proxy ` + --restart always ` + -p 3000:3000 ` + gomods/proxy:latest +``` + Next, you will need to enable the [Go Modules](https://github.com/golang/go/wiki/Modules) feature and configure Go to use the proxy! +### Using the proxy **Bash** ```bash export GO111MODULE=on