fix: Add keepalive. #53
Workflow file for this run
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
--- | |
name: ci | |
on: | |
pull_request: | |
branches: [master] | |
# Cancel old PR builds when pushing new commits. | |
concurrency: | |
group: build-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
wireguard-vpn: | |
strategy: | |
matrix: | |
node: [2, 3, 4, 5, 6, 7, 8, 9] | |
# node: [2, 3, 4] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup wireguard | |
run: | | |
sudo apt-get -y --no-install-recommends install redis-tools wireguard | |
sudo cp .github/buildfarm/wg0-${{ matrix.node }}.conf /etc/wireguard/wg0.conf | |
sudo systemctl enable [email protected] | |
sudo systemctl start [email protected] || (sudo systemctl status [email protected] && false) | |
sudo systemctl start ssh | |
mkdir "$HOME/.ssh" | |
cp .github/buildfarm/authorized_keys "$HOME/.ssh/" | |
- name: Start redis | |
if: matrix.node == 2 | |
run: | | |
docker pull "redis:alpine" | |
docker run --detach --rm -i --network host "redis:alpine" | |
- name: Wait for VPN to be up | |
run: | | |
ifconfig wg0 | |
sudo wg show | |
# VPN server and redis/buildfarm server need to be up. | |
for node in `seq 1 2`; do | |
for i in `seq 0 9`; do | |
if ping -c1 "10.100.0.$node"; then break; fi | |
sleep 1 | |
done | |
done | |
# Error if VPN server is still down after the above timeout. | |
ping -c1 10.100.0.1 | |
sudo wg show | |
ip route | |
# Test redis connectivity. | |
redis-cli -h 10.100.0.2 -p 6379 ping | |
- name: Pull latest worker image | |
run: docker pull "toxchat/buildfarm-worker" | |
- name: Test connectivity to other nodes | |
run: | | |
ping -c1 10.100.0.1 # server | |
ping -c1 10.100.0.2 # either self or some other node | |
ping -c1 10.100.0.3 # either some other node or self | |
- name: Start worker (detached) | |
if: matrix.node == 2 | |
run: | | |
docker run --detach --privileged --rm -i --network host -v "$PWD/.github/buildfarm/worker-${{ matrix.node }}.yml:/app/build_buildfarm/examples/config.minimal.yml" "toxchat/buildfarm-worker" | |
- name: Start worker | |
if: matrix.node != 2 | |
run: | | |
docker run --privileged --rm -i --network host -v "$PWD/.github/buildfarm/worker-${{ matrix.node }}.yml:/app/build_buildfarm/examples/config.minimal.yml" "toxchat/buildfarm-worker" | |
- name: Start server | |
if: matrix.node == 2 | |
run: | | |
docker pull "toxchat/buildfarm-server" | |
docker run --rm -i --network host -v "$PWD/.github/buildfarm/server-${{ matrix.node }}.yml:/app/build_buildfarm/examples/config.minimal.yml" "toxchat/buildfarm-server" |