From a7388aecef8cf2b173410bef8c576f0115fe1edc Mon Sep 17 00:00:00 2001 From: Samy Fodil <76626119+samyfodil@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:46:13 -0500 Subject: [PATCH] Enhance User Experience (#53) * better README * now takes "--root" * fixed store location --- README.md | 187 +++++++++++++++++- cli/app/app.go | 9 +- cli/app/parse_config.go | 120 ++++++----- cli/app/run_test.go | 33 +++- cli/app/testConfig.yaml | 4 +- cli/node/helpers.go | 12 +- cli/node/start.go | 13 +- clients/http/auth/e2e_test.go | 2 +- config/protocols.go | 12 +- go.mod | 12 +- go.sum | 24 +-- libdream/services/service.go | 2 + .../fixtures/compile/fixture_compile_for.go | 2 +- protocols/seer/db_helpers.go | 2 +- protocols/seer/sql.go | 2 +- 15 files changed, 326 insertions(+), 110 deletions(-) diff --git a/README.md b/README.md index 77ad5191..b99ba3d0 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,189 @@ [![GoDoc](https://godoc.org/github.com/taubyte/tau?status.svg)](https://pkg.go.dev/github.com/taubyte/tau) [![Discord](https://img.shields.io/discord/973677117722202152?color=%235865f2&label=discord)](https://discord.gg/taubyte) -`tau` is the implementation of a Taubyte Node. Documentation: [https://tau.how](https://tau.how). +`tau` is the mainstream implementation of a Taubyte Node. When interconnected, these nodes form a network that's cloud computing-ready, offering features such as: + - Serverless WebAssembly Functions + - Website/Frontend Hosting + - Object Storage + - K/V Database + - Pub-Sub Messaging + +For detailed documentation, visit [https://tau.how](https://tau.how). + +## Getting started + +### Requirements + +#### Hardware +The requirements for `tau` vary depending on the shape, but at a minimum, assuming an empty shape, it requires: + +- 512MB of RAM +- 2GB of storage space + +#### Operating system +While `tau` can be cross-compiled to various operating systems, for a quick and seamless deployment we recommend using a Linux distribution that employs SystemD. + + +#### Network requirements +Depending on the enabled protocols, `tau` will require certain network ports to be available and open: + +- Three configurable TCP ports for peer-to-peer (P2P) communication +- Ports 80 and 443 for HTTP and HTTPS respectively +- Ports 53 and 953 for DNS, supporting both TCP and UDP + + +#### Freeing DNS Ports +DNS needs to be freed up for seer protocol to start properly. Follow these steps to adjust DNS settings: + +1. Open `/etc/systemd/resolved.conf` with a text editor (nano, vim) +2. Set `DNS=1.1.1.1` and `DNSStubListener=no` +3. Run `systemctl restart systemd-resolved.service` +4. Run `ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf` + + +### Installation + +#### From source +```bash +$ go install github.com/taubyte/tau +``` + +#### From binary + - Download the [latest release](https://github.com/taubyte/tau/releases) + - Place the binary in one of the `$PATH` directories + - Ensure it's executable (`chmod +x`) + +### Filesystem Structure +We at Taubyte prioritize convention over configuration. Hence, we've pre-defined the filesystem structure and its location as follows: +``` +/tb +├── bin +│   └── tau +├── cache +├── config +│   ├── .yaml +│   ├── .yaml +│   └── keys +│   ├── private.key +│   ├── public.pem +│   └── swarm.key +├── logs +├── plugins +└── storage +``` + +> Note: If you prefer a different location, use the --root option. + +### Configuration +Configuration files for `tau` are located at `/tb/config/shape-name.yaml`. Here's an example: + +```yaml +privatekey: CAESQJxQzCe/N/C8A5TIgrL9F0p5iG...KzYW9pygBCTJSuezIc6w/TT/unZKJ5mo= +swarmkey: keys/test_swarm.key +protocols: [patrick,substrate,tns,monkey,seer,auth] +p2p-listen: [/ip4/0.0.0.0/tcp/8100] +p2p-announce: [/ip4/127.0.0.1/tcp/8100] +ports: + main: 8100 + lite: 8102 + ipfs: 8104 +location: + lat: 120 + long: 21 +http-listen: 0.0.0.0:443 +network-url: example.com +domains: + key: + private: keys/test.key + services: ^[^.]+\.tau\.example\.com + generated: g.example.com + whitelist: + postfix: [test.com] + regex: + - '^[^.]+\.test\.example\.com' +``` + +### Running `tau` +Execute a `tau` node with: +```bash +tau start --shape shape-name +``` +For an alternative root to `/tb`: +```bash +$ tau start --shape shape-name --root path-to-root +``` + +### Systemd Configuration +To ensure that `tau` runs as a service and starts automatically upon system boot, you can set it up as a `systemd` service. + +1. Create a new service file: +```bash +$ sudo nano /etc/systemd/system/tau.service +``` + +2. Add the following content to the file: +```plaintext +[Unit] +Description=Taubyte Node Service +After=network.target + +[Service] +ExecStart=/path/to/tau/bin tau start --shape shape-name --root path-to-root +User=username +Restart=on-failure + +[Install] +WantedBy=multi-user.target +``` +Replace `/path/to/tau/bin` with the actual path to your `tau` binary and `username` with the name of the user running `tau`. + +3. Enable and start the service: +```bash +$ sudo systemctl enable tau +$ sudo systemctl start tau +``` + +To check the status: +```bash +$ sudo systemctl status tau +``` + +This ensures `tau` runs consistently, even after system reboots. + +### Setting up DNS for your network +Next, set up DNS records for your seer, generated domain, and service URLs, all with a 1-minute TTL. + +### Seer +For each host running seer, add an `A Record`. +Host: seer -> Value: 127.0.0.1 + +### Generated URL +Point your generated domain to your seers by adding a `NS Record`. +If `g.example.com` is your generated domain URL, the record would be: +Host: `g` -> Value: `seer.example.com` + +### Service URL +Add a `NS Record` which by default should be your URL prefixed with tau. +This record will also point to your seers. +For `example.com` the record will be: `tau` -> `seer.example.com` + +### Connecting to the network +It may take a few minutes for the DNS to recognize your changes. The best way to check is to perform a dig on your network's seer fqdn Like so: +```bash +$ dig a seer.tau.example.com +``` +> replace `example.com` with your respective domain. + +Then, on a client machine: + +#### tau-cli +1. Get the `tau` cli if you don't have it already. Check [github.com/taubyte/tau-cli](https://github.com/taubyte/tau-cli). +2. Run `tau login` +3. Then `tau select network` +4. Choose `Remote` then type your network's domain + +#### Web console +1. Go to [Taubyte Web Console](https://console.taubyte.com) +2. Fill in your email and select 'Custom' in the network selector +3. Enter the network's domain and hit the checkmark +4. Login \ No newline at end of file diff --git a/cli/app/app.go b/cli/app/app.go index e03b7ad3..b0f629c2 100644 --- a/cli/app/app.go +++ b/cli/app/app.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/taubyte/tau/cli/node" + "github.com/taubyte/tau/config" "github.com/urfave/cli/v2" ) @@ -36,12 +37,12 @@ func startShape() *cli.Command { Aliases: []string{"s"}, }, &cli.PathFlag{ - Name: "config", - Required: true, - Aliases: []string{"c"}, + Name: "root", + DefaultText: config.DefaultRoot, }, &cli.BoolFlag{ - Name: "dev", + Name: "dev-mode", + Aliases: []string{"dev"}, }, }, diff --git a/cli/app/parse_config.go b/cli/app/parse_config.go index 813c125b..73a3b842 100644 --- a/cli/app/parse_config.go +++ b/cli/app/parse_config.go @@ -7,6 +7,8 @@ import ( "errors" "fmt" "os" + "path" + "path/filepath" "github.com/libp2p/go-libp2p/core/pnet" "github.com/taubyte/tau/config" @@ -15,70 +17,82 @@ import ( "gopkg.in/yaml.v2" ) +// Parse from yaml func parseSourceConfig(ctx *cli.Context) (*config.Protocol, *config.Source, error) { - // Parse from yaml - if ctx.IsSet("config") { - var ( - src = new(config.Source) - protocol = new(config.Protocol) - ) - - data, err := os.ReadFile(ctx.Path("config")) - if err != nil { - return nil, nil, fmt.Errorf("reading config file path `%s` failed with: %s", ctx.Path("config"), err) - } + root := ctx.Path("root") - err = yaml.Unmarshal(data, &src) - if err != nil { - return nil, nil, fmt.Errorf("yaml unmarshal failed with: %s", err) - } + if !filepath.IsAbs(root) { + return nil, nil, fmt.Errorf("root folder `%s` is not absolute", root) + } - err = validateKeys(src.Protocols, src.Domains.Key.Private, src.Domains.Key.Public) - if err != nil { - return nil, nil, err - } + configRoot := root + "/config" + configPath := path.Join(configRoot, ctx.String("shape")+".yaml") - // Assign basics - protocol.Shape = ctx.String("shape") - protocol.P2PAnnounce = src.P2PAnnounce - protocol.P2PListen = src.P2PListen - protocol.Ports = src.Ports - protocol.Location = src.Location - protocol.NetworkUrl = src.NetworkUrl - protocol.GeneratedDomain = src.Domains.Generated - protocol.ServicesDomain = src.Domains.Services - protocol.HttpListen = src.HttpListen - protocol.PrivateKey = []byte(src.Privatekey) - protocol.Protocols = src.Protocols - protocol.Plugins = src.Plugins - protocol.Peers = src.Peers - - protocol.DevMode = ctx.Bool("dev") - - // Convert Keys - if len(src.Privatekey) > 0 { - base64Key, err := base64.StdEncoding.DecodeString(src.Privatekey) - if err != nil { - return nil, nil, fmt.Errorf("converting private key to base 64 failed with: %s", err) - } - - protocol.PrivateKey = []byte(base64Key) - } + data, err := os.ReadFile(configPath) + if err != nil { + return nil, nil, fmt.Errorf("reading config file path `%s` failed with: %s", configPath, err) + } - protocol.SwarmKey, err = parseSwarmKey(src.Swarmkey) - if err != nil { - return nil, nil, err - } + src := &config.Source{} + + err = yaml.Unmarshal(data, &src) + if err != nil { + return nil, nil, fmt.Errorf("yaml unmarshal failed with: %w", err) + } + + src.Domains.Key.Private = path.Join(configRoot, src.Domains.Key.Private) + if src.Domains.Key.Public != "" { + src.Domains.Key.Public = path.Join(configRoot, src.Domains.Key.Public) + } + src.Swarmkey = path.Join(configRoot, src.Swarmkey) + + err = validateKeys(src.Protocols, src.Domains.Key.Private, src.Domains.Key.Public) + if err != nil { + return nil, nil, err + } + + protocol := &config.Protocol{ + Root: root, + Shape: ctx.String("shape"), + P2PAnnounce: src.P2PAnnounce, + P2PListen: src.P2PListen, + Ports: src.Ports, + Location: src.Location, + NetworkUrl: src.NetworkUrl, + GeneratedDomain: src.Domains.Generated, + ServicesDomain: src.Domains.Services, + HttpListen: src.HttpListen, + PrivateKey: []byte(src.Privatekey), + Protocols: src.Protocols, + Plugins: src.Plugins, + Peers: src.Peers, + DevMode: ctx.Bool("dev-mode"), + } - protocol.DomainValidation.PrivateKey, protocol.DomainValidation.PublicKey, err = parseValidationKey(src.Domains.Key.Private, src.Domains.Key.Public) + // Convert Keys + if len(src.Privatekey) > 0 { + base64Key, err := base64.StdEncoding.DecodeString(src.Privatekey) if err != nil { - return nil, nil, err + return nil, nil, fmt.Errorf("converting private key to base 64 failed with: %s", err) } - return protocol, src, nil + protocol.PrivateKey = []byte(base64Key) + } + + protocol.SwarmKey, err = parseSwarmKey(src.Swarmkey) + if err != nil { + return nil, nil, err + } + + protocol.DomainValidation.PrivateKey, protocol.DomainValidation.PublicKey, err = parseValidationKey( + src.Domains.Key.Private, + src.Domains.Key.Public, + ) + if err != nil { + return nil, nil, err } - return nil, nil, errors.New("config path was not set") + return protocol, src, nil } func parseSwarmKey(filepath string) (pnet.PSK, error) { diff --git a/cli/app/run_test.go b/cli/app/run_test.go index 97950ba7..2e4dea11 100644 --- a/cli/app/run_test.go +++ b/cli/app/run_test.go @@ -2,10 +2,13 @@ package app import ( "context" + "log" "os" "testing" "time" + _ "embed" + cli "github.com/taubyte/tau/cli" "gotest.tools/v3/assert" ) @@ -14,6 +17,15 @@ var ( shape = "test" ) +//go:embed testConfig.yaml +var testConfig []byte + +//go:embed test_swarm.key +var testSwarmKey []byte + +//go:embed test.key +var testKey []byte + // TODO: add hoarder to config when its fixed // TODO: Build in tmp func TestStart(t *testing.T) { @@ -24,10 +36,21 @@ func TestStart(t *testing.T) { ctx, ctxC := context.WithTimeout(context.Background(), time.Second*15) defer ctxC() - err := app.RunContext(ctx, append( - os.Args[0:1], - []string{"start", "-s", "test", "-c", "testConfig.yaml", "--dev"}...), - ) - assert.NilError(t, err) + root, err := os.MkdirTemp("/tmp", "tau-test") + if err != nil { + log.Fatal(err) + } + defer os.RemoveAll(root) + + os.Mkdir(root+"/storage", 0750) + os.Mkdir(root+"/storage/test", 0750) + os.Mkdir(root+"/config", 0750) + os.Mkdir(root+"/config/keys", 0750) + os.WriteFile(root+"/config/test.yaml", testConfig, 0640) + os.WriteFile(root+"/config/keys/test_swarm.key", testSwarmKey, 0640) + os.WriteFile(root+"/config/keys/test.key", testKey, 0640) + + err = app.RunContext(ctx, []string{os.Args[0], "start", "-s", "test", "--root", root, "--dev"}) + assert.NilError(t, err) } diff --git a/cli/app/testConfig.yaml b/cli/app/testConfig.yaml index 9c5504af..8a5538ed 100644 --- a/cli/app/testConfig.yaml +++ b/cli/app/testConfig.yaml @@ -1,5 +1,5 @@ privatekey: CAESQJxQzCe/N/C8A5TIgrL9F0p5iGgBa9wIgCOkDr4De475V5NSzWX2EnMKzYW9pygBCTJSuezIc6w/TT/unZKJ5mo= -swarmkey: test_swarm.key +swarmkey: keys/test_swarm.key protocols: [patrick,substrate,tns,monkey,seer,auth] p2p-listen: [/ip4/0.0.0.0/tcp/8100] p2p-announce: [/ip4/127.0.0.1/tcp/8100] @@ -14,7 +14,7 @@ http-listen: 0.0.0.0:443 network-url: example.com domains: key: - private: test.key + private: keys/test.key services: ^[^.]+\.tau\.example\.com generated: g.example.com whitelist: diff --git a/cli/node/helpers.go b/cli/node/helpers.go index 23afdf82..0c6b3ead 100644 --- a/cli/node/helpers.go +++ b/cli/node/helpers.go @@ -16,7 +16,7 @@ import ( odo "github.com/taubyte/tau/cli" ) -func createLiteNode(ctx context.Context, conf *config.Protocol, shape, databasePath string) (peer.Node, error) { +func createLiteNode(ctx context.Context, conf *config.Protocol, shape, storagePath string) (peer.Node, error) { ma, err := multiaddr.NewMultiaddr(conf.P2PAnnounce[0]) if err != nil { return nil, fmt.Errorf("new multiaddr failed with: %s", err) @@ -44,7 +44,7 @@ func createLiteNode(ctx context.Context, conf *config.Protocol, shape, databaseP return nil, err } - node, err := peer.NewClientNode(ctx, databasePath+odo.ClientPrefix, keypair.NewRaw(), conf.SwarmKey, p2pListen, nil, true, _peer) + node, err := peer.NewClientNode(ctx, storagePath+odo.ClientPrefix, keypair.NewRaw(), conf.SwarmKey, p2pListen, nil, true, _peer) if err != nil { return nil, fmt.Errorf("creating new client node for shape `%s` failed with: %s", shape, err) } @@ -57,7 +57,7 @@ func createLiteNode(ctx context.Context, conf *config.Protocol, shape, databaseP return node, nil } -func createNodes(ctx context.Context, databasePath, shape string, conf *config.Protocol) error { +func createNodes(ctx context.Context, storagePath, shape string, conf *config.Protocol) error { var err error if len(conf.Protocols) < 1 { // For elder nodes peerInfo, err := utils.ConvertToAddrInfo(conf.Peers) @@ -65,19 +65,19 @@ func createNodes(ctx context.Context, databasePath, shape string, conf *config.P return err } - conf.Node, err = peer.NewFull(ctx, databasePath, conf.PrivateKey, conf.SwarmKey, conf.P2PListen, conf.P2PAnnounce, true, peer.BootstrapParams{Enable: true, Peers: peerInfo}) + conf.Node, err = peer.NewFull(ctx, storagePath, conf.PrivateKey, conf.SwarmKey, conf.P2PListen, conf.P2PAnnounce, true, peer.BootstrapParams{Enable: true, Peers: peerInfo}) if err != nil { return fmt.Errorf("creating new full node failed with: %s", err) } } else { // Non elder nodes - conf.Node, err = config.NewNode(ctx, conf, databasePath) + conf.Node, err = config.NewNode(ctx, conf, storagePath) if err != nil { return fmt.Errorf("creating new node for shape `%s` failed with: %s", shape, err) } // Create client node - conf.ClientNode, err = createLiteNode(ctx, conf, shape, databasePath) + conf.ClientNode, err = createLiteNode(ctx, conf, shape, storagePath) if err != nil { return fmt.Errorf("creating client node failed with: %s", err) } diff --git a/cli/node/start.go b/cli/node/start.go index 34320868..c77acc7c 100644 --- a/cli/node/start.go +++ b/cli/node/start.go @@ -32,18 +32,9 @@ func Start(ctx context.Context, protocolConfig *config.Protocol) error { ctx_cancel() }() - databasePath := config.DatabasePath + protocolConfig.Shape + storagePath := protocolConfig.Root + "/storage/" + protocolConfig.Shape - if protocolConfig.DevMode { - dir, err := os.Getwd() - if err != nil { - return err - } - protocolConfig.Root = dir - databasePath = protocolConfig.Shape - } - - err := createNodes(ctx, databasePath, protocolConfig.Shape, protocolConfig) + err := createNodes(ctx, storagePath, protocolConfig.Shape, protocolConfig) if err != nil { return err } diff --git a/clients/http/auth/e2e_test.go b/clients/http/auth/e2e_test.go index 6f7f69f9..be733774 100644 --- a/clients/http/auth/e2e_test.go +++ b/clients/http/auth/e2e_test.go @@ -10,7 +10,7 @@ import ( ) var ( - authNodeUrl = "https://auth.taubyte.com" + authNodeUrl = "https://auth.tau.sandbox.taubyte.com" testProvider = "github" testToken = testGitToken() ) diff --git a/config/protocols.go b/config/protocols.go index b1fe523c..5c24e470 100644 --- a/config/protocols.go +++ b/config/protocols.go @@ -11,11 +11,11 @@ import ( ) var ( - DatabasePath string = "/tb/storage/databases/" - DefaultP2PListenFormat string = "/ip4/0.0.0.0/tcp/%d" - DefaultHTTPListen string = "0.0.0.0:443" - DefaultCAFileName string = "/tb/priv/fullchain.pem" - DefaultKeyFileName string = "/tb/priv/privkey.pem" + DefaultRoot = "/tb" + DefaultP2PListenFormat = "/ip4/0.0.0.0/tcp/%d" + DefaultHTTPListen = "0.0.0.0:443" + DefaultCAFileName = "/tb/priv/fullchain.pem" + DefaultKeyFileName = "/tb/priv/privkey.pem" ) type Protocol struct { @@ -74,7 +74,7 @@ func (config *Protocol) Validate() error { } if config.Root == "" { - config.Root = DatabasePath + config.Root = DefaultRoot } // http diff --git a/go.mod b/go.mod index f450055b..30658152 100644 --- a/go.mod +++ b/go.mod @@ -28,9 +28,10 @@ require ( github.com/multiformats/go-varint v0.0.7 github.com/otiai10/copy v1.12.0 github.com/pkg/errors v0.9.1 - github.com/pterm/pterm v0.12.62 + github.com/pterm/pterm v0.12.65 github.com/spf13/afero v1.9.5 github.com/taubyte/builder v0.2.0 + github.com/taubyte/cli-common v0.1.1 github.com/taubyte/config-compiler v0.4.6 github.com/taubyte/domain-validation v1.0.0 github.com/taubyte/go-interfaces v0.2.12 @@ -43,7 +44,6 @@ require ( github.com/taubyte/go-specs v0.10.6 github.com/taubyte/http v0.10.4 github.com/taubyte/p2p v0.9.1 - github.com/taubyte/tau-cli v0.1.8 github.com/taubyte/utils v0.1.6 github.com/taubyte/vm v1.0.3 github.com/taubyte/vm-core-plugins v0.3.4 @@ -64,7 +64,7 @@ require ( ) require ( - atomicgo.dev/cursor v0.1.1 // indirect + atomicgo.dev/cursor v0.2.0 // indirect atomicgo.dev/keyboard v0.2.9 // indirect atomicgo.dev/schedule v0.0.2 // indirect github.com/CAFxX/httpcompression v0.0.8 // indirect @@ -101,7 +101,7 @@ require ( github.com/elastic/gosigar v0.14.2 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/ethereum/go-ethereum v1.12.0 // indirect - github.com/fatih/color v1.7.0 // indirect + github.com/fatih/color v1.14.1 // indirect github.com/flynn/noise v1.0.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect @@ -135,7 +135,7 @@ require ( github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect github.com/huin/goupnp v1.2.0 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.15 // indirect github.com/ipfs/bbloom v0.0.4 // indirect github.com/ipfs/boxo v0.8.1 // indirect github.com/ipfs/go-bitfield v1.1.0 // indirect @@ -185,7 +185,7 @@ require ( github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect diff --git a/go.sum b/go.sum index e96235a7..058b8acb 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ atomicgo.dev/assert v0.0.2 h1:FiKeMiZSgRrZsPo9qn/7vmr7mCsh5SZyXY4YGYiYwrg= -atomicgo.dev/cursor v0.1.1 h1:0t9sxQomCTRh5ug+hAMCs59x/UmC9QL6Ci5uosINKD4= -atomicgo.dev/cursor v0.1.1/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= +atomicgo.dev/cursor v0.2.0 h1:H6XN5alUJ52FZZUkI7AlJbUc1aW38GWZalpYRPpoPOw= +atomicgo.dev/cursor v0.2.0/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8= atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= atomicgo.dev/schedule v0.0.2 h1:2e/4KY6t3wokja01Cyty6qgkQM8MotJzjtqCH70oX2Q= @@ -206,8 +206,9 @@ github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHj github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -419,8 +420,8 @@ github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:q github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= @@ -619,8 +620,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -768,8 +769,8 @@ github.com/pterm/pterm v0.12.31/go.mod h1:32ZAWZVXD7ZfG0s8qqHXePte42kdz8ECtRyEej github.com/pterm/pterm v0.12.33/go.mod h1:x+h2uL+n7CP/rel9+bImHD5lF3nM9vJj80k9ybiiTTE= github.com/pterm/pterm v0.12.36/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8= github.com/pterm/pterm v0.12.40/go.mod h1:ffwPLwlbXxP+rxT0GsgDTzS3y3rmpAO1NMjUkGTYf8s= -github.com/pterm/pterm v0.12.62 h1:Xjj5Wl6UR4Il9xOiDUOZRwReRTdO75if/JdWsn9I59s= -github.com/pterm/pterm v0.12.62/go.mod h1:+c3ujjE7N5qmNx6eKAa7YVSC6m/gCorJJKhzwYTbL90= +github.com/pterm/pterm v0.12.65 h1:HNMNCh2Zi6Lk+g5b8pORrFM9Ygz10GZUUcCFUkGpK2Q= +github.com/pterm/pterm v0.12.65/go.mod h1:CpJq+fr0+xKGlPFDhKTkepte2fY3Ydr5bzSJ9di67uI= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-19 v0.3.2 h1:tFxjCFcTQzK+oMxG6Zcvp4Dq8dx4yD3dDiIiyc86Z5U= @@ -874,6 +875,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70 github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/taubyte/builder v0.2.0 h1:2L2AGG/o3bfhE/EleMFs3DCuy36ugSJY1qnvu38dZJM= github.com/taubyte/builder v0.2.0/go.mod h1:McWLSLqcH2HnovV6uzeBb4EwceMaA5y/n0xCptkZuQM= +github.com/taubyte/cli-common v0.1.1 h1:cWgk/MABhKMoeLOJ1rQXg7mqrMhjBIHZmDJv0ewl4dY= +github.com/taubyte/cli-common v0.1.1/go.mod h1:jsKlKVPrpZLhV6QyhQ5b7XdJJEpwX5oEx1C1DsN0f4Y= github.com/taubyte/config-compiler v0.4.6 h1:9s3xn955imE7gAyVFpcsBEkowhCir78b1HPWLcDAl38= github.com/taubyte/config-compiler v0.4.6/go.mod h1:gaohk1BSknIudo16QSgeQqVWVGLyusPPdLn+wQ+xAmY= github.com/taubyte/domain-validation v1.0.0 h1:yUt6y7b/3PC9aocvl7s8cBKG4ieN35zQqVQIywGUg4o= @@ -902,8 +905,6 @@ github.com/taubyte/odo v0.0.0-20230727154809-0688a5d7674b h1:2Jt0GOC/2OoSG8R+SG8 github.com/taubyte/odo v0.0.0-20230727154809-0688a5d7674b/go.mod h1:RFHdU43b3x590UQENAP6gAV3KkgiuU6ES9qoQLfqIEA= github.com/taubyte/p2p v0.9.1 h1:W8whhWbYO5oCqOSUM+gNKCERtVGmTJHTZuTw+MJuswg= github.com/taubyte/p2p v0.9.1/go.mod h1:0vWZjiX8yNT3VwZO2x+mgRdEDCbwzSPOyyfBU3UEiTk= -github.com/taubyte/tau-cli v0.1.8 h1:81VcK9ZfKoAwzjwhnxQkxXa/kjv9fyb4kUephaqcxa0= -github.com/taubyte/tau-cli v0.1.8/go.mod h1:4BC0INT2qB3RnDVooAPuc8XWu7trU4smhJ/XdhKjYkA= github.com/taubyte/utils v0.1.6 h1:bRSJZW/8E/wpT3wwyU3C97M9ddAJ52AfXFeP47JRGsY= github.com/taubyte/utils v0.1.6/go.mod h1:b/tKY1xKIxLH5ixFRTsrdz+vGhmiOcR9SpdVYiJDpsI= github.com/taubyte/vm v1.0.3 h1:Z9IYHdHiWVh0/v1+dvWblGe6Ny+ni3t4yr8GIgfhavg= @@ -1479,7 +1480,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= diff --git a/libdream/services/service.go b/libdream/services/service.go index aa833ae6..f77c6b90 100644 --- a/libdream/services/service.go +++ b/libdream/services/service.go @@ -35,6 +35,8 @@ func (u *Universe) createService(name string, config *commonIface.ServiceConfig) // Ignoring error in case of opening os.MkdirAll(config.Root, 0750) + os.Mkdir(config.Root+"/storage", 0755) + if config.Others == nil { config.Others = make(map[string]int) } diff --git a/protocols/monkey/fixtures/compile/fixture_compile_for.go b/protocols/monkey/fixtures/compile/fixture_compile_for.go index 9802f890..faabb461 100644 --- a/protocols/monkey/fixtures/compile/fixture_compile_for.go +++ b/protocols/monkey/fixtures/compile/fixture_compile_for.go @@ -6,9 +6,9 @@ import ( "path" "strings" + tauTemplates "github.com/taubyte/cli-common/singletons/templates" spec "github.com/taubyte/go-specs/common" structureSpec "github.com/taubyte/go-specs/structure" - tauTemplates "github.com/taubyte/tau-cli/singletons/templates" "github.com/taubyte/tau/libdream/common" dreamlandRegistry "github.com/taubyte/tau/libdream/registry" ) diff --git a/protocols/seer/db_helpers.go b/protocols/seer/db_helpers.go index d33e3aa1..405cd4a3 100644 --- a/protocols/seer/db_helpers.go +++ b/protocols/seer/db_helpers.go @@ -115,7 +115,7 @@ func (h *dnsHandler) getNodeIp() ([]string, error) { func initializeDB(srv *Service, config *config.Protocol) error { var file *os.File var err error - dbPath := path.Join(config.Root, srv.shape, NodeDatabaseFileName) + dbPath := path.Join(config.Root, "storage", srv.shape, NodeDatabaseFileName) // Create SQLite DB file, err = os.Open(dbPath) if err != nil { diff --git a/protocols/seer/sql.go b/protocols/seer/sql.go index fbf26ef5..c313efe8 100644 --- a/protocols/seer/sql.go +++ b/protocols/seer/sql.go @@ -3,7 +3,7 @@ package seer import "time" var ( - NodeDatabaseFileName string = "node-database.db" + NodeDatabaseFileName string = "seer-node-database.db" IPKey = "IP" DefaultBlockTime = 60 * time.Second ValidServiceResponseTime = 5 * time.Minute