-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
149 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
image: clivern/lynx:0.11.9 | ||
environment: | ||
APP_NAME: Lynx | ||
APP_PORT: 4000 | ||
APP_SECRET: koPmu7TJCwD8mttV9vgWUeU7iuu/zTPOR3sX4UalM9KkYEVGPfyi0PeTVzu1TT8C | ||
APP_HOST: localhost | ||
APP_HTTP_SCHEMA: http | ||
DB_USERNAME: root | ||
DB_PASSWORD: D1q9f0C2&PEW | ||
DB_HOSTNAME: db | ||
DB_DATABASE: lynx | ||
DB_PORT: 5432 | ||
DB_SSL: null | ||
DB_CA_CERTFILE_PATH: null | ||
MIX_ENV: prod | ||
command: sh -c "/app/bin/migrate && /app/bin/server" | ||
restart: unless-stopped | ||
depends_on: | ||
- db | ||
|
||
db: | ||
image: postgres:16.3 | ||
environment: | ||
POSTGRES_DB: lynx | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: D1q9f0C2&PEW | ||
restart: unless-stopped | ||
volumes: | ||
- db:/var/lib/postgresql/data | ||
|
||
nginx: | ||
image: nginx:1.25.4-alpine3.18 | ||
ports: | ||
- '80:80' | ||
healthcheck: | ||
test: ["CMD", "curl", "--fail", "http://localhost/_ready"] | ||
interval: 30s | ||
retries: 3 | ||
restart: unless-stopped | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf | ||
|
||
volumes: | ||
db: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#### How to use Lynx as a backend | ||
|
||
After creating a project and environment in lynx dashboard. You can get the backend information and secrets to use. it should be something like the following | ||
|
||
```hcl | ||
terraform { | ||
backend "http" { | ||
username = "hs2d21pk" | ||
password = "pO(BwDTjs5ND" | ||
address = "http://localhost:4000/client/clivern/monitoring/prod/state" | ||
lock_address = "http://localhost:4000/client/clivern/monitoring/prod/lock" | ||
unlock_address = "http://localhost:4000/client/clivern/monitoring/prod/unlock" | ||
lock_method = "POST" | ||
unlock_method = "POST" | ||
} | ||
} | ||
``` | ||
|
||
Copy the `address`, `lock_address`, `unlock_address`, `lock_method` and `unlock_method` and place it in `backend.tf` file like the following | ||
|
||
```hcl | ||
terraform { | ||
backend "http" { | ||
address = "http://localhost:4000/client/clivern/monitoring/prod/state" | ||
lock_address = "http://localhost:4000/client/clivern/monitoring/prod/lock" | ||
unlock_address = "http://localhost:4000/client/clivern/monitoring/prod/unlock" | ||
lock_method = "POST" | ||
unlock_method = "POST" | ||
} | ||
} | ||
``` | ||
|
||
Username and password should be define as environment variables. | ||
|
||
```zsh | ||
$ export TF_HTTP_USERNAME="vf41bkwj" | ||
$ export TF_HTTP_PASSWORD="2sTb&N*gvyXj" | ||
``` | ||
|
||
Then you can check the changes and apply them | ||
|
||
```zsh | ||
$ terraform plan | ||
$ terraform apply | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
terraform { | ||
backend "http" { | ||
username = "hs2d21pk" | ||
password = "pO(BwDTjs5ND" | ||
address = "http://localhost:4000/client/clivern/monitoring/prod/state" | ||
lock_address = "http://localhost:4000/client/clivern/monitoring/prod/lock" | ||
unlock_address = "http://localhost:4000/client/clivern/monitoring/prod/unlock" | ||
lock_method = "POST" | ||
unlock_method = "POST" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
events { } | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name lynx.sh; # Replace with your actual domain name | ||
|
||
location / { | ||
proxy_pass http://app:4000; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-NginX-Proxy true; | ||
|
||
proxy_redirect off; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.