Skip to content

Commit 46d5dac

Browse files
authored
Merge pull request #4 from shield-auth/develop
installation updated
2 parents 857ccbe + 8b62b0f commit 46d5dac

24 files changed

+263
-54
lines changed

content/architectural-resource/admin-login.mdx

Lines changed: 0 additions & 16 deletions
This file was deleted.

content/architectural-resource/create-api-user.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ description: This is the create API user flow chart
66
import { LightImage, DarkImage } from "@/components/image-switcher";
77

88
<LightImage
9-
src="/img/flow-charts/3-create-admin-user-transparent-light.png"
9+
src="/img/flow-charts/4-create-admin-user-transparent-light.png"
1010
alt="Create API User Flow Chart"
1111
/>
1212

1313
<DarkImage
14-
src="/img/flow-charts/3-create-admin-user-transparent.png"
14+
src="/img/flow-charts/4-create-admin-user-transparent.png"
1515
alt="Create API User Flow Chart"
1616
/>

content/architectural-resource/index.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
1515
On startup of the Shield server, the resource initialization process is
1616
triggered.
1717
</Card>
18-
<Card title="Admin Login" href="/architectural-resource/admin-login">
19-
Once the will reach healthy state then Admin Login api can be used for
20-
creation of the API Key.
21-
</Card>
2218
<Card title="Create API User" href="/architectural-resource/create-api-user">
2319
For any client related operations Like login, logout, password reset, etc.
2420
the API user is required. There can be more than one API user for a client
@@ -27,8 +23,9 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
2723
<Card title="Signup user" href="/architectural-resource/signup-user">
2824
An API user can create or register a new user to its own client.
2925
</Card>
30-
<Card title="Non Admin Login" href="/architectural-resource/non-admin-login">
31-
Regular (Non Admin) user can login to the client at this API endpoint.
26+
<Card title="Login" href="/architectural-resource/admin-login">
27+
Once the will reach healthy state then Admin Login api can be used for
28+
creation of the API Key.
3229
</Card>
3330
<Card title="Refresh Token" href="/architectural-resource/refresh-token">
3431
Refresh token is used to refresh the session and generate a new set of token
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Admin Login
3+
description: This is the admin login flow chart
4+
---
5+
6+
import { LightImage, DarkImage } from "@/components/image-switcher";
7+
8+
<LightImage
9+
src="/img/flow-charts/2-login-transparent-light.png"
10+
alt="Admin Login Flow Chart"
11+
/>
12+
13+
<DarkImage
14+
src="/img/flow-charts/2-login-transparent.png"
15+
alt="Admin Login Flow Chart"
16+
/>
17+
18+
## Session Creation Flow
19+
20+
<LightImage
21+
src="/img/flow-charts/3-session-creation-transparent-light.png"
22+
alt="Admin Login Flow Chart"
23+
/>
24+
25+
<DarkImage
26+
src="/img/flow-charts/3-session-creation-transparent.png"
27+
alt="Admin Login Flow Chart"
28+
/>

content/architectural-resource/meta.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
"icon": "Construction",
55
"pages": [
66
"resource-initialization",
7-
"admin-login",
87
"create-api-user",
98
"signup-user",
10-
"non-admin-login",
9+
"login",
1110
"refresh-token",
1211
"introspection"
1312
]

content/architectural-resource/non-admin-login.mdx

Lines changed: 0 additions & 16 deletions
This file was deleted.

content/architectural-resource/signup-user.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ description: This is the signup user flow chart
66
import { LightImage, DarkImage } from "@/components/image-switcher";
77

88
<LightImage
9-
src="/img/flow-charts/4-signup-user-transparent-light.png"
9+
src="/img/flow-charts/5-signup-user-transparent-light.png"
1010
alt="Signup User Flow Chart"
1111
/>
1212

1313
<DarkImage
14-
src="/img/flow-charts/4-signup-user-transparent.png"
14+
src="/img/flow-charts/5-signup-user-transparent.png"
1515
alt="Signup User Flow Chart"
1616
/>

content/getting-started/installation.mdx

Lines changed: 227 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Installation
33
description: We have a docker images for amd64 and arm64.
44
---
55

6+
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
7+
68
<Callout>
79

