docs: Update to new deployment method (import instead of fork)

Now you clone nix-bitcoin and start out from the examples.
This commit is contained in:
Jonas Nick 2020-03-21 21:08:51 +00:00
parent 5ed0284db9
commit b2e15c17b8
No known key found for this signature in database
GPG Key ID: 4861DBF262123605

View File

@ -84,33 +84,57 @@ You can also build Nix from source by following the instructions at https://nixo
This eliminates an attack vector where nix's build server or binary cache is compromised. This eliminates an attack vector where nix's build server or binary cache is compromised.
## 3. Nixops deployment ## 3. Setup deployment directory
1. Clone this project 1. Clone this project
``` ```
cd cd
git clone https://github.com/fort-nix/nix-bitcoin git clone https://github.com/fort-nix/nix-bitcoin
cd ~/nix-bitcoin
``` ```
2. Setup environment 2. Obtain the hash of the latest nix-bitcoin release
```
cd nix-bitcoin/examples
nix-shell
```
This will download the nix-bitcoin dependencies and might take a while without giving an output.
Now in the nix-shell run
```
fetch-release > nix-bitcoin-release.nix
```
3. Create a new directory for your nix-bitcoin deployment and copy initial files from nix-bitcoin
```
cd ../../
mkdir nix-bitcoin-node
cd nix-bitcoin-node
cp -r ../nix-bitcoin/examples/{configuration.nix,nixops,shell.nix,nix-bitcoin-release.nix} .
```
## 4. Deploy with NixOps
1. Enter environment
``` ```
nix-shell nix-shell
``` ```
This will set up your nix-bitcoin environment and might take a while without giving an output. Note that a new directory `secrets/` appeared which contains the secrets for your node.
3. Create nixops deployment in nix-shell. 2. Create nixops deployment in nix-shell.
``` ```
nixops create network/network.nix network/network-vbox.nix -d bitcoin-node nixops create nixops/node.nix nixops/node-vbox.nix -d bitcoin-node
``` ```
4. Adjust configuration by opening `configuration.nix` and removing FIXMEs. Enable/disable the modules you want in `configuration.nix`. 3. Adjust configuration by opening `configuration.nix` and removing FIXMEs. Enable/disable the modules you want in `configuration.nix`.
5. Deploy Nixops in nix-shell 4. Deploy Nixops in nix-shell
``` ```
nixops deploy -d bitcoin-node nixops deploy -d bitcoin-node
@ -118,7 +142,7 @@ You can also build Nix from source by following the instructions at https://nixo
This will now create a nix-bitcoin node on the target machine. This will now create a nix-bitcoin node on the target machine.
6. Nixops automatically creates an ssh key for use with `nixops ssh`. Access `bitcoin-node` through ssh in nix-shell with 5. Nixops automatically creates an ssh key for use with `nixops ssh`. Access `bitcoin-node` through ssh in nix-shell with
``` ```
nixops ssh operator@bitcoin-node nixops ssh operator@bitcoin-node
@ -128,7 +152,7 @@ See [usage.md](usage.md) for usage instructions, such as how to update.
To resize the VM disk image, you can use this helper script from within nix-shell: To resize the VM disk image, you can use this helper script from within nix-shell:
``` ```
./helper/vbox-resize-disk1.sh --help ../nix-bitcoin/helper/vbox-resize-disk1.sh --help
``` ```
---- ----
@ -320,24 +344,20 @@ This is borrowed from the [NixOS manual](https://nixos.org/nixos/manual/index.ht
reboot reboot
``` ```
## 2. Nix installation ## 2. Nix installation
Follow the [Nix installation](#2-nix-installation) instructions from the tutorial above (on the machine you are going to deploy from).
Follow the instructions from [Nix installation on debian](#2-nix-installation) (on the machine you are going to deploy from).
## 3. Nixops deployment ## 3. Setup deployment directory
Follow the [Setup deployment directory](#3-setup-deployment-directory) instructions from the tutorial above (on the machine you are going to deploy from).
4. Clone this project
## 4. Deploy with NixOps
1. Make sure you are in the deployment directory and create a nixops network file as follows
``` ```
cd nano nixops/node-nixos.nix
git clone https://github.com/fort-nix/nix-bitcoin
cd ~/nix-bitcoin
```
5. Create network file
```
nano network/network-nixos.nix
``` ```
``` ```
@ -351,7 +371,7 @@ Follow the instructions from [Nix installation on debian](#2-nix-installation) (
Replace 1.2.3.4 with NixOS machine's IP address. Replace 1.2.3.4 with NixOS machine's IP address.
6. Edit `configuration.nix` 2. Edit `configuration.nix`
``` ```
nano configuration.nix nano configuration.nix
@ -359,14 +379,14 @@ Follow the instructions from [Nix installation on debian](#2-nix-installation) (
Uncomment `./hardware-configuration.nix` line by removing #. Uncomment `./hardware-configuration.nix` line by removing #.
7. Create `hardware-configuration.nix` 3. Create `hardware-configuration.nix`
``` ```
nano hardware-configuration.nix nano hardware-configuration.nix
``` ```
Copy contents of NixOS machine's `/etc/nixos/hardware-configuration.nix` to file. Copy contents of NixOS machine's `/etc/nixos/hardware-configuration.nix` to file.
8. Add boot option to `hardware-configuration.nix` 4. Add boot option to `hardware-configuration.nix`
Option 1: Enable systemd boot for UEFI Option 1: Enable systemd boot for UEFI
``` ```
@ -377,23 +397,23 @@ Follow the instructions from [Nix installation on debian](#2-nix-installation) (
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
``` ```
9. Setup environment 5. Enter environment
``` ```
nix-shell nix-shell
``` ```
This will set up your nix-bitcoin environment and might take a while without giving an output. Note that a new directory `secrets/` appeared which contains the secrets for your node.
10. Create nixops deployment in nix-shell. 6. Create nixops deployment in nix-shell.
``` ```
nixops create network/network.nix network/network-nixos.nix -d bitcoin-node nixops create nixops/node.nix nixops/node-nixos.nix -d bitcoin-node
``` ```
11. Adjust configuration by opening `configuration.nix` and removing FIXMEs. Enable/disable the modules you want in `configuration.nix`. 7. Adjust configuration by opening `configuration.nix` and removing FIXMEs. Enable/disable the modules you want in `configuration.nix`.
12. Deploy Nixops in nix-shell 8. Deploy Nixops in nix-shell
``` ```
nixops deploy -d bitcoin-node nixops deploy -d bitcoin-node
@ -401,7 +421,7 @@ Follow the instructions from [Nix installation on debian](#2-nix-installation) (
This will now create a nix-bitcoin node on the target machine. This will now create a nix-bitcoin node on the target machine.
13. Nixops automatically creates an ssh key for use with `nixops ssh`. Access `bitcoin-node` through ssh in nix-shell with 9. Nixops automatically creates an ssh key for use with `nixops ssh`. Access `bitcoin-node` through ssh in nix-shell with
``` ```
nixops ssh operator@bitcoin-node nixops ssh operator@bitcoin-node