|
| 1 | +## provsn |
| 2 | + |
| 3 | +provsn is our homemade provisioning tool. |
| 4 | + |
| 5 | +## Requirements |
| 6 | + |
| 7 | +* parallel |
| 8 | +* bash |
| 9 | +* ssh |
| 10 | +* jq |
| 11 | +* readlink |
| 12 | +* dirname |
| 13 | +* find |
| 14 | +* xargs |
| 15 | +* sed |
| 16 | +* awk |
| 17 | +* uniq |
| 18 | +* sort |
| 19 | + |
| 20 | +## Concepts |
| 21 | + |
| 22 | +provsn is a simple and nimble little tool, we just have a few concepts you need |
| 23 | +to understand to be able to use it and contribute. |
| 24 | + |
| 25 | +### Host |
| 26 | + |
| 27 | +A host is a computer that you have ssh access to and want to manage. They |
| 28 | +are all mapped in `env.sh` in the root directory. |
| 29 | + |
| 30 | +Typically looks something like this: |
| 31 | + |
| 32 | +```sh |
| 33 | +# digitalocean-sfo1 |
| 34 | + |
| 35 | +pluto_units=(${baseunits[@]} ${gatewayunits[@]}) |
| 36 | +``` |
| 37 | + |
| 38 | +### Unit |
| 39 | + |
| 40 | +A unit is something that you can install and manage on a host. A unit needs to |
| 41 | +have at least a `env.sh` file in it's directory. Typical structure: |
| 42 | + |
| 43 | +``` |
| 44 | +nginx |
| 45 | +├── 451.html |
| 46 | +├── build.sh |
| 47 | +├── env.sh |
| 48 | +├── install.sh |
| 49 | +└── nginx.conf |
| 50 | +``` |
| 51 | + |
| 52 | +Both `451.html` and `nginx.conf` is unique for the nginx unit. |
| 53 | + |
| 54 | +`env.sh` sets environment variables for this unit, in this case setting the nginx |
| 55 | +version we want to use. |
| 56 | + |
| 57 | +`build.sh` contains setup instructions for our `install.sh` script. In nginx case, |
| 58 | +we copy `451.html` and `nginx.conf` to `out/` and then also create a `out/docker.opts` |
| 59 | +file with our arguments to docker. |
| 60 | + |
| 61 | +`install.sh` is the script that actually installs nginx on our hosts. We now have |
| 62 | +access to our files in `out/` on our host, so we copy them to the right place and |
| 63 | +compare if anything changed. If it did, we make sure to restart the docker container. |
| 64 | + |
| 65 | +## How to use provsn |
| 66 | + |
| 67 | +provsn is a simple bash tool that should work on all platforms. To run, it simply |
| 68 | +execute the script. |
| 69 | + |
| 70 | +```sh |
| 71 | +./provsn <command> <@args> |
| 72 | +``` |
| 73 | + |
| 74 | +## Common Tasks |
| 75 | + |
| 76 | +### Gathering ipfs debug info |
| 77 | + |
| 78 | +Grab the logs since `1 minute ago` on `pluto` |
| 79 | + |
| 80 | +```sh |
| 81 | +./provsn exec pluto "docker logs --since 1m ipfs" |
| 82 | +``` |
| 83 | + |
| 84 | +### Updating IPFS on hosts |
| 85 | + |
| 86 | +### Deploying a website |
| 87 | + |
| 88 | +### Adding a root user |
| 89 | + |
| 90 | +### Adding hashes to the blocklist |
0 commit comments