-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add backends config option for nginx #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,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": ../.. |
This file contains hidden or 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,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 | ||
| ``` |
This file contains hidden or 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 @@ | ||
| BACKEND1 |
This file contains hidden or 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 @@ | ||
| BACKEND2 |
This file contains hidden or 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,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; | ||
| } | ||
| } |
This file contains hidden or 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 @@ | ||
| FRONTEND |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.