Difference between revisions of "User:Ncopa/buildserver"

From Alpine Linux
Jump to: navigation, search
(update to v3.1)
Line 127: Line 127:
# make sure aports-build autostarts and start it
# make sure aports-build autostarts and start it
rc-update add mqtt.aports-build
rc-update add mqtt-exec.aports-build
/etc/init.d/mqtt.aports-build start
/etc/init.d/mqtt-exec.aports-build start

Revision as of 07:12, 12 November 2014

This is how to set up a new build server.

# Create the container
lxc-create -n build-3-1-x86 -t alpine -- --arch x86 --release edge

# Make it autostart
ln -s lxc /etc/init.d/lxc.build-3-1-x86 && rc-update add lxc.build-3-1-x86

# setup ip forward for ssh
iptables -t nat -A PREROUTING -d -p tcp -m tcp --dport 22031 -j DNAT --to-destination
/etc/init.d/iptables save
lbu commit

# Create missing dir
mkdir /var/lib/lxc/build-3-1-x86/rootfs/var/cache/distfiles

# copy authorized_keys:
cp -a /var/lib/lxc/build-3-0-x86/rootfs/root/.ssh /var/lib/lxc/build-3-1-x86/rootfs/root/

# set up network:
vi /var/lib/lxc/build-3-1-x86/rootfs/etc/network/interfaces

Contents of /etc/network/interfaces

auto lo iface lo inet loopback auto eth0 iface eth0 inet static address netmask gateway
# Start container
/etc/init.d/lxc.build-3-1-x86 start

# log in as root
lxc-console -n build-3-1-x86

# make netowrking autostart
rc-update add networking

# install and set up ssh
apk add openssh
rc-update add sshd
/etc/init.d/sshd start
mkdir /root/.ssh
cat > /root/.ssh/authorized_keys
# paste the ssh keys and ctrl-d

# logout

#and detach from console: ctrl-a q

Log in via ssh.

# install alpine-sdk, sudo and aports-build
apk add alpine-sdk sudo aports-build

# make users in %wheel group rin commands without passwd

# create buildozer user (with good passwd)
adduser buildozer
addgroup buildozer abuild

From host, copy over buildozer keys from other build server:

cp -a /var/lib/lxc/build-3-0-x86/rootfs/home/buildozer/.abuild /var/lib/lxc/build-3-1-x86/rootfs/home/buildozer/ cp -a /var/lib/lxc/build-3-0-x86/rootfs/home/buildozer/.ssh /var/lib/lxc/build-3-1-x86/rootfs/home/buildozer/

You should now be able to log in via ssh as buildozer.

# clone aports and alpine-iso
git clone git://git.alpinelinux.org/aports
git clone git://git.alpinelinux.org/alpine-iso

# setup alpine-iso previous:
echo "3.0.0" > alpine-iso/previous

sudo vi /etc/abuild.conf

export JOBS=24                          
export MAKEFLAGS="-j$JOBS -l$JOBS"
PACKAGER="Buildozer <alpine-devel@lists.alpinelinux.org>"

# as buildozer, bootstrap the toolchain:
cd ~/aports/main
for i in $(ap recursdeps musl binutils gcc make patch | xargs ap builddirs); do (cd $i && abuild -r)||break; done

# set up repositories to only use selfbuilt packages:
echo "/home/buildozer/packages/main" > /etc/apk/repositories

# replace toolchain
sudo apk upgrade -U -a

# config aports build:
vi /etc/conf.d/mqtt.aports-build

# not all builds on musl, keep going
buildrepo="buildrepo -p -s -k -l /var/cache/distfiles/buildlogs/$(hostname)"

# create dir for buildlogs
mkdir -p /var/cache/distfiles/buildlogs/build-3-1-x86

# make sure ssh works to rsync.alpinelinux.org and that the dirs exists there:
ssh rsync.alpinelinux.org
cd alpine/v3.1
mkdir -p main/x86 main/x86_64 main/armhf releases/x86 releases/x86_64 releases/armhf

# make sure aports-build autostarts and start it
rc-update add mqtt-exec.aports-build
/etc/init.d/mqtt-exec.aports-build start