Skip to content

Commit

Permalink
docs: add maintainer training resources, add testing and docs for Orb…
Browse files Browse the repository at this point in the history
…Stack and Rancher Desktop, fixes #5113, fixes #4858 (#5548) [skip ci]
  • Loading branch information
rfay committed Nov 21, 2023
1 parent 34f3c26 commit c23ce8d
Show file tree
Hide file tree
Showing 21 changed files with 268 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
BUILDKITE_CLEAN_CHECKOUT: true
BUILDKITE_BUILD_PATH: ~/tmp/buildkite_builds
BUILDKIT_PROGRESS: plain
DDEV_TEST_USE_NFSMOUNT: true
DDEV_TEST_SHARE_CMD: "true"
DOCKER_TYPE: "docker-desktop"
parallelism: 1
4 changes: 2 additions & 2 deletions .buildkite/macos-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
BUILDKIT_PROGRESS: plain
DDEV_TEST_SHARE_CMD: "true"
DDEV_RUN_GET_TESTS: "true"
# M1 has some NFS failures (TestComposer, TestProcessHooks, TestNFSMount) and as of 2021-02-18; test without NFS by default
# DDEV_TEST_USE_NFSMOUNT: true
DOCKER_TYPE: "docker-desktop"

parallelism: 1
18 changes: 18 additions & 0 deletions .buildkite/macos-orbstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- command: ".buildkite/test.sh"
plugins:
- docker-login#v2.1.0:
username: druddockerpullaccount
password-env: DOCKERHUB_PULL_PASSWORD
agents:
- "os=macos"
- "orbstack=true"
- "architecture=arm64"
#branches: "master"
env:
BUILDKITE_CLEAN_CHECKOUT: true
BUILDKITE_BUILD_PATH: ~/tmp/buildkite_builds
BUILDKIT_PROGRESS: plain
DDEV_TEST_SHARE_CMD: "false"
DDEV_RUN_GET_TESTS: "false"
DOCKER_TYPE: "orbstack"
parallelism: 1
18 changes: 18 additions & 0 deletions .buildkite/macos-rancher-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- command: ".buildkite/test.sh"
plugins:
- docker-login#v2.1.0:
username: druddockerpullaccount
password-env: DOCKERHUB_PULL_PASSWORD
agents:
- "os=macos"
- "rancher-desktop=true"
- "architecture=arm64"
branches: "master"
env:
BUILDKITE_CLEAN_CHECKOUT: true
BUILDKITE_BUILD_PATH: ~/tmp/buildkite_builds
BUILDKIT_PROGRESS: plain
DDEV_TEST_SHARE_CMD: "false"
DDEV_RUN_GET_TESTS: "false"
DOCKER_TYPE: "rancher-desktop"
parallelism: 1
74 changes: 57 additions & 17 deletions .buildkite/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,63 @@ export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin
# GOTEST_SHORT=8 means drupal9
export GOTEST_SHORT=8

echo "buildkite building ${BUILDKITE_JOB_ID:-} at $(date) on $(hostname) as USER=${USER} for OS=${OSTYPE} in ${PWD} with GOTEST_SHORT=${GOTEST_SHORT} golang=$(go version | awk '{print $3}') docker-desktop=$(scripts/docker-desktop-version.sh) docker=$(docker --version | awk '{print $3}') ddev version=$(ddev --version | awk '{print $3}'))"
# On macOS, we can have several different docker providers, allow testing all
if [ "${OSTYPE%%[0-9]*}" = "darwin" ]; then
# Always leave docker desktop running on macOS test runners
function cleanup {
orb stop || true
~/.rd/bin/rdctl shutdown >/dev/null 2>&1 || true
open -a Docker >/dev/null 2>&1 || true
docker context use desktop-linux
}
trap cleanup EXIT

case ${DOCKER_TYPE} in
"docker-desktop")
orb stop || true
~/.rd/bin/rdctl shutdown || true
open -a Docker
docker context use desktop-linux
;;
"orbstack")
~/.rd/bin/rdctl shutdown || true
killall com.docker.backend || true
orb start &
docker context use orbstack
;;
"rancher-desktop")
killall com.docker.backend || true
orb stop || true
~/.rd/bin/rdctl start
docker context use rancher-desktop
;;

*)
open -a Docker
;;
esac
fi

export TIMEOUT_CMD="timeout -v"
if [ ${OSTYPE%%-*} = "linux" ]; then
TIMEOUT_CMD="timeout"
fi

# Make sure docker is working
echo "Waiting for docker to come up: $(date)"
date && ${TIMEOUT_CMD} 10m bash -c 'while ! docker ps >/dev/null 2>&1 ; do
sleep 10
echo "Waiting for docker to come up: $(date)"
done'
echo "Testing again to make sure docker came up: $(date)"
if ! docker ps >/dev/null 2>&1 ; then
echo "Docker is not running, exiting"
exit 1
fi

