Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #679 from textileio/sander/update-readme
Browse files Browse the repository at this point in the history
readme: remove quick start (-> docs), go mod updates
  • Loading branch information
sanderpick committed Apr 15, 2019
2 parents ecd943f + 70fea29 commit 1a80cf3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 190 deletions.
206 changes: 24 additions & 182 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@

[![Throughput Graph](https://graphs.waffle.io/textileio/go-textile/throughput.svg)](https://waffle.io/textileio/go-textile/metrics/throughput)

This repository contains the core Textile node and daemon, a command-line client, and a mobile client for building an iOS/Android application.
This repository contains a the core Textile daemon + command-line client, as well as bindings for mobile (iOS/Android) applications.

See [textile-mobile](https://github.com/textileio/textile-mobile/) for the [Textile Photos](https://www.textile.photos) iOS/Android app.

## What is Textile?

[Textile](https://www.textile.io) provides encrypted, recoverable, schema-based, and cross-application data storage built on [IPFS](https://github.com/ipfs) and [libp2p](https://github.com/libp2p). We like to think of it as a decentralized data wallet with built-in protocols for sharing and recovery, or more simply, **an open and programmable iCloud**.

**Please see the [Wiki](https://github.com/textileio/go-textile/wiki) for more**.
**Please see the [docs](https://docs.textile.io/) for more**.

## Install

Download the [latest release](https://github.com/textileio/go-textile/releases/latest) for your OS or jump to [Docker](https://github.com/textileio/go-textile#docker). You can also install the Textile [desktop tray app](https://github.com/textileio/go-textile/releases/latest) to run local web/desktop apps that leverage Textile tools.

## Usage

Check out the [docs site](https://docs.textile.io/) for more detailed usage instructions and tutorials.

~ $ textile --help
Usage:
textile [OPTIONS] <command>
Expand Down Expand Up @@ -61,222 +63,62 @@ Download the [latest release](https://github.com/textileio/go-textile/releases/l
version Print version and exit
wallet Manage or create an account wallet

## Quick-start

#### Initialize a new wallet

$ textile wallet init

This will generate a mnemonic phrase for accessing/recovering derived accounts. You may specify a word count and password as well (run with `--help` for usage).

#### Initialize a peer with an account

Next, use an account seed from your wallet to initialize a new peer. First time users should just use the first account’s (Account 0) seed, which is printed out by the `wallet init` sub-command. The private seed begins with “S”. The public address begins with “P”. Use the `accounts` sub-command to access deeper derived wallet accounts.

$ textile init -s <account_seed>

#### Start the daemon

$ textile daemon

You can now use the command-line client to interact with your running peer.

## Adding Files

Files are tracked by threads. So, let’s start there.

#### Create a new thread

$ textile threads add "hello world" --media

This will create and join a thread backed by the built-in media schema. Use the `--help` flag on any sub-command for more options and info.

#### Add a file

$ textile files add <image path> --caption "beautiful"

The thread schema encodes the image at various width and extracts exif data. The resulting files are added to the thread under one directory. You also add an entire directory.

$ textile files add <dir path> --caption "more beauty"

#### Browse a thread feed

The command-line client is not really meant to provide a great UX for browsing thread content. However, you can easily paginate the feed with `ls`.

$ textile ls --thread <thread ID>

#### Comment on a file

$ textile comments add "good eye" --block <block ID>

#### Like a file

$ textile likes add --block <block ID>

## Sharing files / chatting

In order to start sharing or chatting with someone else, you’ll first need an open and shared thread. An `open` threads allows other to read and write, while `shared` means anyone can join via an invite. See `textile threads --help` for much more about threads, access control types, and share settings.

$ textile threads add "dog photos" --media --type=open --sharing=shared

There are two types of invites: direct peer-to-peer and external.

- Peer-to-peer invites are encrypted with the invitee's public key.
- External invites are encrypted with a single-use key and are useful for on-boarding new users.

#### Create a direct peer-to-peer thread invite

$ textile invites create --thread <thread ID> --peer <peer ID>

The receiving peer will be notified of the invite. They can list all pending direct invites.

$ textile invites ls

The result is something like:

[
{
"id": "QmUv8783yptknBHCSSnscWNLZdz5K8uhpHZYaWnPkMxu4i",
"name": "dog photos",
"inviter": "fido",
"date": "2018-12-07T13:02:57-08:00"
}
]

#### Accept a direct peer-to-peer invite

$ textile invites accept QmUv8783yptknBHCSSnscWNLZdz5K8uhpHZYaWnPkMxu4i

#### Create an “external” thread invite

This is done by simply omitting the `--peer` flag with the `invites create` command.

$ textile invites create --thread <thread ID>

The result is something like:

{
"invite": "QmcDmpmBr6qB5QGvsUaTZZtwpGpevGgiSEa7C3AJE9EZiU",
"key": "aKrQmYCMiCQvkyjnm4sFhxdZaFH8g9h7EaLxdBGsZCVjsoyMPzQJQUyPrn7G"
}

Your friend can use the resulting address and key to accept the invite and join the thread.

$ textile invites accept QmcDmpmBr6qB5QGvsUaTZZtwpGpevGgiSEa7C3AJE9EZiU --key aKrQmYCMiCQvkyjnm4sFhxdZaFH8g9h7EaLxdBGsZCVjsoyMPzQJQUyPrn7G

At this point, both of you can add and receive files via this thread. You can also exchange text messages (chat).

#### Add a text message to a thread

$ textile messages add "nice photos" --thread <thread ID>

#### Start a chat in a thread

$ textile chat --thread <thread ID>

This will start an interactive chat session with other thread peers.

## Docker

See available tags [here](https://hub.docker.com/r/textile/go-textile/tags).

#### Run a Textile node

$ docker run -it --name textile-node \
-p 4001:4001 -p 8081:8081 -p 5050:5050 -p 127.0.0.1:40600:40600 \
textile/go-textile:latest

#### Run a Textile node as a _cafe_

$ docker run -it --name textile-cafe-node \
-p 4001:4001 -p 8081:8081 -p 5050:5050 -p 127.0.0.1:40600:40600 -p 40601:40601 \
-e CAFE_HOST_URL=<public_URL> -e CAFE_HOST_PUBLIC_IP=<public_IP> \
textile/go-textile:latest-cafe

A cafe node can issue client sessions (JWTs) to other nodes. In order to issue valid sessions, the cafe must know its public IP address and the machine's public facing URL. The `CAFE_HOST_PUBLIC_IP` and `CAFE_HOST_URL` environment variable values are written to the textile config file. Read more about cafe host config settings [here](https://github.com/textileio/go-textile/wiki/Config-File#cafe).

## Contributing

#### Go get the source code

$ go get github.com/textileio/go-textile

You can ignore the `gx` package errors. You'll need two package managers to get setup…

#### Install the golang package manager, `dep`
**Go >= 1.12 is required.**

MacOS:
git clone git@github.com:textileio/go-textile.git

$ brew install dep

Debian:

$ sudo apt-get install go-dep

#### Install the IPFS package manager, `gx`

$ go get -u github.com/whyrusleeping/gx
$ go get -u github.com/whyrusleeping/gx-go
#### Run the tests

#### Install the dependencies managed by `dep` and `gx`
make test

$ cd $GOPATH/src/github.com/textileio/go-textile
$ make setup
## Building

#### Run the tests
There are various things to build… first off run setup:

$ make test
make setup

## Building
If you plan on building the bindings fro iOS or Android, install and init the `gomobile` tools:

There are various things to build…
go get golang.org/x/mobile/cmd/gomobile
gomobile init

#### CLI/daemon

$ make build
make build

#### iOS Framework

$ go get golang.org/x/mobile/cmd/gomobile
$ gomobile init
$ make ios
make ios

#### Android Framework

$ go get golang.org/x/mobile/cmd/gomobile
$ gomobile init
$ make android
make android

#### Docs

$ make docs
make docs

#### Tray app

The build is made by a vendored version of `go-astilectron-bundler`. Due to Go's painful package management, you'll want to delete any `go-astilectron`-related binaries and source code you have installed from `github.com/asticode` in your `$GOPATH`. Then you can install the vendored `go-astilectron-bundler`:

```
go install ./vendor/github.com/asticode/go-astilectron-bundler/astilectron-bundler
```
go install ./vendor/github.com/asticode/go-astilectron-bundler/astilectron-bundler

Change into the `tray` folder and build the app:

```
cd tray
astilectron-bundler -v
```
cd tray
astilectron-bundler -v

Double-click the built app in `tray/output/{darwin,linux,windows}-amd64`, or run it directly:

```
go run *.go
```

go run *.go

You can also build the architecture-specific versions with:

```
astilectron-bundler -v -c bundler.{darwin,linux,windows}.json
```
astilectron-bundler -v -c bundler.{darwin,linux,windows}.json

##### Linux

Expand Down
2 changes: 1 addition & 1 deletion common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package common
var GitCommit, GitBranch, GitState, GitSummary, BuildDate string

// Version is the current application's version literal
const Version = "0.1.12"
const Version = "0.1.12-rc1"
3 changes: 2 additions & 1 deletion core/api_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ func (a *api) toDots(blocks *pb.BlockList) (string, error) {
for _, p := range b.Parents {
pp, err := a.node.Block(p)
if err != nil {
return "", err
log.Errorf("error getting block %s: %s", p, err)
continue
}

dots += "\n " + dot + " -> " + toDot(pp) + ";"
Expand Down
3 changes: 2 additions & 1 deletion core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ func applyServerConfigOption(rep repo.Repo, isServer bool) error {
if err := config.UpdateIpfs(rep, "Swarm.AddrFilters", config.DefaultServerFilters); err != nil {
return err
}
if err := config.UpdateIpfs(rep, "Swarm.EnableRelayHop", true); err != nil {
// tmp disable relay
if err := config.UpdateIpfs(rep, "Swarm.EnableRelayHop", false); err != nil {
return err
}
if err := config.UpdateIpfs(rep, "Discovery.MDNS.Enabled", false); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func InitRepo(conf InitConfig) error {
}

// init repo
if err := repo.Init(conf.RepoPath); err != nil {
if err := repo.Init(conf.RepoPath, conf.IsMobile); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions repo/config/init_ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ This is a problem with the Textile codebase. Please report it to the dev team.`,
}

// InitIpfs create the IPFS config file
func InitIpfs(identity native.Identity) (*native.Config, error) {
func InitIpfs(identity native.Identity, mobile bool) (*native.Config, error) {
ipfsPeers, err := native.DefaultBootstrapPeers()
if err != nil {
return nil, err
Expand Down Expand Up @@ -120,7 +120,7 @@ func InitIpfs(identity native.Identity) (*native.Config, error) {
GracePeriod: DefaultConnMgrGracePeriod.String(),
Type: "basic",
},
DisableBandwidthMetrics: true,
DisableBandwidthMetrics: mobile,
},
Experimental: native.Experiments{
FilestoreEnabled: false,
Expand Down
4 changes: 2 additions & 2 deletions repo/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var ErrRepoCorrupted = errors.New("repo is corrupted")

const Repover = "13"

func Init(repoPath string) error {
func Init(repoPath string, mobile bool) error {
if err := checkWriteable(repoPath); err != nil {
return err
}
Expand All @@ -49,7 +49,7 @@ func Init(repoPath string) error {
}

// initialize ipfs config
conf, err := config.InitIpfs(peerIdentity)
conf, err := config.InitIpfs(peerIdentity, mobile)
if err != nil {
return err
}
Expand Down

0 comments on commit 1a80cf3

Please sign in to comment.