Skip to content

Commit 4e51559

Browse files
committed
feat: Improved local deployment documentation to include frontend
1 parent 829717b commit 4e51559

1 file changed

Lines changed: 45 additions & 13 deletions

File tree

local-deployment.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,30 @@ nav_order: 4
66

77
# Local Deployment
88

9-
You can try **Secure Chain** tools backends in your local machine following the next steps.
9+
You can try **Secure Chain** tool in your local machine for development purposes following the next steps.
1010

1111
## Enviroment File
1212

13-
The first you need is to create an enviroment `(.env)` file from this template:
13+
The first you need is to create an enviroment `(.env and .env.local)` file from this template:
14+
1415
```bash
1516
# For dockerized backend and database
1617
GRAPH_DB_URI='bolt://neo4j:7687'
17-
VULN_DB_URI='mongodb://mongoSecureChain:mongoSecureChain@mongodb:27017/admin'
18-
ALLOWED_ORIGINS='["http://securechain-gateway:8000"]'
19-
GATEWAY_ALLOWED_ORIGINS='["http://localhost:3000"]' # Change in production
18+
VULN_DB_URI='mongodb://mongoSecureChain:mongoSecureChain@mongo:27017/admin'
19+
DOCS_URL='/docs' # Comment this on production
20+
SERVICES_ALLOWED_ORIGINS='["http://securechain-gateway:8000"]'
21+
GATEWAY_ALLOWED_ORIGINS='["http://securechain-frontend"]'
22+
BACKEND_URL=http://securechain-gateway:8000
23+
NODE_ENV=development # Change to 'production' for production builds
2024

2125
# Databases settings
22-
GRAPH_DB_USER='neo4j'
23-
GRAPH_DB_PASSWORD='neoSecureChain'
24-
VULN_DB_USER='mongoSecureChain'
25-
VULN_DB_PASSWORD='mongoSecureChain'
26+
GRAPH_DB_USER='neo4j' # Change in production
27+
GRAPH_DB_PASSWORD='neoSecureChain' # Change in production
28+
VULN_DB_USER='mongoSecureChain' # Change in production
29+
VULN_DB_PASSWORD='mongoSecureChain' # Change in production
2630

2731
# Secrets for JWT
28-
SECURE='FALSE' # Set to True in production
32+
SECURE=False # Set to True in production
2933
ALGORITHM='your_preferred_algorithm' # e.g., 'HS256'
3034
ACCESS_TOKEN_EXPIRE_MINUTES='access_token_expire_minutes'
3135
REFRESH_TOKEN_EXPIRE_DAYS='refresh_token_expire_days'
@@ -43,17 +47,25 @@ GITHUB_GRAPHQL_API_KEY='add_your_api_key'
4347
GIT_PYTHON_REFRESH='select_your option'
4448
GIT_CONFIG_SYSTEM='/dev/null'
4549
GIT_CONFIG_GLOBAL='/dev/null'
46-
GIT_LFS_SKIP_SMUDGE=1
50+
GIT_LFS_SKIP_SMUDGE='1'
4751
GIT_TEMPLATE_DIR=''
4852
```
4953

54+
## Nginx configuration
55+
56+
The second step is to create an Nginx configuration in the folder `nginx/templates/default.conf.template` following this template:
57+
58+
```nginx
59+
60+
```
61+
5062
## Docker Deployment
5163

52-
The second step only needs as requirements Docker with docker compose.
64+
The third step only needs as requirements Docker with docker compose.
5365

5466
### Docker Network
5567

56-
Create a docker network wirh command:
68+
Create a docker network with command:
5769
```bash
5870
docker network create securechain
5971
```
@@ -72,6 +84,21 @@ The containerized databases will also be seeded automatically.
7284
To deploy all **Secure Chain** tools in your local machine as demo, all you need is run this the command `docker compose up --build` with the `.env` file and this docker compose file in the same folder:
7385
```yml
7486
services:
87+
securechain-frontend:
88+
container_name: securechain-frontend
89+
image: ghcr.io/securechaindev/securechain-frontend:latest
90+
env_file:
91+
- .env.local
92+
ports:
93+
- "80:80"
94+
networks:
95+
- securechain
96+
depends_on:
97+
securechain-gateway:
98+
condition: service_healthy
99+
volumes:
100+
- ./nginx/templates:/etc/nginx/templates:ro
101+
75102
securechain-gateway:
76103
container_name: securechain-gateway
77104
image: ghcr.io/securechaindev/securechain-gateway:latest
@@ -88,6 +115,11 @@ services:
88115
condition: service_healthy
89116
securechain-vexgen:
90117
condition: service_healthy
118+
healthcheck:
119+
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
120+
interval: 5s
121+
timeout: 3s
122+
retries: 5
91123

92124
securechain-auth:
93125
container_name: securechain-auth

0 commit comments

Comments
 (0)