Skip to content

Commit

Permalink
Merge pull request #21 from gildlab/2023-11-07-flake
Browse files Browse the repository at this point in the history
2023 11 07 flake
  • Loading branch information
thedavidmeister committed Nov 7, 2023
2 parents c48b769 + a53e593 commit a450bed
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 18 deletions.
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,18 @@ Run `gl-config-edit` in nix shell to setup config for your environment.

`GILDLAB_IPFS_NODE_CHANNEL` : Set the channel (github branch) to either `main` or `develop`. Default is `main` if not set.

#### Setup peerlist

Run `gl-peerlist-edit` in nix shell to setup the peerlist.
Each peer is simply a newline.

For ngrok peers each line will look like:

```
/dns/1.tcp.ngrok.io/tcp/<port>/p2p/<ipfs id>
```
#### (Re)start the docker

Where your `port` can be found on the ngrok dashboard and your own `ipfs id` can be found by running `docker exec gl_ipfs ipfs id`.
Run `gl-docker-start` in nix shell to (re)boot all the boxes.

Each peer on the same setup can run the same commands to tell you their ipfs id and ngrok tcp port.
This needs to be run whenever config/peerlist/etc. changes so that the changes take effect.

You can also share peerlists in telegram, etc.
## Commands

#### (Re)start the docker
### New password for ipfs node

Run `gl-docker-start` in nix shell to (re)boot all the boxes.
1. Enter `nix develop`
2. htpasswd -nbB -C 10 <username> <password>

This needs to be run whenever config/peerlist/etc. changes so that the changes take effect.
This will provide hashed (bcrypt) version of the password with username in a
format that is compatible with nginx.
164 changes: 164 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
description = "Flake for development workflows.";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/ec750fd01963ab6b20ee1f0cb488754e8036d89d";
gildlab.url = "github:gildlab/gildlab.cli/b45f0e1b2a783f0581c3e8cccd1b1756b49d1376";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, gildlab, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};

path = "$HOME/.config/gildlab/ipfs-node";
ensure-home = ''
set -u
export GILDLAB_IPFS_NODE_BASE_PATH=${path}
mkdir -p ${path}
mkdir -p ${path}/volumes/ipfs/data/ipfs
mkdir -p ${path}/volumes/ipfs/export
mkdir -p ${path}/volumes/pin
mkdir -p ${path}/volumes/nginx
touch ${path}/.env
'';

in rec {
packages = rec {

};

devShell = pkgs.mkShell rec {
buildInputs = [
gildlab.defaultPackage.${system}
pkgs.apacheHttpd
];

shellHook = ''
${ensure-home}
'';
};
}
);
}
4 changes: 2 additions & 2 deletions pin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM nixos/nix:2.16.1
FROM nixos/nix:2.18.1

# Get latest gildlab cli from main
RUN nix --extra-experimental-features "nix-command flakes" --print-build-logs profile install github:gildlab/gildlab-cli && nix-collect-garbage -d
RUN nix --extra-experimental-features "nix-command flakes" --print-build-logs profile install github:gildlab/gildlab.cli/b45f0e1b2a783f0581c3e8cccd1b1756b49d1376 && nix-collect-garbage -d
RUN gildlab-cli --version

ADD . .
Expand Down

0 comments on commit a450bed

Please sign in to comment.