Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pr-nginx-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- examples/1.17
- examples/1.16
- examples/custom
- examples/backends
Comment thread
cursor[bot] marked this conversation as resolved.

steps:
- name: Checkout code
Expand Down
27 changes: 27 additions & 0 deletions examples/backends/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: lando-nginx-backends
services:
frontend:
type: nginx:1.29
webroot: .
backends:
- backend1
- backend2
build_as_root:
- apt-get update && apt-get install -y curl
config:
vhosts: config/proxy.conf
backend1:
type: nginx:1.29
webroot: backend1
build_as_root:
- apt-get update && apt-get install -y curl
backend2:
type: nginx:1.29
webroot: backend2
build_as_root:
- apt-get update && apt-get install -y curl

# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/nginx": ../..
52 changes: 52 additions & 0 deletions examples/backends/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# NGINX Backends Example

This example exists primarily to test the following documentation:

* [nginx Service](https://docs.lando.dev/plugins/nginx)

## Start up tests

Run the following commands to get up and running with this example.

```bash
# Should start up successfully
lando poweroff
lando start
```

## Verification commands

Run the following commands to validate things are rolling as they should.

```bash
# Should serve frontend content from the app root
lando ssh -s frontend -c "curl -s http://localhost" | grep FRONTEND

# Should be able to reach backend1 through the frontend proxy
lando ssh -s frontend -c "curl -s http://localhost/backend1/" | grep BACKEND1

# Should be able to reach backend2 through the frontend proxy
lando ssh -s frontend -c "curl -s http://localhost/backend2/" | grep BACKEND2

# Should have backend1 as a dependency of frontend
lando info -s frontend --format json | grep backend1

# Should have backend2 as a dependency of frontend
lando info -s frontend --format json | grep backend2

# Should serve backend1 directly on its own port
lando ssh -s backend1 -c "curl -s http://localhost" | grep BACKEND1

# Should serve backend2 directly on its own port
lando ssh -s backend2 -c "curl -s http://localhost" | grep BACKEND2
```

## Destroy tests

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
```
1 change: 1 addition & 0 deletions examples/backends/backend1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BACKEND1
1 change: 1 addition & 0 deletions examples/backends/backend2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BACKEND2
21 changes: 21 additions & 0 deletions examples/backends/config/proxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server {
listen 80;
server_name localhost;

location /backend1 {
proxy_pass http://backend1:80/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

location /backend2 {
proxy_pass http://backend2:80/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

location / {
root "{{LANDO_WEBROOT}}";
index index.html;
}
}
1 change: 1 addition & 0 deletions examples/backends/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FRONTEND
Loading