Ubuntu linux deployment environment creation

Asked

Viewed 480 times

1

I’m testing a Digital Ocean machine, it comes with Ubuntu linux (I chose), I need to create the following environment

Firewall    
Java
Tomcat7
Jenkins
git
MySQL
MySqlAdmin
Groovy
Gradle

Well, as you can see, I need a complete environment to deploy, I ask, is there a "package" that already installs all this?

I would like to create a "script" that I run and it goes configuring the system to suit this environment, I’ve already done the installation of a good part but I wonder if there is a way to create a script that runs on linux so I don’t have to in the future, install everything manual.

In short, I want to automate the environment configuration process to deploy on Ubuntu linux.

I was testing Openshift, in it I do not need to configure anything, but I’m having difficulties to make Gradle compile groovy, is giving permissions errors, their firewall is blocking, it’s complicated.

If there was also a solution already ready to host in a simple way that had all this would be cool

  • You have a system that is developed that wants every new version to be published automatically in this environment, that’s it?

  • Who does the publishing is Jenkins, I wanted to install all this through a script or if you know some hosting that facilitates an efficient deployment of the application

  • Amazon, take a look here http://answall.com/questions/63042/como-automatizar-o-processo-de-deploy/63051#63051

1 answer

1


I suggest you use the Ansible. It’s exactly what you need, a configuration tool that allows you to configure your servers.

In a simplistic view, Ansible is practically a shell script with its installation and configuration commands, but an important difference, and the reason why you better use Ansible, is that this is idempotent: if you have an Ansible script that installs, for example, the git on your server, and you run this script 8 times, the git will only be installed the first time. The next 7 times Ansible checks that the git is already installed, and it makes no sense to try to install it again. While if you ran a simple shell script to install the git, it would give error and, depending on the case, could even compromise your server.

Ansible is a mature tool, widely used and with several options, so recommend you find a tutorial to your liking on, or else own documentation. Recommend this tutorial.

Below follows a small step-by-step to install only the git on a server. I will not put the full form to install all your programs because that would be monstrous (for the answer and for me :)) and because several of these tools have small details that you should set up in the installation.

Very basic tutorial of Ansible

First important point: you don’t need install Ansible on your server (which you want to configure), only on some other machine (it may be your computer at home) that has access, via SSH, to the server to be configured.

Install Ansible on your machine (I’m assuming it’s Ubuntu):

sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible

Edit the file /etc/ansible/hosts to contain the IP(s) of the server(s) you want to configure (may be more than one):

[web]
192.168.22.10
192.168.22.11

Create a playbook, which is the collection of commands to be executed by the sible. The playbook is a file in format YAML, and must be saved with the extension .yml. Example of a playbook installing the program git on Ubuntu servers:

- hosts: all
  tasks:
    - name: Instalando git
      apt: pkg=git state=installed update_cache=true

apt: pkg=git state=installed update_cache=true indicates that Ansible must run the module apt, which must install the program git, and the final result of the execution is expected to be the git installed (state=installed).

And to execute that playbook, in the type terminal:

$ ansible-playbook -s -k -u USUARIO --ask-become-pass ARQUIVO.yml
  • ansible-playbook is the Ansible command to execute the commands of a plabook;

  • -s indicates that you want the commands to be executed on the server to be executed as sudo;

  • -k indicates that you want to pass the password to log via SSH on the server;

  • -u USUARIO indicates that Ansible must log as USUARIO on the server (if you do not pass this Ansible parameter you will use the same user as your local machine, which is not always the same as the server);

  • --ask-become-pass indicates that you want to enter the password sudo from the server, so that Ansible can execute, in this example, the command sudo apt-get git;

  • ARQUIVO.yml indicates your file playbook.

  • 1

    Despite the time your answer is right, I am today using the Ansible and Docker, but no longer use Java rsrsrsrs, thank God I’m in Python! thanks for the reply!

  • 1

    Actually, the answer arrived a little late :), but at least it is of reference for other people who have the same doubt. And good that you found the light and dropped Java haha.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.