How to Build In-House Mobile App Development Enviroment — Part One
Regardless of whether you work in a software house which hires many programmers or if you’re a freelancer, there will come a day when you start wondering how to automate processes in order to deliver more quality products. Let me share my reflections with you on the process of creating mobile apps.
Why am I writing about this? In the previous year, we worked hard in AppUnite to make the development process easier. We tried many solutions and decided to choose the ones who work best for us. We have reached a place where we can safely say that we know a system that suits not only us, developers, but also our project managers and clients. I have also broadened my knowledge when I took freelance commissions, whose sheer number and variety made me think again about the possibility of work automation. That’s why I have decided to share my thoughts on this matter with a broader audience. Each of the presented issues will consist of two parts. In the first part, I will describe assumptions as well as pros and cons, and in the second part I will present a step-by-step guide to creating a solution in your company.
Self Hosted Git
In this part you will learn:
- How to setup your first Dedicated Server
- How to install Docker
- How to install Gitlab
First, you should decide what kind of a server you need. My expectations are as follows: the server will be used for a few commissions a year, it should have the necessary capacity to set up Gitlab, the OwnCloud application (on which I will store files), the company’s website, and a few simple apps hosted on Ruby on Rails.
I’ve decided to buy a DEDIBOX® CLASSIC 2015 server on online.net. The parameters depend on your needs. My server will help me in the process of developing as a freelancer. I have chosen the following parameters:
Processor: Intel® Xeon® E3 1220 v2 4 C / 4T @3.1 Ghz cache L3 8MB, x64, VT
Memory: 16 GB DDR3 ECC Storage: 2 × 1 TB SATA
The process of buying is quite easy. After choosing a server from online.net’s wide offer, you make a payment and wait for an e-mail confirming that your server is ready.
The next step is server installation. There are many options available, the most popular being: debian, ubuntu, centos, coreos, and windows. The system installation is carried out with an installer, which guides you step-by-step through the process. You choose the system, set up the admin password and divide the drive on partitions. Now’s the time to make some good coffee, as the installation will take from a few to several dozen minutes, depending on the system. After finishing the installation, you’ll also receive an e-mail notification. The choice of your server will depend on the type of software you want to set up on it. I’ve decided to user Docker, which will be set up on Ubuntu.
When you’ve installed your system, it’s time for establishing your first server connection. The connection is set up by means of SSH and with login and password credentials you gave when you installed the system. To make the connection with server easier, you can assign an alias to your server’s IP. To do this, you need to edit the /etv/hosts file.
If your IP is 22.214.171.124, then you add the following line in the file:
From now on, you can use the command:
When you connect for the first time, you’ll be asked to give a password. To avoid typing a password every time you want to connect, you need to add the ssh key to authorized_keys on the server. The simplest way to do it is by using the ssh-copy-id tool. You install it by means of this command:
next, you can send your key to the remote server:
and type your user’s ssh password for the last time. Now you can log in to server without giving a password.
First thing that you should do after plugging a server in is a configuration of users’ accounts. To add a new user, you can use an already-existing command adduser:
sudo adduser piotr
You’ll be asked to write user’s credentials. If you want your user to be able to carry out commands with root authority, you need to add the user to a sudoers group. So, we should give a following command:
sudo adduser piotr sudo
or add an existing user with the use of this command:
sudo usermod -a -G sudo piotr
From now on, I will conduct all further operations on the newly-created user level. Another facilitation is giving the user the same name on remote server as you have locally on your mac. Therefore, you don’t have to give your username anymore when establishing a server connection.
Docker allows to manage the so-called Containers. Containers packaging up the application with its configs and dependencies together so the app can be launched on different machines with the same configuration. You don’t have to worry about installation process, because the setup will be always the same. For example, your app created in Ruby on Rails can be a container. To find more about the advantages of Docker, look up their official site, where you will find not only documentation, but also many useful examples. Docker also has a nice community, which will help you find ready-made installations of different kind of software.
Let’s begin with the installation of Docker. I won’t go into detail here, as official documentation contains everything you need:
Apart from the installation of docker-engine, you will also need a docker-compose tool (this tool will be described later):
When you’ve successfully installed docker, you’re ready to install Gitlab.
As I mentioned earlier, the active Docker community helps us find container’s image or a way to install a given app very quickly. Same goes for Gitlab. With the help comes docker-compose. Compose is simple tool that automates installation process. It based on simple .yml files, that describes dependencies and enviroment of newly created container. For Gitlab there is example file that we will be using as our basis. You can get this file directly from your remote server with given command:
Next, you need to adjust gitlab to your needs. I recommend customising a mailer enabling gitlab to send e-mails to users.
All you need to to is configure a SMTP or IMAP -related section. The variables are in the README doc.
When you configure all variables, you launch gitlab by this command:
This comand will install and launch your Gitlab container. If you pass -d parameter container will be launched in background. I suggest first launch without this parameter to check if everything works fine. If you do like this, you will be able to see app output with possible warnings and errors. To check all runing containers you can use:
If app starts without any issue you can try to connect to your Gitlab. All you need to do now is type your server’s IP in a browser and enjoy your own installation of Gitlab.
That’s all in this part, in the next one you’ll find out:
- how to configure Fastlane for iOS projects
- how to configure Gitlab CI for iOS projects
- how to launch Gitlab Runners on mac computers