Cloud con Redhat OpenShift Flex: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 160: Line 160:




Double Click in puttygen.
Doble Click en puttygen.


image 11<br />
image 11<br />
[[File:Puttygen_initial.JPG|400px]]
[[File:Puttygen_initial.JPG|400px]]


We leave the default values, SSH-2 RSA, and the number of bits in 2048.
Dejamos los valores por defecto, SSH-2 RSA y el número de bits en 2048.


With these values and will have a key, heavily encrypted.
Con estos valores ya tendremos una key, fuertemente encriptada.


Click en Generate


Image 12<br />
Image 12<br />
[[File:Puttygen_generating.JPG|400px]]
[[File:Puttygen_generating.JPG|400px]]


To generate our key, we must move the mouse pointer constantly in the blank space of program.
Para que genere de nuestra key, debemos mover el puntero del ratón, constantemente en el espacio en blanco del programa.




Line 179: Line 180:
[[File:Puttygen_generate_end.JPG|400px]]
[[File:Puttygen_generate_end.JPG|400px]]


Once our key generation is complete, we will add a passphrase.
Una vez que ha finalizado la generación de nuestra key, tendremos que poner una passphrase.


Click Save public key to save our public key, we give the name of rsa.pub, do the same with save private key, and give the name of rsa.ppk.
Click en Save public key, para guardar nuestra key publica, le damos el nombre de rsa.pub, hacemos lo mismo con Save private key, y le damos el nombre de rsa.ppk.


A public key is like a lock on a door and the private key is like a key that opens the lock.
Una key pública, es como la cerradura de una puerta y la key privada es como la llave que abre esa cerradura.


We mark the generated code in the text area and copy it, then we go to our OpenShift console.
Marcamos el código generado en el área de texto y lo copiamos, luego nos vamos a nuestra consola de OpenShift.




Line 191: Line 192:
[[File:Settings_openshift_copy_public_key.JPG|500px]]
[[File:Settings_openshift_copy_public_key.JPG|500px]]


Paste the code into Paste the contents of your public key file (. Pub) and click Save.
Pegamos el código en Paste the contents of your public key file (.pub) y click en Save.




Line 197: Line 198:
[[File:Settings_openshift_public_key_saved.JPG|500px]]
[[File:Settings_openshift_public_key_saved.JPG|500px]]


Perfect OpenShift now has our lock and we have the key.
Perfecto ahora OpenShift, tiene nuestra cerradura, y nosotros la llave.


Now we go to the Applications tab in our console OpenShift.
Ahora vamos al tab Applications en nuestra consola de OpenShift




Click on our application startdolibarr.
Click sobre nuestra aplicación startdolibarr.


Click in Want to log in to your application?.
Click en Want to log in to your application?.


Image 16<br />
Image 16<br />

Revision as of 21:15, 5 May 2014

This page is a tutorial to explain how to install Dolibarr ERP-CRM on the Redhat OpenShift Flex Platform www.openshift.com

click twice on image to enlarge

Image 1
Url openshift.JPG


Un poco sobre OpenShift

OpenShift plataforma como servicio

OpenShift es Plataforma como Servicio (PaaS) de Red Hat, que permite a los desarrolladores crear rápidamente aplicaciones escalables host, en un entorno de nube. Con OpenShift tienes elección de ofertas, en línea, en la premisa, y las opciones de proyectos de código abierto.

OpenShift brinda ayuda para construir y desplegar aplicaciones web, backends móviles, arquitecturas orientadas a servicios, y recibe sus servicios favoritos.

Openshfit trabaja con Gears y Cartridges, que son términos, con los que tendremos que familiarizarnos.


Que es un Gear?
Un gear es un contenedor de recursos limitados que se ejecuta una o más pilas de software especificados por el usuario, también conocidas como cartridges. Cada gear tiene una cantidad limitada de memoria RAM y espacio en disco. Si una aplicación necesita más recursos, puede ser configurado para utilizar automáticamente más gears.