810
You can find the docker image on [docker hub](https://hub.docker.com/r/shieldauth/shield)
@@ -16,35 +18,250 @@ Before you begin, ensure you have the following installed:
1618
- [Docker](https://docs.docker.com/get-docker/)
1719
- [Docker Compose](https://docs.docker.com/compose/install/)
1820

19-
### 1. Clone the repository
21+
Here are three different ways to deploy Shield Auth, ranging from development to
22+
production setups:
2023

21-
#### Using HTTPS
24+
## 1. Run from Source Code 👨‍💻
2225

23-
```bash
26+
Best for development and customization. Build Shield from source code with full
27+
control over the build process.
28+
29+
<Accordions>
30+
<Accordion title="Detailed building steps" id="build-from-source">
31+
32+
### I. Clone the repository
33+
34+
```bash title="terminal"
2435
git clone https://github.com/shield-auth/shield.git
2536
cd shield
2637
```
2738

28-
### 2. Set Up Environment Variables
39+
### II. Set Up Environment Variables
2940

30-
```bash
41+
```bash title="terminal"
3142
cp .env.example .env
3243
```
3344

34-
### 3. Build and Start the Containers
45+
### III. Build and Start the Containers
3546

36-
```bash
47+
```bash title="terminal"
3748
docker compose up -d --build --wait
3849
```
3950

40-
### 4. Retrieve Default credentials
51+
### IV. Retrieve Default credentials
52+
53+
The default credentials are saved in `/usr/local/bin/logs/default_cred.json`.
54+
To view them:
55+
56+
```bash title="terminal"
57+
docker exec shield cat /usr/local/bin/logs/default_cred.json
58+
```
59+
60+
_Note: If the above command doesn't work, use `docker ps` to find the correct
61+
container ID for the shield container._
62+
63+
</Accordion>
64+
</Accordions>
65+
66+
## 2. Run with Containerized Database 🐳
67+
68+
Best for single-server deployments and testing. Complete self-contained setup
69+
with both Shield and PostgreSQL.
70+
71+
<Accordions>
72+
<Accordion title="Detailed running steps" id="run-from-docker-image">
73+
74+
### I. Setup the environment Variables
75+
76+
```bash title=".env"
77+
# Shield Service Settings
78+
SHIELD_VERSION=latest
79+
EXTERNAL_PORT=5555 # Shield external port
80+
PORT=5555 # Shield internal port
81+
RUN_MODE=production # development or production
82+
83+
# Database Settings
84+
POSTGRES_VERSION=17
85+
POSTGRES_USER=postgres
86+
POSTGRES_PASSWORD=1234
87+
POSTGRES_PORT=5432
88+
DB_EXTERNAL_PORT=5435 # External database port
89+
DATABASE_NAME=shield
90+
91+
# The DATABASE_URL will be constructed from the above settings
92+
# Format: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}
93+
```
94+
95+
### II. Pull the image and start the services
96+
97+
```yaml title="docker-compose.yml"
98+
version: "3.8"
99+
100+
services:
101+
shield:
102+
image: shieldauth/shield:${SHIELD_VERSION:-latest}
103+
container_name: shield
104+
restart: unless-stopped
105+
ports:
106+
- "${EXTERNAL_PORT:-5555}:${PORT:-5555}" # External:Internal port mapping
107+
depends_on:
108+
db:
109+
condition: service_healthy
110+
environment:
111+
- DATABASE_URL=postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-1234}@db:${POSTGRES_PORT:-5432}
112+
- DATABASE_NAME=${DATABASE_NAME:-shield}
113+
- RUN_MODE=${RUN_MODE:-production}
114+
- PORT=${PORT:-5555}
115+
healthcheck:
116+
test:
117+
["CMD-SHELL", "curl -f http://localhost:${PORT:-5555}/health || exit 1"]
118+
interval: 30s
119+
timeout: 10s
120+
retries: 3
121+
start_period: 40s
122+
networks:
123+
- shield-network
124+
logging:
125+
driver: "json-file"
126+
options:
127+
max-size: "10m"
128+
max-file: "3"
129+
130+
db:
131+
image: postgres:${POSTGRES_VERSION:-17}
132+
container_name: shield-db
133+
restart: unless-stopped
134+
volumes:
135+
- postgres_data:/var/lib/postgresql/data
136+
environment:
137+
- POSTGRES_USER=${POSTGRES_USER:-postgres}
138+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-1234}
139+
- POSTGRES_DB=${DATABASE_NAME:-shield}
140+
ports:
141+
- "${DB_EXTERNAL_PORT:-5435}:${POSTGRES_PORT:-5432}"
142+
healthcheck:
143+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
144+
interval: 5s
145+
timeout: 5s
146+
retries: 5
147+
networks:
148+
- shield-network
149+
logging:
150+
driver: "json-file"
151+
options:
152+
max-size: "10m"
153+
max-file: "3"
154+
155+
networks:
156+
shield-network:
157+
name: shield-${RUN_MODE:-production}
158+
159+
volumes:
160+
postgres_data:
161+
name: shield-postgres-${RUN_MODE:-production}
162+
```
163+
164+
```bash
165+
docker compose up -d
166+
```
167+
168+
### III. Retrieve Default credentials
169+
170+
The default credentials are saved in `/usr/local/bin/logs/default_cred.json`.
171+
To view them:
172+
173+
```bash
174+
docker exec shield cat /usr/local/bin/logs/default_cred.json
175+
```
176+
177+
_Note: If the above command doesn't work, use `docker ps` to find the correct
178+
container ID for the shield container._
179+
180+
</Accordion>
181+
</Accordions>
182+
183+
## 3. Run with External Database 📡
184+
185+
Best for production deployments. Use this when connecting to an existing
186+
database or managed database service.
187+
188+
<Accordions>
189+
<Accordion title="Detailed running steps" id="run-with-external-database">
190+
191+
### I. Setup the environment Variables
192+
193+
```bash title=".env"
194+
# Required Settings
195+
DATABASE_URL=postgres://user:password@host:5432
196+
DATABASE_NAME=shield
197+
198+
# Optional Settings with defaults
199+
SHIELD_VERSION=latest
200+
EXTERNAL_PORT=8080 # Port exposed to the outside world
201+
PORT=5555 # Port used inside the container
202+
RUN_MODE=production # development or production
203+
```
204+
205+
### II. Pull the image and start the services
206+
207+
```yaml title="docker-compose.yml"
208+
version: "3.8"
209+
210+
services:
211+
shield:
212+
image: shieldauth/shield:${SHIELD_VERSION:-latest}
213+
container_name: shield
214+
restart: unless-stopped
215+
ports:
216+
- "${EXTERNAL_PORT:-5555}:${PORT:-5555}" # External:Internal port mapping
217+
environment:
218+
- DATABASE_URL=${DATABASE_URL:?DATABASE_URL is required}
219+
- DATABASE_NAME=${DATABASE_NAME:?DATABASE_NAME is required}
220+
- RUN_MODE=${RUN_MODE:-production}
221+
- PORT=${PORT:-5555} # Use PORT for application configuration
222+
healthcheck:
223+
test:
224+
["CMD-SHELL", "curl -f http://localhost:${PORT:-5555}/health || exit 1"]
225+
interval: 30s
226+
timeout: 10s
227+
retries: 3
228+
start_period: 40s
229+
networks:
230+
- shield-network
231+
logging:
232+
driver: "json-file"
233+
options:
234+
max-size: "10m"
235+
max-file: "3"
41236

42-
The default credentials are saved in `/usr/local/bin/logs/default_cred.json.
237+
networks:
238+
shield-network:
239+
name: shield-${RUN_MODE:-production}
240+
```
241+
242+
### III. Retrieve Default credentials
243+
244+
The default credentials are saved in `/usr/local/bin/logs/default_cred.json`.
43245
To view them:
44246

45247
```bash
46-
docker exec shield-shield-1 cat /usr/local/bin/logs/default_cred.json
248+
docker exec shield cat /usr/local/bin/logs/default_cred.json
47249
```
48250

49251
_Note: If the above command doesn't work, use `docker ps` to find the correct
50252
container ID for the shield container._
253+
254+
</Accordion>
255+
</Accordions>
256+
257+
🔄 Deployment Strategy
258+
Choose your deployment option based on your needs:
259+
260+
Development: Use **"Run from Source Code"** for full development capabilities <br />
261+
Testing/Staging: Use **"Run with Containerized Database"** for a complete isolated
262+
environment <br />
263+
Production: Use **"Run with External Database"** for better scalability and management
264+
265+
Each option includes proper logging, health checks, and container management
266+
configurations. Refer to the full documentation for detailed configuration
267+
options and best practices.
-1.17 KB
Loading
-498 Bytes
Loading

0 commit comments

Comments
 (0)