mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-04-19 23:46:53 +00:00
docker deployment docs
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 2m3s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 2m3s
This commit is contained in:
parent
af83f94b84
commit
b93d51c494
37
README.md
37
README.md
@ -10,3 +10,40 @@ API for SARLink portal in Django Rest Framework.
|
||||
4. Copy .env.example to .env and fill in the configs `cp .env.example .env`
|
||||
5. generate static `python manage.py collectstatic`
|
||||
6. Run Migrations `python manage.py migrate`
|
||||
|
||||
|
||||
## deployement with Docker
|
||||
1. Create `compose.yml`
|
||||
```yaml
|
||||
services:
|
||||
portal-api:
|
||||
hostname: portal-api
|
||||
image: git.shihaam.dev/sarlink/sarlink-portal-api/api
|
||||
env_file: .env.api
|
||||
nginx:
|
||||
hostname: portal-api-nginx
|
||||
image: git.shihaam.dev/sarlink/sarlink-portal-api/nginx
|
||||
volumes_from:
|
||||
- portal-api
|
||||
ports:
|
||||
- 4000:80
|
||||
depends_on:
|
||||
- portal-api
|
||||
portal-db:
|
||||
image: postgres:14
|
||||
restart: always
|
||||
hostname: portal-db
|
||||
volumes:
|
||||
- ./database:/var/lib/postgresql/data
|
||||
env_file: .env.db
|
||||
```
|
||||
2. Start services: `docker compose up -d`
|
||||
3. Run Migrations: `docker compose exec portal-api python manage.py migrate`
|
||||
4. Test api with curl:
|
||||
```bash
|
||||
curl -X POST http://localhost:4000/api/auth/login/ \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"username":"admin", "password":"soemthign"}'
|
||||
```
|
||||
expected response: `{"message":"Unable to log in with provided credentials."}`
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user