¿Cómo trabajan los Gears?
Echemos un vistazo a una aplicación de ejemplo basada en Drupal que se ejecuta en OpenShift. Podemos estimar las necesidades y los costos de la aplicación en las diferentes etapas.

15 páginas / segundo Cientos de artículos ~ 50k visitantes por mes 3 pequeños engranajes Plan Libre

Como vemos, un plan libre, puede ser suficiente, para una Empresa pequeña o mediana. Para empresas más grandes, se puede cambiar al plan siguiente.


En OpenShift, tenemos dos posibilidades claras, para poner en marcha Dolibarr.

1.- Como desarrolladores, nos da la posibilidad de extender o crear nuestros propios módulos.
2.- Como empresarios, nos da la posibilidad de poner en producción nuestro DoliBarr.


Ventajas que nos ofrece OpenShift

Es un sitio seguro, al cual se accede a través de SSH.

Es escalable Aplicación de escala permite que la aplicación reaccionar a los cambios en el tráfico y automáticamente asignar los recursos necesarios para manejar su demanda actual. La infraestructura OpenShift monitorea el tráfico de Internet entrante y automáticamente trae copias de su cartucho de Web en línea para manejar las peticiones.

Nos da control total, sobre nuestra base de datos, para conectarnos remotamente a través de un cliente GUI como HeidySQL.

En caso de decantarnos por MySql, tenemos a disposición, el motor InnoDB, imprescindible para transacciones.

Nos da la posibilidad, de compartir Certificados SSL de RedHat o personalizar nuestro propio SSL, en caso de tenerlo. Imprescindible, para enviar nuestros datos, tanto de logín o de transferencias bancarias, encriptadas y seguras.

Dicho todo esto, comencemos, la puesta en marcha de nuestra aplicación DoliBarr.

Create an account

Click en SIGN UP

Image 2
Sing up.JPG

Rellenamos nuestros datos, para crear una cuenta. Click en Sign Up


Image 3
Verify your account with OpenShift Online.JPG

Nos enviaran, un email, a nuestra cuenta de correo, para confirmar.

Cree una instancia

Parte 1 - Creando una instancia

Click en LOG IN nuevamente y nos mostrara el aspecto inicial de nuestra Consola de Aplicaciones.

Image 4
Control panel openshift account.JPG

Click en Create your first application now


Elija un cartucho de programación web

Image 5
PHP apart.JPG

1. Busque el tipo de aplicación


Image 6
Configure de application.JPG

2. Configure la aplicación.

Es importante, definir bien el nombre de dominio, para este tutorial, hemos usado sdme. El domino, no se puede cambiar más a menos que, borremos todas nuestras aplicaciones y empecemos nuevamente de cero y eso es algo que a nadie quiere.

También, tendremos que informar, si tenemos un repositorio externo Git, con nuestro código.


Aquí viene lo divertido.

En scaling cambiaremos a Scale with web traffic.

La creación de esta aplicación, usara un Gear de los 3 que disponemos, lo indica justamente, al lado del botón Create Application.

Click en Create Application.

Image 7
Console startdolibarr Application.JPG

Cuando la aplicación es escalable, no se puede añadir más Cartridges, al Gear. Por ejemplo sí queremos usar MySql, deberá ir aparte, en otro Gear.

En la imagen, de arriba, vemos que a nuestro Gear, se ha añadido el balanceador de carga, que hará nuestra aplicación escalable.

Arriba en el extremo derecho, existe también un botón, por si necesitamos reiniciar el Gear.

Nota.- Con PuTTY, podríamos solventar necesidades más explicitas, para controlar nuestros Gears, con línea de comandos.


Click en el enlace Web load Balancer.

Image 8
HAProxy.JPG

HAProxy en Acción.

Image 9
Aspect your webpage.JPG

Si vemos nuestra url startdolibarr-sdme.rhcloud.com este es el aspecto inicial, que tiene.


Parte 2 - Configuración de Herramientas de administración

Hasta aquí todo bien. Ahora, pasemos a la segunda parte, de nuestro tutorial.

