Skip to content

Commit

Permalink
VERSION 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ilzheev committed Apr 25, 2019
1 parent b6177ba commit 2af59d9
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 5 deletions.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Factom Open API is a lightweight REST API for the Factom blockchain. It connects
## Installation guides

- 🐳 <a href="https://github.com/DeFacto-Team/Factom-Open-API/blob/master/guides/INSTALL_DOCKER.md">Install with Docker</a>
- 🛠 Install with binaries (guide under development)
- 🛠 <a href="https://github.com/DeFacto-Team/Factom-Open-API/blob/master/guides/INSTALL_BINARY.md">Install with binaries</a>

## Clients

Expand Down Expand Up @@ -108,5 +108,46 @@ docker exec -ti factom-open-api ./user -c=/home/app/values/config.yaml ls
docker exec -ti factom-open-api ./user -c=/home/app/values/config.yaml help
```

### You run Factom Open API as binaries

*By default `user` binary uses the same config as Open API binary (`<USER_FOLDER>/.foa/config.yaml`). If you use custom location for config file, please don't forget to provide it with `-c` flag in addition to all commands below.*

Go to the directory with `user` binary and run it via terminal:

```bash
./user create anton
```

You will see an access key in the terminal.
By default, new users **are enabled** and **have no write limit**.

You can manage users with additional binary commands:

```bash
# create user `anton` and generate API access key
./user create anton

# disable access to API for user `anton`
./user disable anton

# enable access to API for user `anton`
./user enable anton

# delete user `anton`
./user delete anton

# rotate API access key for user `anton`
./user rotate-key anton

# set writes limit for user `anton` to `1000` // 0 for unlimited
./user set-limit anton 1000

# show users, API keys & params
./user ls

# show help
./user help
```

## License
Factom Open API is released under the MIT License.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type SuccessResponsePagination struct {
}

const (
Version = "1.0.0-rc2"
Version = "1.0.0"
DefaultPaginationStart = 0
DefaultPaginationLimit = 30
DefaultSort = "desc"
Expand Down
49 changes: 49 additions & 0 deletions guides/INSTALL_BINARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Installation guide for 🛠 binaries
Factom Open API consists of API binary, user management binary & config file.

## Step 1: Prepare a database
Postgres database is required for Factom Open API.
You can connect to any internal/external Postgres DB by filling the config file.
Please prepare DB connection credentials for the next step.

## Step 2: Prepare configuration file

### Download config template
Create any folder (e.g. ~/.foa) for config and download config template into it
```bash
mkdir ~/.foa
curl -o ~/.foa/config.yaml https://raw.githubusercontent.com/DeFacto-Team/Factom-Open-API/master/config.yaml.EXAMPLE
```

### Introduction to config
There are few sections into config file:
* `api` (API params)
* `store` (DB params)
* `factom` (Factom params)

You may use custom config params: uncomment the line and put your value to override the default value.

#### API params
By default Open API uses HTTP port 8081.<br />
Log levels: `3` — Warn, `4` — Info, `5` – Debug, `6` – Debug+DB

#### DB params
If you use Postgres DB into `foa-db` container, then use the default config.
Otherwise, specify connection to your internal/external Postgres DB.

#### Factom params
❗️ You need to fill `factom`.`esaddress` in order to use Factom Open API.<br />
By default Open API is connected to <a href="https://factomd.net" target="_blank">Factom Open Node</a>, that means you don't need to setup your own node on the Factom blockchain to work with blockchain. But if you want to use your own node, you may specify it into the config.<br />

### Fill the config
```bash
nano ~/.foa/config.yaml
```

## Step 3: Download and install Factom Open API binaries

*By default all binaries uses the config located at `<USER_FOLDER>/.foa/config.yaml`. If you use custom location for config file, please don't forget to provide it with `-c` flag while running binaries.*
```bash
./foa -c=/somewhere/placed/config.yaml
```
6 changes: 3 additions & 3 deletions guides/INSTALL_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ nano ~/.foa/config.yaml
## Step 3: Run Open API container
If you use Postgres DB as Docker container, use the following command with `--link` flag:
```bash
docker run -d -p 8081:8081 --name factom-open-api --link foa-db -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0-rc2
docker run -d -p 8081:8081 --name factom-open-api --link foa-db -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0
```

If you do not use Postgres DB as Docker container, use the following command without `--link` flag:
```bash
docker run -d -p 8081:8081 --name factom-open-api -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0-rc2
docker run -d -p 8081:8081 --name factom-open-api -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0
```

1. If you changed API HTTP port into config, don't forget to edit `-p 8081:8081`.
2. Check the path to config file and edit it, if you use another path, than suggested in this guide (i.e. not `~/.foa`)
3. Don't use `latest` tag for docker image, it's better to install specific releases. Latest release: `1.0.0-rc2`.
3. Don't use `latest` tag for docker image, it's better to install specific releases. Latest release: `1.0.0`.

0 comments on commit 2af59d9

Please sign in to comment.