Skip to content

Commit

Permalink
feature/deploy linux (#1206)
Browse files Browse the repository at this point in the history
* chore(deploy): remove devbox configuration

* feat(taskfiles): add mount and platform specific start commands for IPFS
  • Loading branch information
prnk28 authored Dec 22, 2024
1 parent 59b561d commit 4d6a862
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 50 deletions.
9 changes: 7 additions & 2 deletions .taskfiles/Hway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ tasks:
build:
desc: Build the hway binary
silent: true
cmds:
cmds:
- gum spin --spinner dot --title "Build Hway Single Target ({{.OS}}/{{.ARCH}})..." -- goreleaser build --snapshot --clean --single-target --id hway -o {{.BIN_DIR}}/hway

install:
desc: Install the hway binary
silent: true
cmds:
- gum spin --spinner dot --title "Install Hway Single Target ({{.OS}}/{{.ARCH}})..." -- make install-hway

start:
desc: Start the hway daemon
silent: true
deps: [build]
cmds:
- "{{.BINARY}}"
25 changes: 19 additions & 6 deletions .taskfiles/IPFS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,22 @@ tasks:
- ipfs config --json Peering.Peers {{.PEERS}}
- ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'

start:
desc: Start the ipfs daemon
silent: true
deps: [init]
cmds:
- ipfs daemon
mount:
desc: Mount the ipfs,ipns directories
silent: true
platforms:
- linux
cmds:
- ipfs config --json Mounts.FuseAllowOther true

start:
desc: Start the ipfs daemon
silent: true
cmds:
- cmd: ipfs daemon --migrate
platforms:
- darwin
- task: mount
- cmd: ipfs daemon --mount
platforms:
- linux
10 changes: 3 additions & 7 deletions .taskfiles/Sonrd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ vars:
BINARY: sonrd
BUILD_FLAGS: -mod=readonly -trimpath
BUILD_TAGS: netgo,ledger
COMMIT:
COMMIT:
sh: git rev-parse HEAD
VERSION:
sh: git describe --tags --always
DOPPLER_TOKEN:
sh: skate get DOPPLER_NETWORK

tasks:
build:
desc: Build the sonrd binary
Expand All @@ -30,11 +27,11 @@ tasks:
./cmd/sonrd
env:
CGO_ENABLED: 1
GOARCH:
GOARCH:
sh: go env GOARCH
GOOS:
sh: go env GOOS

install:
desc: Install sonrd
silent: true
Expand All @@ -45,4 +42,3 @@ tasks:
desc: Start the sonr node
cmds:
- sh scripts/test_dop_node.sh

69 changes: 67 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ tasks:
desc: Install go dependencies
silent: true
vars:
DEPS: ["github.com/apple/pkl-go/cmd/pkl-gen-go@latest", "github.com/sqlc-dev/sqlc/cmd/sqlc@latest", "github.com/goreleaser/goreleaser/v2@latest","github.com/a-h/templ/cmd/templ@latest"]
DEPS:
[
"github.com/apple/pkl-go/cmd/pkl-gen-go@latest",
"github.com/sqlc-dev/sqlc/cmd/sqlc@latest",
"github.com/goreleaser/goreleaser/v2@latest",
"github.com/a-h/templ/cmd/templ@latest",
]
cmds:
- for: { var: DEPS }
cmd: gum spin --spinner dot --title "Installing go dependencies..." -- go install {{.ITEM}}
Expand All @@ -54,7 +60,7 @@ tasks:
cmds:
- for: { var: FILES }
cmd: gum spin --spinner dot --title "Generating PKL in Go..." -- pkl-gen-go {{.ITEM}}

proto-gen:
desc: Generate proto files
silent: true
Expand All @@ -70,3 +76,62 @@ tasks:
desc: Generate templ files
silent: true
cmd: gum spin --spinner dot --title "Generating Templ..." -- templ generate

start:
desc: Start the Network
silent: true
cmds:
- task: postgres:reset
- task: ipfs:init
- task: ipfs:mount
- task: sonrd:install
- task: hway:build
- task: procs-up

status:
desc: Check the status of the Network
silent: true
cmds:
- task: procs-attach

stop:
desc: Stop the Network
silent: true
cmds:
- task: procs-down

procs-up:
internal: true
dir: "deploy"
cmds:
- cmd: process-compose up
platforms:
- darwin

- cmd: process-compose up --use-uds --unix-socket /tmp/sonr-network.sock -D
platforms:
- linux

procs-down:
internal: true
dir: "deploy"
cmds:
- cmd: process-compose down
platforms:
- darwin

- cmd: process-compose down --use-uds --unix-socket /tmp/sonr-network.sock
platforms:
- linux

procs-attach:
internal: true
dir: "deploy"
cmds:
- cmd: process-compose attach --use-uds --unix-socket /tmp/sonr-network.sock
platforms:
- linux

- cmd: process-compose attach
platforms:
- darwin
18 changes: 0 additions & 18 deletions deploy/devbox.json

This file was deleted.

23 changes: 8 additions & 15 deletions deploy/process-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
version: "0.5"

environment:
- "PC_DISABLE_TUI=true"
log_location: "./tmp/logs"
log_level: "debug"

processes:
IPFS:
namespace: testnet
command: "task ipfs:start"
availability:
restart: "always"
command: "ipfs daemon --mount"
ready_log_line: "Daemon is ready"

Sonr:
namespace: testnet
command: "task sonrd:start"
depends_on:
ipfs:
condition: process_completed
environment:
- "SONR_NETWORK=testnet"
IPFS:
condition: process_log_ready

Hway:
namespace: testnet
command: "hway"
depends_on:
sonr:
condition: process_completed_successfully

IPFS:
condition: process_log_ready
Sonr:
condition: process_started

0 comments on commit 4d6a862

Please sign in to comment.