Para esta parte, que será la referida a la administración de nuestra aplicación, existen dos caminos, el primero es por CLI (línea de comandos basado en Ruby) y el segundo, de forma más declarativa, por consola y con SSH.

Para este tutorial, he elegido la forma más fácil he intuitiva, que es la segunda opción.


Manos a la obra.

Necesitamos un cliente SSH/FTP como WinSCP y PuTTY.

Los Bajamos y los instalamos.

Image 10
Folder WinSCP - PUTTY.JPG

Dentro la carpeta donde se instaló WinSCP, encontraremos la carpeta PuTTY y dentro de esta carpeta, el programa puttygen.exe, este programa es importante, ya que, es el que nos ayudara a generar nuestro acceso SSH, para conectarnos a nuestro Gear.


Doble Click en puttygen.

image 11
Puttygen initial.JPG

Dejamos los valores por defecto, SSH-2 RSA y el número de bits en 2048.

Con estos valores ya tendremos una key, fuertemente encriptada.

Click en Generate

Image 12
Puttygen generating.JPG

Para que genere de nuestra key, debemos mover el puntero del ratón, constantemente en el espacio en blanco del programa.


Image 13
Puttygen generate end.JPG

Una vez que ha finalizado la generación de nuestra key, tendremos que poner una passphrase.

Click en Save public key, para guardar nuestra key publica, le damos el nombre de rsa.pub, hacemos lo mismo con Save private key, y le damos el nombre de rsa.ppk.

Una key pública, es como la cerradura de una puerta y la key privada es como la llave que abre esa cerradura.

Marcamos el código generado en el área de texto y lo copiamos, luego nos vamos a nuestra consola de OpenShift.


Image 14
Settings openshift copy public key.JPG

Pegamos el código en Paste the contents of your public key file (.pub) y click en Save.


Image 15
Settings openshift public key saved.JPG

Perfecto ahora OpenShift, tiene nuestra cerradura, y nosotros la llave.

Ahora vamos al tab Applications en nuestra consola de OpenShift


Click sobre nuestra aplicación startdolibarr.

Click en Want to log in to your application?.

Image 16
SourceCode and Remote Access.JPG

Copy the code ssh 53641a41e0b8cdf5ec000b76@startdolibarr-sdme.rhcloud.com


We opened our WinSCP.

Image 17
Login WinSCP.JPG

We put the first part, 53641a41e0b8cdf5ec000b76 before the @ in the User name field, and the second part, startdolibarr-sdme.rhcloud.com after the @ in the Host name field.

It is advisable not to place the password / passphrasse, at this point, for security reasons. We'll use it later.

Click in Advanced.


Image 18
Login WinSCP SSH private Key.JPG

In Private key file: select your private key rsa.ppk, click OK, click save, and click Login.


Image 19
Warning connect to WinSCP.JPG

When we leave this nice window click Yes.


Image 20
WinSCP login passphrasse.JPG

Here we place our passphrase and click OK.


Image 21
Session WinSCP accept.JPG

Viola we have access via SSH to our Gear.

On the left is our local space and right remote.


Submit Dolibarr files

Image 22
Download Dolibarr generic version.JPG

We went down the generic version of Doibarr.


Image 23
Uploading DoliBarr into repo.JPG

In the remote part, selected route /var/lib/openshift/53641a41e0b8cdf5ec000b76/app-root/runtime/repo

Transfer the Dolibarr folder on the local machine to OpenShift, pressing F5. This process may take several minutes, so while we wait, we will work to create our Gear for the database.


Image 24
Add MySQL 5.5.JPG

We return to the console and with our OpenShift application selected, we click on the bottom of the Databases section and select Add MySQL 5.5


Image 25
Add Cartridge MySL to startdolibarr.JPG

Click in add Cartridge.

Note -. In a normal application without Scale, the Cartridge Mysql be added to current Gear, but in our case, OpenShift reports that will address a new Gear for MySQl.


Image 26
Add MySQL Please make note of these credentials.JPG

