diff --git a/README.md b/README.md index c51abc4..89852c1 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Factom Open API is a lightweight REST API for the Factom blockchain. It connects ## Installation guides - 🐳 Install with Docker -- 🛠 Install with binaries (guide under development) +- 🛠 Install with binaries ## Clients @@ -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 (`/.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. diff --git a/api/api.go b/api/api.go index 4af2ed0..40895e1 100755 --- a/api/api.go +++ b/api/api.go @@ -58,7 +58,7 @@ type SuccessResponsePagination struct { } const ( - Version = "1.0.0-rc2" + Version = "1.0.0" DefaultPaginationStart = 0 DefaultPaginationLimit = 30 DefaultSort = "desc" diff --git a/guides/INSTALL_BINARY.md b/guides/INSTALL_BINARY.md new file mode 100644 index 0000000..2b59464 --- /dev/null +++ b/guides/INSTALL_BINARY.md @@ -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.
+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.
+By default Open API is connected to Factom Open Node, 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.
+ +### 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 `/.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 +``` \ No newline at end of file diff --git a/guides/INSTALL_DOCKER.md b/guides/INSTALL_DOCKER.md index 4d20466..eb0dbc3 100644 --- a/guides/INSTALL_DOCKER.md +++ b/guides/INSTALL_DOCKER.md @@ -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`.