So you want one of these magic cheap cloud servers to do handle unit testing and building your Android app? Makes sense if you have a cross platform approach; the tests need to run automatically on each platform. And some of us need to do more customization than the millions of cloudy IDEs let us do (like install an Ubuntu package even)
Problem 1: Amazon AWS (and the like) servers are virtual themselves and performance will be awful. So bad in fact that Cordova's default timeouts will be exceeded. So you need a real server; in fact with many providers (e.g. Hetzner) they are cheaper for the same performance than what Amazon provides.
Problem 2: Google can make an OS that's on a billion devices. What they apparently cannot do is maintain documentation on installing an SDK and it's actual requirements.
Problem 3: Ubuntu minimal (what you normally get with a cloud server) and the Android emulator do not play ball. You will get strange meaningless error messages like can't load swrast. glxinfo will segfault.
...Wait for server to restart with the lightdm desktop manager running, login as root, and then...
Note: VNC itself does not use encryption. You'll need to use a VPN like OpenVPN for that.
Problem 1: Amazon AWS (and the like) servers are virtual themselves and performance will be awful. So bad in fact that Cordova's default timeouts will be exceeded. So you need a real server; in fact with many providers (e.g. Hetzner) they are cheaper for the same performance than what Amazon provides.
Problem 2: Google can make an OS that's on a billion devices. What they apparently cannot do is maintain documentation on installing an SDK and it's actual requirements.
Problem 3: Ubuntu minimal (what you normally get with a cloud server) and the Android emulator do not play ball. You will get strange meaningless error messages like can't load swrast. glxinfo will segfault.
Solution
Take an Ubuntu 14.04 real dedicated server, add the full ubuntu desktop, add a few extra packages, then use VNC to login exactly as you would 'normally'
$ apt-get update && apt-get install ubuntu-desktop
$ apt-get install x11vnc
$ adduser <someusername>
$ init 6
...Wait for server to restart with the lightdm desktop manager running, login as root, and then...
$ x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepwNow use a VNC client to connect to display 0 using the public IP address of the server: you should be able to connect and see the 'normal' ubuntu login. You can now login with the username created before.
Note: VNC itself does not use encryption. You'll need to use a VPN like OpenVPN for that.
Now use another SSH connection to install what's needed for Jenkins:
Add a line so you can login with a graphical desktop as jenkins :
Restart lightdm to enable the change (this will cut your VNC session):
Re-run the VNC service:
Login to the server as jenkins using vnc now and use firefox to download the android development toolkit as you would on a normal laptop/desktop. Before you run it (as root); add the packages Android needs:
Add Jenkins to the KVM group needed to run android vms at a reasonable speed:
Now use the android command to install the components as normal and android avd to setup virtual devices. I recommend not using super screen resolutions:
Now for continuous integration purposes; you'll need to make sure the system is logged in and add this to your scripts before they need something that launches a window:
References + Thanks:$ apt-get install openjdk-7-jdk $ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - $ echo 'deb http://pkg.jenkins-ci.org/debian binary/' > /etc/apt/sources.list.d/jenkins.list $ apt-get update && apt-get install jenkins
$ nano /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
Add a line so you can login with a graphical desktop as jenkins :
greeter-show-manual-login=true
Restart lightdm to enable the change (this will cut your VNC session):
$ service lightdm restart
Re-run the VNC service:
$ x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepw
Login to the server as jenkins using vnc now and use firefox to download the android development toolkit as you would on a normal laptop/desktop. Before you run it (as root); add the packages Android needs:
$ dpkg --add-architecture i386 $ apt-get update $ apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
$ #install these packages that google didn't tell you about to avoid no such file or directory mystery error message
$ apt-get install libc6:i386 libstdc++6:i386 lib32z1
Add Jenkins to the KVM group needed to run android vms at a reasonable speed:
$ adduser jenkins libvirtd $ adduser jenkins kvm
Now use the android command to install the components as normal and android avd to setup virtual devices. I recommend not using super screen resolutions:
export DISPLAY=:0 && export XAUTHORITY=/home/$USER/.Xauthority
No comments:
Post a Comment