|
1 | | -# Install Warnet |
| 1 | +# Installing Warnet |
2 | 2 |
|
3 | | -Warnet requires Kubernetes in order to run the network. Kubernetes can be run |
4 | | -remotely or locally (with minikube or Docker Desktop). `kubectl` must be run |
5 | | -locally to administer the network. |
| 3 | +Warnet requires Kubernetes (k8s) and helm in order to run the network. Kubernetes can be run remotely or locally (with minikube or Docker Desktop). `kubectl` and `helm` must be run locally to administer the network. |
6 | 4 |
|
7 | 5 | ## Dependencies |
8 | 6 |
|
9 | | -### Kubernetes |
| 7 | +### Remote (cloud) cluster |
10 | 8 |
|
11 | | -Install [`kubectl`](https://kubernetes.io/docs/setup/) (or equivalent) and |
12 | | -configure your cluster. This can be done locally with `minikube` (or Docker Desktop) |
13 | | -or using a managed cluster. |
| 9 | +The only two dependencies of Warnet are `helm` and `kubectl` configured to talk to your cloud cluster. |
14 | 10 |
|
15 | | -#### Docker engine with minikube |
| 11 | +### Running Warnet Locally |
16 | 12 |
|
17 | | -If using Minikube to run a smaller-sized local cluster, you will require docker engine. |
18 | | -To install docker engine, see: https://docs.docker.com/engine/install/ |
| 13 | +If the number of nodes you are running can run on one machine (think a dozen or so) then Warnet can happily run on a local Kubernetes. Two supported k8s implementations are Minikube and K8s as part of Docker Desktop. |
19 | 14 |
|
20 | | -e.g. For Ubuntu: |
| 15 | +#### Docker Desktop |
21 | 16 |
|
22 | | -```bash |
23 | | -# First uninstall any old versions |
24 | | -for pkg in docker.io docker-doc podman-docker containerd runc; do sudo apt-get remove $pkg; done |
25 | | - |
26 | | -# Add Docker's official GPG key: |
27 | | -sudo apt-get update |
28 | | -sudo apt-get install ca-certificates curl gnupg |
29 | | -sudo install -m 0755 -d /etc/apt/keyrings |
30 | | -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg |
31 | | -sudo chmod a+r /etc/apt/keyrings/docker.gpg |
32 | | - |
33 | | -# Add the repository to Apt sources: |
34 | | -echo \ |
35 | | - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ |
36 | | - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ |
37 | | - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
38 | | -sudo apt-get update |
39 | | - |
40 | | -# Install the docker packages |
41 | | -sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin |
| 17 | +[Docker desktop](https://www.docker.com/products/docker-desktop/) includes the docker engine itself and has an option to enable Kubernetes. Simply installing it and enabling Kubernetes should be enough. |
| 18 | + |
| 19 | +[Helm](https://helm.sh/docs/intro/install/) is also required to be installed. |
| 20 | + |
| 21 | +#### Minikube |
| 22 | + |
| 23 | +Minikube requires a backend to run on with the supported backend being Docker. So if installing Minikube, you may need to install docker first. Please see [Installing Docker](https://docs.docker.com/engine/install/) and [Installing Minkube](https://minikube.sigs.k8s.io/docs/start/). |
| 24 | + |
| 25 | +After installing Minikube don't forget to start it with: |
| 26 | + |
| 27 | +```shell |
| 28 | +minikube start |
42 | 29 | ``` |
43 | 30 |
|
44 | | -#### Using Docker |
| 31 | +Minikube has a [guide](https://kubernetes.io/docs/tutorials/hello-minikube/) on getting started which could be useful to validate that your minikube is running correctly. |
45 | 32 |
|
46 | | -If you have never used Docker before you may need to take a few more steps to run the Docker daemon on your system. |
47 | | -The Docker daemon MUST be running before stating Warnet. |
| 33 | +### Testing kubectl and helm |
| 34 | + |
| 35 | +The following commands should run on both local and remote clusters. Do not proceed unless kubectl and helm are working. |
| 36 | + |
| 37 | +```shell |
| 38 | +helm repo add examples https://helm.github.io/examples |
| 39 | +helm install hello examples/hello-world |
| 40 | +helm list |
| 41 | +kubectl get pods |
| 42 | +helm uninstall hello |
| 43 | +``` |
48 | 44 |
|
49 | 45 | #### Managing Kubernetes cluster |
50 | 46 |
|
51 | 47 | The use of a k8s cluster management tool is highly recommended. |
52 | 48 | We like to use `k9s`: https://k9scli.io/ |
53 | 49 |
|
54 | | -##### Linux |
| 50 | +## Install Warnet |
55 | 51 |
|
56 | | -- [Check Docker user/group permissions](https://stackoverflow.com/a/48957722/1653320) |
57 | | -- or [`chmod` the Docker UNIX socket](https://stackoverflow.com/a/51362528/1653320) |
| 52 | +Either install warnet via pip, or clone the source and install: |
58 | 53 |
|
59 | | -## Install Warnet |
| 54 | +### via pip |
60 | 55 |
|
61 | | -### Recommended: use a virtual Python environment such as `venv` |
| 56 | +You can install warnet via `pip` into a virtual environment with |
62 | 57 |
|
63 | 58 | ```bash |
64 | | -python3 -m venv .venv # Use alternative venv manager if desired |
| 59 | +python3 -m venv .venv |
65 | 60 | source .venv/bin/activate |
66 | | -``` |
67 | | - |
68 | | -```bash |
69 | | -pip install --upgrade pip |
70 | 61 | pip install warnet |
71 | 62 | ``` |
72 | 63 |
|
73 | | -## Contributing / Local Warnet Development |
| 64 | +### via cloned source |
74 | 65 |
|
75 | | -### Download the code repository |
| 66 | +You can install warnet from source into a virtual environment with |
76 | 67 |
|
77 | 68 | ```bash |
78 | | -git clone https://github.com/bitcoin-dev-project/warnet |
| 69 | +git clone https://github.com/bitcoin-dev-project/warnet.git |
79 | 70 | cd warnet |
| 71 | +python3 -m venv .venv |
| 72 | +source .venv/bin/activate |
| 73 | +pip install -e . |
80 | 74 | ``` |
81 | 75 |
|
82 | | -### Recommended: use a virtual Python environment such as `venv` |
| 76 | +## Running |
| 77 | + |
| 78 | +To get started first check you have all the necessary requirements: |
83 | 79 |
|
84 | 80 | ```bash |
85 | | -python3 -m venv .venv # Use alternative venv manager if desired |
86 | | -source .venv/bin/activate |
| 81 | +warnet setup |
87 | 82 | ``` |
88 | 83 |
|
| 84 | +Then create your first network: |
| 85 | + |
89 | 86 | ```bash |
90 | | -pip install --upgrade pip |
91 | | -pip install -e . |
92 | | -``` |
| 87 | +# Create a new network in the current directory |
| 88 | +warnet init |
93 | 89 |
|
| 90 | +# Or in a directory of choice |
| 91 | +warnet new <directory> |
| 92 | +``` |
0 commit comments