Skip to content

Commit

Permalink
docs: third party login
Browse files Browse the repository at this point in the history
  • Loading branch information
Clem-Fern committed Mar 10, 2024
1 parent 5727636 commit fd188ef
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 124 deletions.
159 changes: 35 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,43 @@ Run your own instance with docker compose.

### Prerequisites

* Linux (AMD64/x86_64) with docker engine.
* Linux (AMD64/x86_64/Arm64) with docker engine.
* Arm64 -> 0.4.0 and later [#14](https://github.com/Clem-Fern/rtabby-web-api/issues/14)

### Installation

* Using rtabby-web-api image from Github Docker Repository **(recommended)**
Create a directory which will contain your `docker-compose.yml` and `config` volume.
```sh
mkdir -p rtabby-web-api/config
cd rtabby-web-api
```

rtabby-web-api store tabby's configuration in a database. You can choose between mysql or sqlite database. Third-party login will also be stored in database.

* Mysql
```sh
mkdir -p rtabby-web-api/config
cd rtabby-web-api
# pwd /../../rtabby-web-api
wget https://raw.githubusercontent.com/Clem-Fern/rtabby-web-api/master/docker-compose.yml
```

* From source
* Sqlite
```sh
git clone https://github.com/Clem-Fern/rtabby-web-api
cd rtabby-web-api
```

Edit `docker-compose.yml` to use local context build instead of the published image
```yaml
# Uncomment build line
build: .
# Comment image
#image: ghcr.io/clem-fern/rtabby-web-api
# pwd /../../rtabby-web-api
wget https://raw.githubusercontent.com/Clem-Fern/rtabby-web-api/master/docker-compose-sqlite.yml -O docker-compose.yml
```


### Configuration

1. Create `config` directory. It will be used to store your config and certificate(not mandatory)

```sh
# pwd
# ./rtabby-web-api
# pwd /../../rtabby-web-api
mkdir config
# Only from source installation and optional
# users.yml file will be created at first start
# cp users.exemple.yml config/users.yml
touch config/users.yml
# otherwise users.yml file will be created at first start
```

2. Add some user into `users.yml`.
2. Tabby uses a token to authenticate user. You have to create your own user with his token in `users.yml` to be able to use the sync service.

```yaml
users:
Expand All @@ -76,102 +72,31 @@ Run your own instance with docker compose.
```
Token must be a valid and unique uuid v4. You can create one [here](https://www.uuidgenerator.net/version4).

3. (Optional) SSL/TLS
rTabby supports OAuth2 providers like Github, Gitlab, Google or Microsoft. You can enable them by adding OAuth client and secret through env var in your `docker-compose.yml`.

Place your key and certificate into `config` directory. Then add the following lines in `docker-compose.yml` :
```yaml
ports:
- "8080:8080"
environment:
- DATABASE_URL=mysql://tabby:tabby@db/tabby
- SSL_CERTIFICATE=cert.pem
- SSL_CERTIFICATE_KEY=cert.key
volumes:
- ./config:/config
```
```yml
environment:
- DATABASE_URL=mysql://tabby:tabby@db/tabby
#- GITHUB_APP_CLIENT_ID=
#- GITHUB_APP_CLIENT_SECRET=
#- GITLAB_APP_CLIENT_ID=
#- GITLAB_APP_CLIENT_SECRET=
#- GOOGLE_APP_CLIENT_ID=
#- GOOGLE_APP_CLIENT_SECRET=
#- MICROSOFT_APP_CLIENT_ID=
#- MICROSOFT_APP_CLIENT_SECRET=
```

4. Miscellaneous

rtabby-web-api get his configurations from env vars. Available tweaks :

| ENV VAR | DESCRIPTION | EXAMPLE | DEFAULT |
|---------|-------------|---------|---------|
|DATABASE_URL|Url to database|sqlite:///config/db.sqlite|-|
|CONFIG_FILE|Url to configuration file (Optional)|my_config.yml|users.yml|
|BIND_ADDR|Address listening on (Optional)|0.0.0.0|0.0.0.0|
|BIND_PORT|Port listening on (Optional)|8989|8080|
|SSL_CERTIFICATE|Server certificate (Optional)|cert.pem|None|
|SSL_CERTIFICATE_KEY|Server certificate private key(Optional)|private.key|None|
|CLEANUP_USERS|Delete configurations own by unknown user (Be careful)(Optional)|true|false|


## Getting Started (Sqlite)

Run your own instance with docker compose using only one container with Sqlite.

### Prerequisites

* Linux (AMD64/x86_64) with docker engine.

### Installation

* Using rtabby-web-api image from Github Docker Repository **(recommended)**
```sh
mkdir -p rtabby-web-api/config
cd rtabby-web-api
wget https://raw.githubusercontent.com/Clem-Fern/rtabby-web-api/master/docker-compose-sqlite.yml
```

* From source
```sh
git clone https://github.com/Clem-Fern/rtabby-web-api
cd rtabby-web-api
```

Edit `docker-compose-sqlite.yml` to use local context build instead of the published image
```yaml
# Uncomment build line
build:
context: .
dockerfile: Dockerfile-sqlite
# Comment image
#image: ghcr.io/clem-fern/rtabby-web-api:sqlite
```


### Configuration

1. Create `config` directory. It will be used to store your config and certificate(not mandatory)

```sh
# pwd
# ./rtabby-web-api
mkdir config
# Only from source installation and optional
# users.yml file will be created at first start
# cp users.exemple.yml config/users.yml
```

2. Add some user into `users.yml`.

```yaml
users:
#...
- name: 'You'
token: 'token'
#...
```
Token must be a valid and unique uuid v4. You can create one [here](https://www.uuidgenerator.net/version4).
Browse to `http://<rtabby instance>/login` to authenticate and create your user and token.

3. (Optional) SSL/TLS

Place your key and certificate into `config` directory. Then add the following lines in `docker-compose-sqlite.yml` :
Place your key and certificate into `config` directory. Then add the following lines in `docker-compose.yml` :
```yaml
ports:
- "8080:8080"
environment:
- DATABASE_URL=sqlite:///config/db.sqlite
- DATABASE_URL=mysql://tabby:tabby@db/tabby
- SSL_CERTIFICATE=cert.pem
- SSL_CERTIFICATE_KEY=cert.key
volumes:
Expand All @@ -194,8 +119,6 @@ Run your own instance with docker compose using only one container with Sqlite.

## Usage

* Go to [Usage (Sqlite)](https://github.com/Clem-Fern/rtabby-web-api#usage-sqlite) to run rtabby-web-api using only one container with Sqlite.

* To deploy
```sh
docker compose up -d
Expand All @@ -206,18 +129,6 @@ Run your own instance with docker compose using only one container with Sqlite.
docker compose down
```

## Usage (Sqlite)

* To deploy
```sh
docker compose -f docker-compose-sqlite.yml up -d
```

* To shut down your deployment:
```sh
docker compose -f docker-compose-sqlite.yml down
```

## Contributing

Build dependencies:
Expand Down
8 changes: 8 additions & 0 deletions docker-compose-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ services:
- "8080:8080"
environment:
- DATABASE_URL=sqlite:///config/db.sqlite
#- GITHUB_APP_CLIENT_ID=
#- GITHUB_APP_CLIENT_SECRET=
#- GITLAB_APP_CLIENT_ID=
#- GITLAB_APP_CLIENT_SECRET=
#- GOOGLE_APP_CLIENT_ID=
#- GOOGLE_APP_CLIENT_SECRET=
#- MICROSOFT_APP_CLIENT_ID=
#- MICROSOFT_APP_CLIENT_SECRET=
volumes:
- ./config:/config
networks:
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ services:
- "8080:8080"
environment:
- DATABASE_URL=mysql://tabby:tabby@db/tabby
#- GITHUB_APP_CLIENT_ID=
#- GITHUB_APP_CLIENT_SECRET=
#- GITLAB_APP_CLIENT_ID=
#- GITLAB_APP_CLIENT_SECRET=
#- GOOGLE_APP_CLIENT_ID=
#- GOOGLE_APP_CLIENT_SECRET=
#- MICROSOFT_APP_CLIENT_ID=
#- MICROSOFT_APP_CLIENT_SECRET=

volumes:
- ./config:/config
networks:
Expand Down

0 comments on commit fd188ef

Please sign in to comment.