Building BaasBox on AlpinePosted: Tags: code,baas
I have been wanting to try out a backend as a service. Since Facebook shut down Parse, I wanted to try out an open source solution, if possible. Of all the OSS solutions I read about, BassBox had most of the features that I was looking for.
I also wanted to try out BaasBox on docker with alpine linux, because of it small size. It went easier that I thought. Here are the steps.
1. Install Docker Machine
I'm on Mac and there is no native docker engine for Mac. So I had to install docker machine. I installed docker-machine as detailed in the installation page.
There was one change I made though. I wanted to store the docker machine images on a custom location. I wanted a sure way to backup everything and restore, if I change my machine or reinstall OS. You only have to modify the
.bash_profile to change the location. Add the below line to your
2. Create a dockerfile
It is good practice to keep dockerfiles in a different directory than the docker-machines directory. Create a subdirectory in this directory, for your BaasBox installation. And create a dockerfile.
mkdir baasbox touch Dockerfile
Copy paste this into your dockerfile:
FROM anapsix/alpine-java RUN wget http://www.baasbox.com/download/baasbox-stable.zip RUN unzip -o baasbox-stable.zip # be sure to change this version to the latest RUN chmod 755 baasbox-0.9.5/start EXPOSE 9000 CMD baasbox-0.9.5/start
BaasBox is developed on Java. So I needed to install Java on a base alpine image. Instead of creating from fresh, I based my dockerfile on the already existing alpine-java image from docker hub.
3. Bring up docker container
Now fire up docker container with the following commands. I used the default docker-machine. In case you used a different machine (say baas), then you need to use
eval "$(docker-machine env baas)".
eval "$(docker-machine env default)" docker build -t baasbox .
This will download and install alpine, java and baasbox. Though the image size is small, depending on the bandwidth, it might take sometime to complete all the steps.
Now if you issue,
docker images, you should see baasbox as one of the entry.
REPOSITORY TAG IMAGE ID CREATED SIZE baasbox latest 05288a8127b5 5 hours ago 304.9 MB anapsix/alpine-java latest e7a5071589b8 4 days ago 122 MB alpine 3.3 90239124c352 4 days ago 4.794 MB
Start the container with this command:
docker run -it -p 9000:9000 baasbox
If all went well, now the Baasbox is up and running on the port 9000. It may not be on
localhost. Find the ip address by issuing the command,
echo $(docker-machine ip default). Replace default with whatever name you gave while creating the docker machine. Then browse to
http://<ip>:9000 and you should see default BaasBox login screen. Default credentials for login are,
Like the post? Retweet it. Got comments? Reply.