Copy the MySQL access credentials. They will be used later to access our data base.


Image 27
Delete Index php.JPG

Once you have completed the upload of dolibarr described in picture 23. Edit the index.php file.

We opened our favorite text editor and replace with the following code.

<?php
header("Location: dolibarr/htdocs");
?>

We make a copy of index.php in dolibarr folder and re-edit it and remove dolibarr/.

<?php
header("Location: htdocs");
?>


Image 28
Index php inside dolibarr folder.JPG

What we have just done, serves don't shown the structure our folders and files of dolibarr from the web browser, with the index.php we force redirect to the home of Dolibarr.

Finally, before starting the configuration of dolibarr, should use SSL (encryption protocol), which provides security when sending our data from the web browser to the server. The use of SSL provides plus extra measures of the dolibarr security, which are already good.

We opened our text editor again and add the following.

Save with the name .htaccess right next to our dolibarr folder and index.php.

As shown in the following image.


Image 29
Add htaccess.JPG

HttpAndhttps.JPG


Image 30
Dolibarr con SSL.JPG

Image 31
Dolibarr con SSL unfoll.JPG

We see the SSL certificate is accepted by the browser.


Run Dolibarr install Wizard

We start the Dolibarr setup.

We select from the drop down, Default language to use (language code):, the appropriate language and click Next step.


Image 32
Start Install.JPG

Click in start.


Image 33
Environment Variables conextion MySQL.JPG

We review the image 26, when we created the MySQL Cartridge.

And we focus on the lines.

  • Root User: adminCRERXju
  • Root Password: tccRTZ8-xCnK
  • Database Name: startdolibarr
  • Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/


To create the connection to the database, OpenShift gives us some environment variables. For dolibarr can connect to the database, we need to know the value of these variables, so back to WinSCP and the .env/mysql folder find these variables, as shown in the picture above.

Click the right mouse button on OPENSHIFT_MYSQL_DB_HOST, click on edit and show us the value of the variable, copy and paste into the Server field as shown in the image below. We do the same for OPENSHIFT_MYSQL_DB_PORT variable and paste its value in the Port field.


Image 34
Create DDBB in configure DoliBarr.JPG

Note.- When you will these follow steps for the host and port for your particular installation, should be different than shown in this example.

Note2. - In this step, we also could create a different data base and a different owner, because be have the superuser credentials of MySQL, but this step does not touch it here today.

Click Next Step and displays the following window.


Image 35
Confirm configuration.JPG

This screen basically tells us that the connection to the database has been established and this information is saved in the configuration file conf.php of dolibarr.

Click Next Step and start creating tables in the database, necessary for the work of Dolibarr.


Image 36
Database susetfull created.JPG

This screen reports that have completed the creation of the tables.

Click in Next step.


Image 37
Insert admin credentials.JPG

We fill the fields with the username and password, which will be the administrator, for this example I used admin/admin. For the real case should be a stronger password.

Click in Next step.


Image 38
End of setup.JPG

Click in Go to Dolibarr (setup area).


Image 39
Insert admin credentials.JPG

Insert the username and password of the administrator, as defined above and Viola. We are within Dolibarr.


Appendix: Connection remote MySQL

As a final step, we will see the connection from a local client database, to our remote MySQL.

For this example I will use HeidiSQL, which serves both MySQL or PostgreSQL database and is Free.

Open HeidiSQL.

The first thing to do is select MySQL (SSH tunnel) Network type drop down, in so doing, HeidiSQL adds a new tab called SSH tunnel, as shown in the image below.


Image 41
Ssh tunnel HeidiSQL.JPG

Note that, in the plink.exe location: field must specify the path PuTTY.exe, in the Password field entered the passphrase and Local Port field should always be in 3307.

We return to the Settings tab.


Image 42
Settings heidisql.JPG

We fill the fields with the credentials of the database, select the database, click in Save and click in Open to test the connection.

Image 43
HeidiSQL has established connection.JPG

And with that we end this tutorial.