echo "buildkite building ${BUILDKITE_JOB_ID:-} at $(date) on $(hostname) as USER=${USER} for OS=${OSTYPE} DOCKER_TYPE=${DOCKER_TYPE:notset} in ${PWD} with GOTEST_SHORT=${GOTEST_SHORT} golang=$(go version | awk '{print $3}') docker-desktop=$(scripts/docker-desktop-version.sh) docker=$(docker --version | awk '{print $3}') ddev version=$(ddev --version | awk '{print $3}'))"

ddev version

export DDEV_NONINTERACTIVE=true
export DDEV_DEBUG=true
Expand Down Expand Up @@ -42,22 +98,6 @@ fi
# sleep 10
#fi

export TIMEOUT_CMD="timeout -v"
if [ ${OSTYPE%%-*} = "linux" ]; then
TIMEOUT_CMD="timeout"
fi
# Make sure docker is working
echo "Waiting for docker to come up: $(date)"
date && ${TIMEOUT_CMD} 10m bash -c 'while ! docker ps >/dev/null 2>&1 ; do
sleep 10
echo "Waiting for docker to come up: $(date)"
done'
echo "Testing again to make sure docker came up: $(date)"
if ! docker ps >/dev/null 2>&1 ; then
echo "Docker is not running, exiting"
exit 1
fi

docker volume rm ddev-global-cache >/dev/null 2>&1 || true

