-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
New Lagoon/Lando Services #44
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
347b647
First pass at creating node service for lando
CGoodwin90 af2145a
Included flavour for Node
CGoodwin90 0053fbe
Updated builder logic
CGoodwin90 a660a01
Merge branch 'add_node' of https://github.com/uselagoon/lando-lagoon …
CGoodwin90 161ac32
Refactored services, included examples and tests
CGoodwin90 ea4359a
force action run
tobybellwood 4a4f2ac
Dogfood lagoon plugin on all-services example.
CGoodwin90 1b34194
Merge branch 'new-services' of https://github.com/uselagoon/lando-lag…
CGoodwin90 de93808
force action run
tobybellwood File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: All Services Tests | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
leia-tests: | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
TERM: xterm | ||
strategy: | ||
matrix: | ||
leia-tests: | ||
- examples/all-services | ||
lando-versions: | ||
- edge | ||
os: | ||
- ubuntu-22.04 | ||
node-version: | ||
- '16' | ||
|
||
steps: | ||
# Install deps and cache | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: yarn | ||
- name: Install Yarn dependencies | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
|
||
# This block should eventually become use lando/actions-hyperdrive@v2 | ||
- name: Verify Docker dependencies | ||
run: | | ||
docker --version | grep "20.10." | ||
docker-compose --version | grep "1.29." | ||
- name: Grab latest edge Lando CLI | ||
run: | | ||
sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" | ||
sudo chmod +x /usr/local/bin/lando | ||
- name: Find and Replace | ||
uses: jacobtomlinson/gha-find-replace@v3 | ||
with: | ||
find: "lagoon/lagoon" | ||
replace: ${{ github.event.repository.name }}/${{ github.event.repository.name }} | ||
include: "actions-lando-config.yml" | ||
regex: false | ||
- name: Move in lando config appropriate for testing | ||
run: | | ||
mkdir -p ~/.lando/cache | ||
cp -f actions-lando-config.yml ~/.lando/config.yml | ||
echo false > ~/.lando/cache/report_errors | ||
lando --clear | ||
- name: Verify Lando works and we are dogfooding this plugin for tests | ||
run: | | ||
lando version | ||
lando config --path plugins | grep lagoon | grep /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }} || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1) | ||
|
||
# This block should eventually become use lando/actions-leia@v2 | ||
# @NOTE? Do we want a way for our leia-action to configure apparmor since | ||
# this might break a whole bunch of tests? or is this literally just a thing | ||
# for the Lagoon mysql/mariadb container? | ||
- name: Configure apparmor | ||
run: | | ||
set -x | ||
sudo apt-get remove mysql-server --purge | ||
sudo apt-get install apparmor-profiles | ||
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld | ||
- name: Run leia tests | ||
shell: bash | ||
run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
logs | ||
|
||
# NPM files | ||
node_modules | ||
/node_modules | ||
|
||
# lando config | ||
env.yaml | ||
|
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,7 +1,7 @@ | ||
name: lando-lagoon-plugin | ||
services: | ||
node: | ||
type: node:14 | ||
type: node:16 | ||
build: | ||
- yarn install | ||
scanner: false | ||
|
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
Empty file.
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 @@ | ||
docker-compose-yaml: docker-compose.yml |
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,12 @@ | ||
name: all-services | ||
recipe: lagoon | ||
services: | ||
node: | ||
command: yarn run start | ||
port: 3000 | ||
ruby: | ||
command: ruby -run -e httpd / -p 3000 | ||
port: 3000 | ||
python: | ||
command: python -m http.server 8800 | ||
port: 8800 |
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 @@ | ||
# Specifies the image of your engine | ||
FROM uselagoon/node-18:latest | ||
|
||
# The working directory inside your container | ||
WORKDIR /app | ||
|
||
# Get the package.json first to install dependencies | ||
COPY package.json yarn.lock /app/ | ||
|
||
# This will install those dependencies | ||
RUN yarn install | ||
|
||
# Copy the rest of the app to the working directory | ||
COPY . /app | ||
|
||
EXPOSE 3000 | ||
|
||
# Run the container | ||
CMD ["yarn", "run", "start"] |
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,68 @@ | ||
Lagoon All Services | ||
======================= | ||
|
||
This example exists primarily to test the following documentation: | ||
|
||
* [Lagoon Recipe - Drupal 9](https://docs.lando.dev/config/lagoon.html) | ||
|
||
Start up tests | ||
-------------- | ||
|
||
Run the following commands to get up and running with this example. | ||
|
||
```bash | ||
# Should poweroff | ||
lando poweroff | ||
|
||
# Should start up our project successfully | ||
lando start | ||
``` | ||
|
||
Verification commands | ||
--------------------- | ||
|
||
Run the following commands to validate things are rolling as they should. | ||
|
||
```bash | ||
# Should have all the services we expect | ||
docker ps --filter label=com.docker.compose.project | grep Up | grep allservices_node_1 | ||
docker ps --filter label=com.docker.compose.project | grep Up | grep allservices_python_1 | ||
docker ps --filter label=com.docker.compose.project | grep Up | grep allservices_ruby_1 | ||
|
||
# Should have the correct environment set | ||
lando ssh -u root -c "env" | grep LAGOON_ROUTE | ||
lando ssh -u root -c "env" | grep LAGOON_ENVIRONMENT_TYPE | grep development | ||
|
||
# Should have node | ||
lando node --version | ||
|
||
# Should have npm | ||
lando npm --version | ||
|
||
# Should have yarn | ||
lando yarn --version | ||
|
||
# Should have lagoon cli | ||
lando lagoon --version | grep lagoon | ||
|
||
# Should have a running node service | ||
curl -kL http://node.all-services.lndo.site/ | grep "LAGOON=" | ||
|
||
# # Should have a running python service | ||
curl -kL http://python.all-services.lndo.site/ | grep "lagoon/" | ||
|
||
# # Should have a running ruby service | ||
curl -kL http://ruby.all-services.lndo.site/ | grep "Ruby/" | ||
curl -kL http://ruby.all-services.lndo.site/ | grep "lagoon/" | ||
``` | ||
|
||
Destroy tests | ||
------------- | ||
|
||
Run the following commands to trash this app like nothing ever happened. | ||
|
||
```bash | ||
# Should be able to destroy the project successfully | ||
lando destroy -y | ||
lando poweroff | ||
``` |
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,57 @@ | ||
version: "2.3" | ||
|
||
x-environment: | ||
&default-environment | ||
LAGOON_PROJECT: "all-services" | ||
# Route that should be used locally | ||
LAGOON_ROUTE: &default-url http://${COMPOSE_PROJECT_NAME:-all-services}.docker.amazee.io | ||
# Uncomment if you like to have the system behave like in production | ||
LAGOON_ENVIRONMENT_TYPE: development | ||
# Uncomment to enable xdebug and then restart via `docker-compose up -d` | ||
#XDEBUG_ENABLE: "true" | ||
HTTP_HOST: *default-url | ||
|
||
x-user: | ||
&default-user | ||
# The default user under which the containers should run. Change this if you are on linux and run with another user than id `1000` | ||
user: '1000' | ||
|
||
services: | ||
node: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
labels: | ||
lagoon.type: node | ||
lando.type: node | ||
ports: | ||
- "3000" | ||
user: root | ||
environment: | ||
<< : *default-environment # loads the defined environment variables from the top | ||
networks: | ||
- default | ||
|
||
python: | ||
image: uselagoon/python-3.11:latest | ||
labels: | ||
lagoon.type: python | ||
lando.type: python | ||
ports: | ||
- "8800" | ||
environment: | ||
<< : *default-environment # loads the defined environment variables from the top | ||
networks: | ||
- default | ||
|
||
ruby: | ||
image: uselagoon/ruby-3.0:latest | ||
labels: | ||
lagoon.type: ruby | ||
lando.type: ruby | ||
ports: | ||
- "3000" | ||
environment: | ||
<< : *default-environment # loads the defined environment variables from the top | ||
networks: | ||
- default |
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,13 @@ | ||
import {createServer} from 'http'; | ||
// create a server object: | ||
createServer(function(req, res) { | ||
let result = []; | ||
Object.keys(process.env).map(key => { | ||
result.push(`${key}=${process.env[key]}`); | ||
}); | ||
res.setHeader('Content-type', 'text/html'); | ||
res.write(result.join(`<br/>`)); | ||
res.end(); // end the response | ||
}).listen(3000, function() { | ||
console.log('server start at port 3000'); // the server object listens on port 3000 | ||
}); |
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,13 @@ | ||
{ | ||
"name": "node", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"type":"module", | ||
"dependencies": { | ||
"express": "^4.17.1" | ||
}, | ||
"scripts": { | ||
"start": "node index.js" | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick note here - we needed to replace the lando-config here, as our fork of the repo isn't in a
lagoon
repo - so this allows the config to pick up the correct repo name