Skip to content

Commit

Permalink
feat: v1 (#68)
Browse files Browse the repository at this point in the history
* feat: updated client sdk sections

* feat: updated deployment guide
  • Loading branch information
tada5hi committed Jan 5, 2024
1 parent d6d2d26 commit bbfb01f
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 180 deletions.
25 changes: 13 additions & 12 deletions src/.vitepress/config.js → src/.vitepress/config.mjs
@@ -1,4 +1,5 @@
export default {
import { defineConfig } from 'vitepress'
export default defineConfig({
title: 'Authup',
base: '/',
themeConfig: {
Expand Down Expand Up @@ -81,17 +82,17 @@ export default {
items: [
{text: 'Introduction', link: '/guide/deployment/configuration'},
{
text: 'API',
link: '/guide/deployment/configuration-api',
text: 'server:core',
link: '/guide/deployment/configuration-server-core',
items: [
{ text: 'General', link: '/guide/deployment/configuration-api' },
{ text: 'Database', link: '/guide/deployment/configuration-api-database' },
{ text: 'Redis', link: '/guide/deployment/configuration-api-redis' },
{ text: 'SMTP', link: '/guide/deployment/configuration-api-smtp' },
{ text: 'Vault', link: '/guide/deployment/configuration-api-vault' }
{ text: 'General', link: '/guide/deployment/configuration-server-core' },
{ text: 'Database', link: '/guide/deployment/configuration-server-core-database' },
{ text: 'Redis', link: '/guide/deployment/configuration-server-core-redis' },
{ text: 'SMTP', link: '/guide/deployment/configuration-server-core-smtp' },
{ text: 'Vault', link: '/guide/deployment/configuration-server-core-vault' }
]
},
{text: 'UI', link: '/guide/deployment/configuration-ui'}
{text: 'client:web', link: '/guide/deployment/configuration-client-web'}
]
},
{
Expand Down Expand Up @@ -145,9 +146,9 @@ export default {
text: 'Vue',
items: [
{ text: 'Introduction', link: '/guide/development/javascript-client-vue/' },
{ text: 'Entities', link: '/guide/development/javascript-client-vue/entities'},
{ text: 'Records', link: '/guide/development/javascript-client-vue/records'},
{ text: 'Forms', link: '/guide/development/javascript-client-vue/forms'},
{ text: 'Lists', link: '/guide/development/javascript-client-vue/lists'},
{ text: 'Collections', link: '/guide/development/javascript-client-vue/collections'},
]
}
]
Expand Down Expand Up @@ -182,4 +183,4 @@ export default {
],
}
}
}
})
5 changes: 2 additions & 3 deletions src/guide/deployment/bare-metal.md
Expand Up @@ -81,6 +81,5 @@ i Server: Started http server.
Now all should be set up, and you are ready to go :tada:

This will lunch the following application with default settings:
- UI: `http://127.0.0.1:3000/`
- API: `http://127.0.0.1:3001/`
- Docs: `http://127.0.0.1:3001/docs`
- Frontend (client/web): `http://127.0.0.1:3000/`
- Backend (server/core): `http://127.0.0.1:3001/`
@@ -1,13 +1,13 @@
# Configuration

The UI configuration can be provided in different file formats,
such as `authup.ui.{conf,js,ts,...}`.
such as `authup.client.web.{conf,js,ts,...}`.

The environment variables in the .env file variant can also be provided via runtime environment.

::: code-group

```typescript [authup.api.ts]
```typescript [authup.client.web.ts]

