configuration/hudson_slave_setup/README
... ...
@@ -1,3 +1,5 @@
1 1
Deploy the .mount and .service units to /etc/systemd/system.
2 2
Deploy the imageupgrade script to /usr/local/bin,
3 3
furthermore the ../imageupgrade_functions.sh has to go to /usr/local/bin, best as symbolic link to files in git.
4
+
5
+See the script in wiki/howto/development/ci.md that shows how to set up such an instance from scratch.
configuration/hudson_slave_setup/imageupgrade.service
... ...
@@ -1,7 +1,7 @@
1 1
[Unit]
2 2
Description=Check for image-upgrade EC2 user data and triggers an image upgrade if found
3
-Requires=-.mount cloud-init.service networking.service
4
-After=-.mount cloud-init.service networking.service
3
+Requires=-.mount cloud-init.service
4
+After=-.mount cloud-init.service networking.service systemd-networkd.service
5 5
6 6
[Install]
7 7
WantedBy=multi-user.target
wiki/howto/development/ci.md
... ...
@@ -65,22 +65,32 @@ In order to elastically scale our build / CI infrastructure, we use AWS to provi
65 65
The image has been crafted specifically to contain the tools required for the build (as of this writing in particular Google Chrome, chromedriver and an old Firefox 26.0, plus a current Maven installation and the JDKs required for the build). In order to set up such an image based on Ubuntu, consider running the following commands as root (see also https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/), starting as the "ubuntu" used:
66 66
67 67
```
68
+ scp -o StrictHostKeyChecking=false trac@sapsailing.com:/home/wiki/gitwiki/configuration/imageupgrade_functions.sh /tmp
69
+ scp -o StrictHostKeyChecking=false trac@sapsailing.com:/home/wiki/gitwiki/configuration/hudson_slave_setup/* /tmp
68 70
sudo -i
69 71
apt-get update
70 72
apt-get install -y unzip xvfb libxi6 libgconf-2-4
71 73
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
72 74
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
73 75
apt-get -y update
76
+ apt-get -y upgrade
77
+ apt-get -y autoremove
74 78
apt-get -y install google-chrome-stable
75 79
cd /tmp
76 80
wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
77 81
cd /usr/bin
78 82
unzip /tmp/chromedriver_linux64.zip
79
- exit
80
- scp trac@sapsailing.com:/home/wiki/gitwiki/configuration/imageupgrade_functions.sh /tmp
81
- sudo -i
82
- source /tmp/imageupgrade_functions.sh
83
+ mv /tmp/imageupgrade /usr/local/bin
84
+ mv /tmp/imageupgrade_functions.sh /usr/local/bin
85
+ mv /tmp/mounthudsonworkspace /usr/local/bin
86
+ mv /tmp/*.service /etc/systemd/system/
87
+ source /usr/local/bin/imageupgrade_functions.sh
83 88
download_and_install_latest_sap_jvm_8
89
+ systemctl daemon-reload
90
+ adduser --system --shell /bin/bash --quiet --group --disabled-password hudson
91
+ sudo -u hudson mkdir /home/hudson/.ssh
92
+ echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6TjveiR+KkEbQQcAEcme6PCUHZLLU5ENRCXnXKaFolWrBj77xEMf3RrlLJ1TINepuwydHDtN5of0D1kjykAIlgZPeMYf9zq3mx0dQk/B2IEFSW8Mbj74mYDpQoUULwosSmWz3yAhfLRgE83C7Wvdb0ToBGVHeHba2IFsupnxU6gcInz8SfX3lP78mh4KzVkNmQdXkfEC2Qe/HUeDLdI8gqVtAOd0NKY8yv/LUf4JX8wlZb6rU9Y4nWDGbgcv/k8h67xYRI4YbtEDVkPBqCZux66JuwKF4uZ2q+rPZTYRYJWT8/0x1jz5W5DQtuDVITT1jb1YsriegOZgp9LfS11B7w== hudson@ip-172-31-28-17" >/home/hudson/.ssh/authorized_keys
93
+ sudo -u hudson wget -O /home/hudson/slave.jar "https://hudson.sapsailing.com/jnlpJars/slave.jar"
84 94
```
85 95
86 96
Furthermore, the ephemeral storage is partitioned with a ``gpt`` label into a swap partition with 8GB and the remainder as an ``ext4`` partition mounted under ``/ephemeral/data`` with is then bound with a "bind" mount to ``/home/hudson/workspace``. See the ``/etc/systemd/system/mounthudsonworkspace.service`` systemd service definition on the slave instances. The ``launchhudsonslave`` script launches the instance, checks for it to enter the ``running`` state, then tries to connect using SSH with user ``hudson``. The respective keys are baked into the image and match up with the key stored in ``hudson@hudson.sapsailing.com:.ssh``.