From 6646d4c924565d03f58eb2ed402e84eb74554acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 1 Mar 2019 12:45:50 +0100 Subject: [PATCH] Fix links to local installation --- .../en/getting_started/prerequisites/linux.md | 162 +++++++++++++ .../en/getting_started/prerequisites/macos.md | 2 +- .../es/getting_started/prerequisites/linux.md | 216 ++++++++++++++++++ .../es/getting_started/prerequisites/macos.md | 2 +- 4 files changed, 380 insertions(+), 2 deletions(-) create mode 100644 docs/en/getting_started/prerequisites/linux.md create mode 100644 docs/es/getting_started/prerequisites/linux.md diff --git a/docs/en/getting_started/prerequisites/linux.md b/docs/en/getting_started/prerequisites/linux.md new file mode 100644 index 000000000..52a7aa9cf --- /dev/null +++ b/docs/en/getting_started/prerequisites/linux.md @@ -0,0 +1,162 @@ +# Configuration for development and test environments (GNU/Linux) + +## Git + +Git is officially maintained in Debian/Ubuntu: + +``` +sudo apt-get install git +``` + +## Ruby + +Ruby versions packaged in official repositories are not suitable to work with consul (at least Debian 7 and 8), so we'll have to install it manually. + +The preferred method is via rvm: + +(only the multi user option installs all dependencies automatically, as we use 'sudo'.) + +### As local user + +``` +curl -L https://get.rvm.io | bash -s stable +``` + +### For all system users + +``` +curl -L https://get.rvm.io | sudo bash -s stable +``` + +and then add your user to rvm group + +``` +sudo usermod -a -G rvm +``` + +and finally, add rvm script source to user's bash (~/.bashrc) (this step it's only necessary if you still can't execute rvm command) + +``` +[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm +``` + +with all this, you are suppose to be able to install a ruby version from rvm, as for example version 2.3.0: + +``` +sudo rvm install 2.3.0 +``` + +## Bundler + +with + +``` +gem install bundler +``` + +or there is more methods [here](https://rvm.io/integration/bundler) that should be better as: + +``` +gem install rubygems-bundler +``` + +## Node.js + +To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. As with Ruby, we don't recommend installing Node from your distro's repositories. + +To install it, you can use [n](https://github.com/tj/n) + +Run the following command on your terminal: + +``` +curl -L https://git.io/n-install | bash -s -- -y lts +``` + +And it will install the latest LTS (Long Term Support) Node version on your `$HOME` folder automatically (This makes use of [n-install](https://github.com/mklement0/n-install)) + +## PostgreSQL (>=9.4) + +PostgreSQL version 9.4 is not official in debian 7 (wheezy), in 8 it seems to be officially maintained. + +So you have to add a repository, the official postgresql works fine. + +Add the repository to apt, for example creating file */etc/apt/sources.list.d/pgdg.list* with: + +``` +deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main +``` + +afterwards you'll have to download the key, and install it, by: + +``` +wget https://www.postgresql.org/media/keys/ACCC4CF8.asc +apt-key add ACCC4CF8.asc +``` + +and install postgresql + +``` +apt-get update +apt-get install postgresql-9.4 +``` + +## ChromeDriver + +To run E2E integration tests, we use Selenium along with Headless Chrome. + +On Debian-based distros, the process to get ChromeDriver up and running is not as straightforward as on Mac OS. + +To get it working, first install the following packages: + +```bash +sudo apt-get update && sudo apt-get install libxss1 libappindicator1 libindicator7 unzip +``` + +Then you need either Google Chrome or Chromium installed, both are valid. + +You can download the former from [here](https://www.google.com/chrome/index.html), while the latter can be installed with the following command: + +```bash +sudo apt-get install chromium +``` + +You can now proceed to install ChromeDriver. First, check out its latest version [here](https://sites.google.com/a/chromium.org/chromedriver/) + +Download it the following way: + +```bash +wget -N http://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip +``` + +Unzip it and make it executable like this: + +```bash +unzip chromedriver_linux64.zip +chmod +x chromedriver +``` + +Finally, add the binary to your `$PATH`: + +```bash +sudo mv -f chromedriver /usr/local/share/chromedriver +sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver +sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver +``` + +Make sure everything's working as expected by running the following command: + +```bash +chromedriver --version +``` + +You should receive an output with the latest version of ChromeDriver. If that's the case, you're good to go! + +If you happen to be on an Arch-based distro, installing `chromium` from the `extra` repo will do. + +There's also the option to only install ChromeDriver from AUR. If you're using `pacaur`, this will do: + +```bash +pacaur -S chromedriver +``` + +> Now you're ready to go get Consul [installed](../local_installation.html)!! diff --git a/docs/en/getting_started/prerequisites/macos.md b/docs/en/getting_started/prerequisites/macos.md index b10dfb914..9b932fd34 100644 --- a/docs/en/getting_started/prerequisites/macos.md +++ b/docs/en/getting_started/prerequisites/macos.md @@ -106,4 +106,4 @@ brew install chromedriver brew install imagemagick ``` -> Now you're ready to go get Consul [installed](../installation.html)!! +> Now you're ready to go get Consul [installed](../local_installation.html)!! diff --git a/docs/es/getting_started/prerequisites/linux.md b/docs/es/getting_started/prerequisites/linux.md new file mode 100644 index 000000000..e67ad1175 --- /dev/null +++ b/docs/es/getting_started/prerequisites/linux.md @@ -0,0 +1,216 @@ +# Configuración para los entornos de desarrollo y pruebas (GNU/Linux) + +## Git + +Git es mantenido oficialmente en Debian/Ubuntu: + +``` +sudo apt-get install git +``` + +## Ruby + +Las versiones de Ruby versions empaquetadas en repositorios oficiales no son aptas para trabajar con consul (al menos Debian 7 y 8), así que debemos instalar manualmente. + +El método recomendado es via rvm: + +(sólo la opción multiusuario instala todas las dependencias automáticamente, al usar 'sudo'.) + +### Como usuario local + +``` +curl -L https://get.rvm.io | bash -s stable +``` + +### Para todos los usuarios del sistema + +``` +curl -L https://get.rvm.io | sudo bash -s stable +``` + +añadismos nuestro usuario al grupo de rvm + +``` +sudo usermod -a -G rvm +``` + +y finalmente, añadimos el script rvm a nuestro bash (~/.bashrc) (este paso sólo es necesario si no puedes ejecutar el comando rvm) + +``` +[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm +``` + +con todo esto, deberías poder instalar la versión de ruby con rvm, por ejemplo la 2.3.2: + +``` +sudo rvm install 2.3.2 +``` + +## Bundler + +usando + +``` +gem install bundler +``` + +hay varios métodos alternativos [aquí](https://rvm.io/integration/bundler) que podrían ser mejores como: + +``` +gem install rubygems-bundler +``` + +## Node.js + +Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada. Al igual que como ocurre con Ruby, no es recomendable instalar Node directamente de los repositorios de tu distribución Linux. + +Para instalar Node, puedes usar [n](https://github.com/tj/n) + +Ejecuta el siguiente comando en tu terminal: + +``` +curl -L https://git.io/n-install | bash -s -- -y lts +``` + +Y este instalará automáticamente la versión LTS (_Long Term Support_, inglés para "Soporte a largo plazo") más reciente de Node en tu directorio `$HOME` (Este comando hace uso de [n-install](https://github.com/mklement0/n-install)) + +## PostgreSQL (>=9.4) + +La versión 9.4 de PostgreSQL no es oficial en Debian 7 (wheezy), pero en Debian 8 parece ser mantenida oficialmente. + +Así que debemos añadir el respositorio oficial de postgresql a apt, por ejemplo creando el fichero */etc/apt/sources.list.d/pgdg.list* con: + +``` +deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main +``` + +después deberás descargar la key e instalarla: + +``` +wget https://www.postgresql.org/media/keys/ACCC4CF8.asc +apt-key add ACCC4CF8.asc +``` + +y finalmente instalar postgresql + +``` +apt-get update +apt-get install postgresql-9.4 +``` + +## Clonar el repositorio + +Ahora que ya tenemos todas las dependencias instalado podemos bajarnos el proyecto: + +``` +git clone https://github.com/consul/consul.git +cd consul +bundle install +cp config/database.yml.example config/database.yml +cp config/secrets.yml.example config/secrets.yml +``` + +Ahora copia en `database.yml` el usuario y la contraseña que pusiste para *consul*. Cuando ya lo hayas hecho: + +``` +rake db:create +rake db:setup +rake db:dev_seed +RAILS_ENV=test bin/rake db:setup +``` + +Para ejecutar los tests: + +``` +bundle exec rspec +``` + +Quizás necesites crear un rol de superusuario en postgresql, y completar en el fichero*/config/database.yml* los campos 'user:' y 'password:'. + +Además, parece que postgresql usa un socket unix por defecto para las comunicaciones en local. Si te encuentras este problema creando la base de datos, cambia en */config/database.yml* la linea: + +``` +host: localhost +``` + +por: + +``` +host: /var/run/postgresql +``` + +Tras esto en el terminal ejecutaremos: + +``` +rake db:create +rake db:setup +rake db:dev_seed +RAILS_ENV=test bin/rake db:setup +``` + +Y por último para comprobar que todo esta bien, lanza los tests: + +``` +bundle exec rspec +``` + +## ChromeDriver + +Para realizar pruebas de integración, usamos Selenium junto a Headless Chrome. + +En distribuciones basadas en Debian, el proceso de instalar ChromeDriver no es tan sencillo como en Mac OS. + +Para ello, primero instala los siguientes paquetes: + +```bash +sudo apt-get update && sudo apt-get install libxss1 libappindicator1 libindicator7 unzip +``` + +Ahora necesitarás Google Chrome o Chromium. Ambas opciones son válidas. + +Puedes instalar el primero haciendo click [acá](https://www.google.com/chrome/index.html), mientras que el segundo puede ser instalado de la siguiente manera: + +```bash +sudo apt-get install chromium +``` + +Ahora puedes instalar ChromeDriver. Primero, comprueba su última versión haciendo click [acá](https://sites.google.com/a/chromium.org/chromedriver/) + +Descárgalo ejecutando el siguiente comando: + +```bash +wget -N http://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip +``` + +Descomprimelo y hazlo ejecutable: + +```bash +unzip chromedriver_linux64.zip +chmod +x chromedriver +``` + +Finalmente, añade el binario a tu `$PATH`: + +```bash +sudo mv -f chromedriver /usr/local/share/chromedriver +sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver +sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver +``` + +Asegúrate de que todo funciona como es debido ejecutando el siguiente comando: + +```bash +chromedriver --version +``` + +Deberías recibir un mensaje indicando la última versión de ChromeDriver. Si ese es el caso, está todo listo + +Si te encuentras usando una distro basada en Arch, instalando `chromium` desde el repositorio `extra` debería ser suficiente + +También tienes la opción de solo instalar ChromeDriver desde AUR. Si usas `pacaur`, ejecuta el siguiente comando: + +```bash +pacaur -S chromedriver +``` + +> Ya estás listo para [instalar Consul](../local_installation.html)!! diff --git a/docs/es/getting_started/prerequisites/macos.md b/docs/es/getting_started/prerequisites/macos.md index 28f9d2721..1fca98caf 100644 --- a/docs/es/getting_started/prerequisites/macos.md +++ b/docs/es/getting_started/prerequisites/macos.md @@ -135,4 +135,4 @@ Para ejecutar los tests: bundle exec rspec ``` -> Ya estás listo para [instalar Consul](../installation.html)!! +> Ya estás listo para [instalar Consul](../local_installation.html)!!