User:Ncopa/buildserver: Difference between revisions

From Alpine Linux
(Created page with "This is how to set up a new build server. <pre> # Create the container lxc-create -n build-3-0-x86 -t alpine -- --arch x86 --release edge # Make it autostart ln -s lxc /etc/...")
 
(fix mqtt-exec)
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
<pre>
<pre>
# Create the container
# Create the container
lxc-create -n build-3-0-x86 -t alpine -- --arch x86 --release edge
lxc-create -n build-3-1-x86 -t alpine -- --arch x86 --release edge


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


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


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


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


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


Line 29: Line 29:
auto eth0
auto eth0
iface eth0 inet static
iface eth0 inet static
address 192.168.8.30
address 192.168.8.31
netmask 255.255.255.0
netmask 255.255.255.0
gateway 192.168.8.1
gateway 192.168.8.1
Line 36: Line 36:
<pre>
<pre>
# Start container
# Start container
/etc/init.d/lxc.build-3-0-x86 start
/etc/init.d/lxc.build-3-1-x86 start


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


# make netowrking autostart
# make netowrking autostart
Line 74: Line 74:


From host, copy over buildozer keys from other build server:
From host, copy over buildozer keys from other build server:
{{cmd|cp -a /var/lib/lxc/build-2-7-x86/rootfs/home/buildozer/.abuild /var/lib/lxc/build-3-0-x86/rootfs/home/buildozer/
{{cmd|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-2-7-x86/rootfs/home/buildozer/.ssh /var/lib/lxc/build-3-0-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/
}}
}}


Line 86: Line 86:


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




Line 94: Line 94:
export MAKEFLAGS="-j$JOBS -l$JOBS"
export MAKEFLAGS="-j$JOBS -l$JOBS"
#USE_COLORS=1
#USE_COLORS=1
SRCDEST=/var/cache/distfiles/v3.0
SRCDEST=/var/cache/distfiles/v3.1
REPODEST=$HOME/packages/
PACKAGER="Buildozer <alpine-devel@lists.alpinelinux.org>"
PACKAGER="Buildozer <alpine-devel@lists.alpinelinux.org>"


Line 103: Line 102:
for i in $(ap recursdeps musl binutils gcc make patch | xargs ap builddirs); do (cd $i && abuild -r)||break; done
for i in $(ap recursdeps musl binutils gcc make patch | xargs ap builddirs); do (cd $i && abuild -r)||break; done


sudo apk upgrade -U -a


# set up repositories to only use selfbuilt packages:
# set up repositories to only use selfbuilt packages:
echo "/home/buildozer/packages/main" > /etc/apk/repositories
echo "/home/buildozer/packages/main" > /etc/apk/repositories
# replace toolchain
sudo apk upgrade -U -a
# config aports build:
vi /etc/conf.d/mqtt-exec.aports-build
upload_release=v3.1
release_formats="iso"
# 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
exit
# make sure aports-build autostarts and start it
rc-update add mqtt-exec.aports-build
/etc/init.d/mqtt-exec.aports-build start
</pre>
</pre>

Latest revision as of 07:13, 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 91.220.88.21/32 -p tcp -m tcp --dport 22031 -j DNAT --to-destination 192.168.8.31:22
/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 192.168.8.31 netmask 255.255.255.0 gateway 192.168.8.1
# 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
exit

#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
visudo

# 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"
#USE_COLORS=1
SRCDEST=/var/cache/distfiles/v3.1
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-exec.aports-build

upload_release=v3.1
release_formats="iso"
# 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
exit

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