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/...")
 
(start networking)
Line 43: Line 43:
# make netowrking autostart
# make netowrking autostart
rc-update add networking
rc-update add networking
/etc/init.d/networking start


# install and set up ssh
# install and set up ssh

Revision as of 14:15, 7 May 2014

This is how to set up a new build server.

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

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

# 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
/etc/init.d/iptables save
lbu commit

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

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

# set up network:
vi /var/lib/lxc/build-3-0-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.30 netmask 255.255.255.0 gateway 192.168.8.1
# Start container
/etc/init.d/lxc.build-3-0-x86 start

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

# make netowrking autostart
rc-update add networking
/etc/init.d/networking start

# 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-2-7-x86/rootfs/home/buildozer/.abuild /var/lib/lxc/build-3-0-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/

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 "2.7.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.0
REPODEST=$HOME/packages/
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

sudo apk upgrade -U -a

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