# Run any testbot maintenance that may need to be done
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/testbot_maintenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ fi
# Clean the docker build cache
docker buildx prune -f -a || true
# Remove any images with name '-built'
docker rm -f $(docker ps -aq) >/dev/null || true
docker rmi -f $(docker images | awk '/[-]built/ { print $3 }') >/dev/null || true
docker rm -f $(docker ps -aq) >/dev/null 2>&1 || true
docker rmi -f $(docker images | awk '/[-]built/ { print $3 }') >/dev/null 2>&1 || true
2 changes: 1 addition & 1 deletion .buildkite/windows10dockerforwindows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
- "architecture=amd64"
env:
BUILDKITE_CLEAN_CHECKOUT: true
DDEV_TEST_USE_NFSMOUNT: true
DDEV_TEST_USE_NFSMOUNT: false
parallelism: 1
4 changes: 4 additions & 0 deletions .spellcheckwordlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1Password
ARG
AdditionalConfig
AdditionalConfiguration
Expand Down Expand Up @@ -27,6 +28,7 @@ Codeception
Commands
Completely
Create
CRM
DBeaver
DDEV's
DDEV
Expand Down Expand Up @@ -75,6 +77,7 @@ IPv
If
IIS
Kalabox
Kubernetes
Lando
Laravel
Let's
Expand Down Expand Up @@ -153,6 +156,7 @@ WantedBy
Webhosting
XDebug
Xhprof
Zoho
XSym
Zsh
a
Expand Down
68 changes: 39 additions & 29 deletions docs/content/developers/buildkite-testmachine-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We are using [Buildkite](https://buildkite.com/ddev) for Windows and macOS testi

## Windows Test Agent Setup

1. Create the user “testbot” on the machine. Use the password for `ddevtestbot@gmail.com`, available in LastPass.
1. Create the user “testbot” on the machine. Use the password for `ddevtestbot@gmail.com`, available in 1Password.
2. In admin PowerShell, `wsl --install`.
3. In admin PowerShell, `Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"`.
4. In admin PowerShell, download and run [windows_buildkite_start.ps1](scripts/windows_buildkite_start.ps1) with `curl <url> -O windows_buildkite_start.ps1`.
Expand Down Expand Up @@ -126,36 +126,46 @@ We are using [Buildkite](https://buildkite.com/ddev) for Windows and macOS testi

## macOS Test Agent Setup (Intel and Apple Silicon)

1. Create the user “testbot” on the machine. Use the password for `ddevtestbot@gmail.com`, available in LastPass.
2. Change the name of the machine to something in keeping with current style. Maybe `testbot-macstadium-macos-3`.
3. Install [Homebrew](https://brew.sh/) `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
4. Install everything you’ll need with `brew install buildkite/buildkite/buildkite-agent bats-core colima composer ddev/ddev/ddev git golang jq mariadb mkcert netcat p7zip && brew install --cask docker iterm2 google-chrome nosleep ngrok`.
5. Run `ngrok config add-authtoken <token>` with token for free account.
6. Run `mkcert -install`.
7. Run Docker manually and go through its configuration routine.
8. Run iTerm. On Mojave and higher you may need to allow full disk access permissions.
9. Set up `nfsd` by running `macos_ddev_nfs_setup.sh`.
10. `git config --global --add safe.directory '*'`
11. Edit `/usr/local/etc/buildkite-agent/buildkite-agent.cfg` or `/opt/homebrew/etc/buildkite-agent/buildkite-agent.cfg` to add
* the agent token
* tags, like `"os=macos,architecture=arm64,osvariant=monterrey,dockertype=dockerformac"`
1. Create the user “testbot” on the machine. Use the password for `ddevtestbot@gmail.com`, available in 1Password.
2. Change the name of the machine to something in keeping with current style, perhaps `testbot-macos-arm64-8`. This is done in **Settings****General****About****Name** and in **Sharing****Computer Name** and in **Sharing****Local Hostname**.
3. Download and install Chrome and log the browser into the account used for test runners. It will pick up the Chrome Remote Desktop setup as a result. Configure Chrome Remote Desktop to serve. When this is done, the machine will be available for remote access and most other tasks can be done using Chrome Remote Desktop.
4. The machine should be on the correct network and have a static IP handed out by DHCP. IP addresses are listed in /etc/hosts on `pi.ddev.site`, so this one should be added.
5. Power should be set up as in ![macos power settings](../images/macos_power_settings.png).
6. Auto login should be set up as in ![macos users and groups](../images/macos_users_and_groups.png), see [automatically log in on boot](https://support.apple.com/en-us/HT201476).
7. Remote login should be enabled as in ![macos remote login](../images/macos_remote_login.png).
8. Automatic updates should be set to mostly security only as in ![macos automatic_updatees](../images/macos_automatic_updates.png).
9. Set the time zone to US MT (nearest city: Denver, Colorado).
10. `sudo mkdir -p /usr/local/bin && chown -R testbot /usr/local/bin`
11. Install [Homebrew](https://brew.sh/) `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
12. After installing Homebrew follow the instructions it gives you at the end to add brew to your PATH.
13. Install everything you’ll need with `brew install buildkite/buildkite/buildkite-agent bats-core composer ddev/ddev/ddev git golang jq mariadb mkcert netcat p7zip && brew install --cask docker iterm2 ngrok`.
14. Run `ngrok config add-authtoken <token>` with token for free account from 1Password.
15. Run `mkcert -install`.
16. If Docker Desktop will be deployed, run Docker manually and go through its configuration routine.
17. If OrbStack will be deployed, install it from [orbstack.dev](https://orbstack.dev).
* Install with Docker only.
* Click "Sign in" in the lower left to sign in with OrbStack credentials (normal test runner gmail address; it will receive an email with a login code).
* Configure it to automatically start and download updates, see ![OrbStack configuration](../images/orbstack_configuration.png).
18. If Rancher Desktop will be deployed, install it.
* Turn off kubernetes.
19. Run iTerm. You may need to allow full disk access permissions.
20. Set up `nfsd` by running [macos_ddev_nfs_setup.sh](https://raw.githubusercontent.com/ddev/ddev/master/scripts/macos_ddev_nfs_setup.sh).
21. `git config --global --add safe.directory '*'`
22. Edit `/usr/local/etc/buildkite-agent/buildkite-agent.cfg` or `/opt/homebrew/etc/buildkite-agent/buildkite-agent.cfg` to add
* the agent token (from [agents tab](https://buildkite.com/organizations/ddev/agents), "Reveal Agent Token").
* tags, like `"os=macos,architecture=arm64,osvariant=sonoma,dockertype=dockerformac,rancher-desktop=true,orbstack=true,docker-desktop=true"`
* `build-path="~/tmp/buildkite-agent/builds"`
12. The buildkite/hooks/environment file must be updated to contain the Docker pull credentials:
23. The buildkite/hooks/environment file must be created and set executable to contain the Docker pull credentials (found in `druddockerpullaccount` in 1Password):

```bash
#!/bin/bash
export DOCKERHUB_PULL_USERNAME=druddockerpullaccount
export DOCKERHUB_PULL_PASSWORD=xxx
set -e
#!/bin/bash
export DOCKERHUB_PULL_USERNAME=druddockerpullaccount
export DOCKERHUB_PULL_PASSWORD=xxx
set -e
```

13. Run `brew services start buildkite-agent`.
14. Manually run `testbot_maintenance.sh`, `curl -sL -O https://raw.githubusercontent.com/ddev/ddev/master/.buildkite/testbot_maintenance.sh && bash testbot_maintenance.sh`.
15. Enable nosleep using its shortcut in the Mac status bar.
16. In nosleep Preferences, enable “Never sleep on AC Adapter”, “Never sleep on Battery”, and “Start nosleep utility on system startup”.
17. `sudo chown testbot /usr/local/bin`
18. Set up Mac to [automatically log in on boot](https://support.apple.com/en-us/HT201476).
19. Try checking out [ddev/ddev](https://github.com/ddev/ddev) and running `.buildkite/sanetestbot.sh` to check your work.
20. Log into Chrome with the user `ddevtestbot@gmail.com` and enable Chrome Remote Desktop.
21. Set the timezone (US MT).
22. Start the agent with `brew services start buildkite-agent`.
24. Run `brew services start buildkite-agent`.
25. Manually run `testbot_maintenance.sh`, `curl -sL -O https://raw.githubusercontent.com/ddev/ddev/master/.buildkite/testbot_maintenance.sh && bash testbot_maintenance.sh`.
26. `mkdir ~/workspace && cd ~/workspace && git clone https://github.com/ddev/ddev` and run `.buildkite/sanetestbot.sh` to check your work.
27. The `testbot` user's ssh account is used for monitoring, so `ssh-keygen` and then add the public key `id_testbot` from 1Password to `~/.ssh/authorized_keys` and `chmod 600 ~/.ssh/authorized_keys`.
28. Add the new machine to Icinga by copying an existing Icinga service to the new one.

0 comments on commit c23ce8d

Please sign in to comment.