Wikimedia Release Engineering Team/TrainDev

From mediawiki.org

What is train-dev?[edit]

Train-dev is an environment for developing scap and testing mediawiki deployments. It is composed of a mirror of many gerrit repos and well as several docker containers which serve as facsimiles for production hosts such as deploy, gerrit, mwdebug, web, and database servers. Minikube is used for testing Kubernetes deployments.

Browse the source code: https://gitlab.wikimedia.org/repos/releng/train-dev

Digital Ocean setup walkthrough[edit]

  • Visit digitalocean.com
  • Log in w/ your WMF account.
  • Click "+ New Project" to create a project for yourself if you do not already have one.
  • Inside your project click the green Create button.
  • Select Droplets.
  • Select Debian 11 x64 as the image.
  • Select a "Basic" plan and choose a droplet configuration with at least 8GB RAM, 4 CPUs.
  • Choose a datacenter that is near you.
  • Add your ssh keys.
  • Enable Monitoring
  • Give the droplet a useful name.
  • Create the droplet under your project.
  • Collect the IP address of your droplet and ssh root@<address>.
  • Install some packages.
apt update && apt install -y git docker.io docker-compose make rsync
  • Install minikube:
curl -L -o /usr/local/bin/minikube \
  https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x /usr/local/bin/minikube
  • Create an unprivileged account for yourself:
unpriv=jimmy # Change to your desired username
useradd -m -s /bin/bash -G sudo,docker $unpriv
mkdir /home/$unpriv/.ssh
cp /root/.ssh/authorized_keys /home/$unpriv/.ssh
chown -R $unpriv: /home/$unpriv/.ssh
  • Ssh into the droplet using your unprivileged account.
  • Run:
git clone https://gerrit.wikimedia.org/r/mediawiki/tools/train-dev
cd train-dev
# Build the train-dev environment. Time estimate: ~20 minutes
time ./train-dev build ~/traindevwork
  • Log into the deploy container:
./train-dev ssh deploy