export default {
/**
Expand All @@ -29,15 +29,15 @@ export default {
}
```

```dotenv [authup.ui.conf]
```dotenv [authup.client.web.conf]
env=production
port=3000
apiUrl=http://localhost:3001
publicUrl=http://localhost:3000
```

````dotenv [authup.ui.conf]
````dotenv [.env]
NODE_ENV=production
PORT=3000
API_URL=http://localhost:3001
Expand Down
Expand Up @@ -9,7 +9,7 @@ superior performance, scalability and advanced features such as built-in replica
The environment variables in the .env file variant can also be provided via runtime environment.
::: code-group

```typescript{4-11} [authup.api.ts]
```typescript{3-10} [authup.server.core.ts]
export default {
// ...
Expand All @@ -25,7 +25,7 @@ export default {
}
```

```dotenv [authup.api.conf]
```dotenv [authup.server.core.conf]
db.type=mysql
db.host=127.0.0.1
db.port=3306
Expand All @@ -50,7 +50,7 @@ The environment variables in the .env file variant can also be provided via runt

::: code-group

```typescript{4-11} [authup.api.ts]
```typescript{3-10} [authup.server.core.ts]
export default {
// ...
Expand All @@ -66,7 +66,7 @@ export default {
}
```

```dotenv [authup.api.conf]
```dotenv [authup.server.core.conf]
db.type=postgres
db.host=127.0.0.1
db.port=5432
Expand Down
Expand Up @@ -7,7 +7,7 @@ The environment variables in the .env file variant can also be provided via runt

::: code-group

```typescript{4-7} [authup.api.ts]
```typescript{3-7} [authup.server.core.ts]
export default {
// ...
Expand All @@ -19,7 +19,7 @@ export default {
}
```

```dotenv [authup.api.conf]
```dotenv [authup.server.core.conf]
redis=redis://127.0.0.1
```

Expand Down
Expand Up @@ -15,7 +15,7 @@ The environment variables in the .env file variant can also be provided via runt

::: code-group

```typescript{4-19} [authup.api.ts]
```typescript{3-18} [authup.server.core.ts]
export default {
// ...
Expand All @@ -39,7 +39,7 @@ export default {
}
```

```dotenv [authup.api.conf]
```dotenv [authup.server.core.conf]
smtp.host=127.0.0.1
smtp.port=25
smtp.user=
Expand Down
Expand Up @@ -13,7 +13,7 @@ The environment variables in the .env file variant can also be provided via runt

::: code-group

```typescript{4-7} [authup.api.ts]
```typescript{4-7} [authup.server.core.ts]
export default {
// ...
Expand All @@ -25,7 +25,7 @@ export default {
}
```

```dotenv [authup.api.conf]
```dotenv [authup.server.core.conf]
vault=start123@http://127.0.0.1:8090/v1/
```

Expand Down
Expand Up @@ -7,7 +7,7 @@ The environment variables in the .env file variant can also be provided via runt

::: code-group

```typescript [authup.api.ts]
```typescript [authup.server.core.ts]

export default {
/**
Expand Down Expand Up @@ -70,7 +70,7 @@ export default {
}
```

```dotenv [authup.api.conf]
```dotenv [authup.server.core.conf]
port=3001
publicUrl=http://localhost:3001
authorizeRedirectUrl=http://localhost:3000
Expand Down
4 changes: 2 additions & 2 deletions src/guide/deployment/configuration.md
Expand Up @@ -10,5 +10,5 @@ Due to the fact that authup consists of several components, they can be configur

## Component-Wise

- [API](./configuration-api.md) This page describes the configuration of the API service.
- [UI](./configuration-ui.md) This page describes the configuration of the UI service.
- [server/core](./configuration-server-core) This page describes the configuration of the main backend service.
- [client/web](./configuration-client-web) This page describes the configuration of the main frontend service.
86 changes: 39 additions & 47 deletions src/guide/deployment/docker-compose.md
Expand Up @@ -19,8 +19,8 @@ This section contains multiple examples for how to deploy and configure authup u
examples show how to configure authup using the options described in the [configuration](./configuration) section. Simply
paste and modify the example you want to use into a `docker-compose.yml` file.

The following example shows a sensible default configuration for getting started with Authup. This will start the REST API as well as the UI from
the same container and forward them to the ports `3001` and `3000` respectively on the local machine.
The following example shows a sensible default configuration for getting started with Authup.
This will start the server- & client-services.

```yaml
version: '3.8'
Expand All @@ -29,20 +29,31 @@ volumes:
authup:

services:
authup:
server-core:
image: ghcr.io/authup/authup:latest
container_name: authup
container_name: server-core
restart: unless-stopped
volumes:
# Docker managed volume
- authup:/usr/src/writable
# storage in mounted volume
#- ./writable:/usr/src/writable
ports:
- "3000:3000"
- "3001:3001"
command: cli start

- "3001:3000"
command: server/core start

client-web:
image: ghcr.io/authup/authup:latest
container_name: client-web
restart: unless-stopped
volumes:
# Docker managed volume
- authup:/usr/src/writable
# storage in mounted volume
#- ./writable:/usr/src/writable
ports:
- "3000:3000"
command: client/web start
```

Then start the service using the following command:
Expand All @@ -62,19 +73,10 @@ docker compose logs -f
The following examples show different ways to configure and use the Authup service using docker-compose. For more general
information about how to configure Authup, see the [configuration](./configuration) section.

::: warning **Warning**
When starting more than one service from the same container (such as in the quick start example) you can not use
environment variable to configure the services. This is because of potential conflicts between the different services.

Instead, you should use a mounted configuration file to configure the services. See the [configuration file](#configuration-file)
section for more information.
:::


### Environment variables

The following example shows how to configure the Authup service using environment variables. This will start only the
REST API and forward it to the port `3000` on the local machine.
main backend service and forward it to the port `3001` on the local machine.

```yaml
version: '3.8'
Expand All @@ -90,62 +92,52 @@ services:
volumes:
- authup:/usr/src/writable
ports:
- "3000:3000"
- "3001:3000"
environment:
- ADMIN_USERNAME=test
- ADMIN_PASSWORD=test-password
command: server/core start
```


### Configuration file

This example shows how to start both services from the same container with the API being configured with non-default
This example shows how to start both services from the same container with the main backend service being configured with non-default
values via a mounted configuration file.

Create a directory `writable` in the same directory as the `docker-compose.yml` file.
```bash
mkdir writable
cd writable
```
Then create a file called `authup.api.conf` and store it in the `writable` directory. Paste the following content into
Create a file called `authup.server.core.conf` and store it in the same directory. Paste the following content into
the file which will configure the admin user for the API service:

```dotenv
adminUsername=test
adminPassword=test-password
ADMIN_USERNAME=test
ADMIN_PASSWORD=test-password
```

In the following compose file example you can see that the `writable` directory containing the `authup.api.conf`
configuration file is mounted into the container under `/usr/src/writable` which is the default location for
In the following compose file example you can see that the
configuration file is mounted into the container under `/usr/src/app` which is the default location for
configuration files.

```yaml
version: '3.8'

volumes:
authup:

services:
authup:
image: ghcr.io/authup/authup:latest
container_name: authup
restart: unless-stopped
volumes:
- ./writable:/usr/src/writable
- ./authup.server.core.conf:/usr/src/app/authup.server.core.conf
ports:
- "3000:3000"
- "3001:3001"
command: cli start
- "3001:3000"
command: server/core start

```


### Multiple services

This shows an example of how to run authup alongside other services (postgres & redis) and connect to them. It also shows how to split
Authup into multiple services running the UI and API in separate containers.

Configuration via environment variables is possible in this configuration since both service are running in separate containers.
Authup into multiple services running the client- & server-services in separate containers.

```yaml
version: '3.8'
Expand All @@ -156,9 +148,9 @@ volumes:
redis_data:

services:
authup-api:
server-core:
image: ghcr.io/authup/authup:latest
container_name: authup-api
container_name: server-core
restart: unless-stopped
volumes:
- authup_data:/usr/src/writable
Expand All @@ -175,16 +167,16 @@ services:
- DB_PASSWORD=postgres
- DB_DATABASE=postgres
- REDIS_URL=redis://redis:6379

authup-ui:
command: server/core start
client-web:
image: ghcr.io/authup/authup:latest
container_name: authup-ui
container_name: client-web
restart: unless-stopped
depends_on:
- authup-api
- server-core
ports:
- "3000:3000"
command: ui start
command: client/web start

postgres:
image: postgres:14
Expand Down

0 comments on commit bbfb01f

Please sign in to comment.