Skip to content

Commit

Permalink
fix: dev/prod envs
Browse files Browse the repository at this point in the history
  • Loading branch information
akdasa committed May 13, 2023
1 parent 3178583 commit 3db24da
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
File renamed without changes.
File renamed without changes.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@ Nginx Load Balancer for Shlokas. This is a simple load balancer for the Shlokas

## Mounts

| Path | Description |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `.logs/balancer/nginx` | Nginx logs. Error and access logs. |
| `.secrets/balancer/certs` | SSL certificates should be placed in the `./.secrets/balancer/certs` directory. The file names should be `server.crt` and `server.key`. |
| Path | Description |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `.logs` | Nginx logs. Error and access logs. |
| `.data` | SSL certificates should be placed in the `.data` directory. The file names should be `server.crt` and `server.key` for production. |


## Development

`.container/run.sh` will start the server in development mode. This will start the server in port `80` and will redirect requests to the backend servers.

### Endable HTTPS for local development
### Enable HTTPS for local development

1. Add `127.0.0.1 shlokas.dev` to `/etc/hosts`:
2. Add `rootCA.rem` as trusted root certificate.
3. Copy `certs/server.csr` and `certs/server.key` to `.secrets/balancer/certs`
4. Run `BALANCER_ENV=prod .container/run.sh`
2. Add `rootCA.rem` as a trusted root certificate.
3. Run `BALANCER_ENV=dev .container/run.sh`


## Production
Expand Down
4 changes: 2 additions & 2 deletions config/shlokas.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ server {
server_name shlokas.dev;
charset utf-8;

ssl_certificate /app/shlokas-balancer/.data/server.crt;
ssl_certificate_key /app/shlokas-balancer/.data/server.key;
ssl_certificate /app/shlokas-balancer/.data/shlokas.dev.crt;
ssl_certificate_key /app/shlokas-balancer/.data/shlokas.dev.key;

include endpoints.conf;
}
4 changes: 2 additions & 2 deletions config/shlokas.prod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ server {
server_name shlokas.app;
charset utf-8;

ssl_certificate /app/shlokas-balancer/certs/server.crt;
ssl_certificate_key /app/shlokas-balancer/certs/server.key;
ssl_certificate /app/shlokas-balancer/.data/server.crt;
ssl_certificate_key /app/shlokas-balancer/.data/server.key;

include endpoints.conf;
}

0 comments on commit 3db24da

Please sign in to comment.