|
|
2 år sedan | |
|---|---|---|
| .. | ||
| README.md | f4fd0c2f5e Update README.md | 2 år sedan |
| docker-compose.override.yml | 9f7cc634d9 dont listen on a public IP | 2 år sedan |
| tunnel-compose.sh | b62dea0806 readme, script, compose file | 2 år sedan |
Dev scripts for Netmaker
Creates tunnels between a local instance and a docker-compose deployment on a droplet. Allows for fast local builds and local debugging.
Steps:
Create 2 ssh hosts in ~/.ssh/config (adjust DROPLET and IP):
Host DROPLET
User root
Hostname IP
Host DROPLET-docker-netmaker
User user
Hostname localhost
Port 2222
ProxyJump DROPLET
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
RequestTTY no
RemoteCommand cat
Copy ./scripts/dev/docker-compose.override.yml to the installation dir on DROPLET (merge if already exists)
docker-compose down
docker-compose up --force-recreate
./scripts/dev/tunnel-compose.sh DROPLET-docker-netmaker
Add env vars to the local build (include MQ_PASSWORD from the droplet), eg:
MQ_PASSWORD=SECRET;MQ_USERNAME=netmaker;SERVER_BROKER_ENDPOINT=ws://localhost:1883;VERBOSE=3
At this point tunnels should be set up and running a local build should talk to the docker-compose services on the droplet.
Option 1 - run docker-compose (WITHOUT the override) and copy the existing DB:
# on the droplet
docker-compose up --force-recreate netmaker
docker cp netmaker:/data/netmaker.db .
# on the host
scp DROPLET:netmaker.db data
Option 2 (CE ONLY) - re-run nm-quick (WITH the override and a running local server) to re-create the DB:
wget https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/nm-quick.sh
chmod +x nm-quick.sh
env NM_SKIP_BUILD=1 ./nm-quick.sh -b local -t BRANCH_NAME