Merge pull request #5652 from consuldemocracy/ubuntu-installation-docs

Update local installation instructions
This commit is contained in:
Sebastia
2024-08-07 17:00:13 +02:00
committed by GitHub
19 changed files with 259 additions and 452 deletions

View File

@@ -14,7 +14,6 @@ RUN apt-get update -qq \
memcached \
pkg-config \
postgresql-client \
shared-mime-info \
sudo \
unzip

View File

@@ -33,9 +33,11 @@ You can access the main website of the project at [http://consuldemocracy.org](h
## Configuration for development and test environments
**NOTE**: For more detailed instructions check the [docs](https://docs.consuldemocracy.org)
**NOTE**: For more detailed instructions, check the [local installation docs](docs/en/installation/local_installation.md).
Prerequisites: install git, Ruby 3.2.4, CMake, pkg-config, shared-mime-info, Node.js 18.20.3 and PostgreSQL (>=9.5).
Prerequisites: install git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick and PostgreSQL (>=9.5).
**Note**: The `bin/setup` command below might fail if you've configured a username and password for PostgreSQL. If that's the case, edit the lines containing `username:` and `password:` (adding your credentials) in the `config/database.yml` file and run `bin/setup` again.
```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git

View File

@@ -32,9 +32,11 @@ Puedes acceder a la página principal del proyecto en [http://consuldemocracy.or
## Configuración para desarrollo y tests
**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consuldemocracy.org)
**NOTA**: para unas instrucciones más detalladas, consulta la [documentación de instalación local](docs/es/installation/local_installation.md).
Prerequisitos: tener instalado git, Ruby 3.2.4, CMake, pkg-config, shared-mime-info, Node.js 18.20.3 y PostgreSQL (9.5 o superior).
Prerrequisitos: tener instalado git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick y PostgreSQL (9.5 o superior).
**Nota**: Es posible que ejecutar `bin/setup`, como se indica a continuación, falle si has configurado un nombre de usuario y contraseña para PostgreSQL. Si es así, edita las líneas que contienen `username:` y `password:` (añadiendo tus credenciales) en el fichero `config/database.yml` y ejecuta `bin/setup` de nuevo.
```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git

View File

@@ -10,9 +10,11 @@ You can access the main website of the project at [http://consuldemocracy.org](h
## Configuration for development and test environments
**NOTE**: For more detailed instructions check the [docs](https://docs.consuldemocracy.org)
**NOTE**: For more detailed instructions, check the [local installation docs](installation/local_installation.md).
Prerequisites: install git, Ruby 3.2.4, CMake, pkg-config, shared-mime-info, Node.js 18.20.3 and PostgreSQL (>=9.5).
Prerequisites: install git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick and PostgreSQL (>=9.5).
**Note**: The `bin/setup` command below might fail if you've configured a username and password for PostgreSQL. If that's the case, edit the lines containing `username:` and `password:` (adding your credentials) in the `config/database.yml` file and run `bin/setup` again.
```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git

View File

@@ -12,7 +12,7 @@
* [Prerequisites](installation/prerequisites.md)
* [Ubuntu Linux](installation/ubuntu.md)
* [Debian Linux](installation/debian.md)
* [MacOS](installation/macos.md)
* [macOS](installation/macos.md)
* [Windows](installation/windows.md)
* [Vagrant](installation/vagrant.md)
* [Production and Staging servers](installation/servers.md)

View File

@@ -1,24 +1,31 @@
# Configuration for development and test environments (Debian GNU/Linux 9.8)
# Configuration for development and test environments (Debian GNU/Linux 12 - Bookworm)
## Superuser
Note that 'sudo' is not installed by default in Debian. It's possible to install and configure it, you can find information [here](https://wiki.debian.org/sudo). But we don't recommend it cause you may have other problems. We recommend running the following commands as a superuser, so make sure the very first command you run is:
By default, in Debian no user can use `sudo` if a password for the root user was provided during the installation.
So, in order to install the project dependencies, we've got two options. The first option is opening a root shell. Run:
```bash
su
```
> For [Vagrant](/en/installation/vagrant.md) run:
> ```
> sudo su -
> ```
You'll be asked to introduce the password for the root user.
The second option is adding a regular user to the `sudo` group. For that, after opening a root shell, run:
```bash
gpasswd -a <your_username> sudo
```
You'll have to log out and log in again for these changes to take effect.
## System update
Run a general system update:
```bash
apt-get update
sudo apt update
```
## Git
@@ -26,103 +33,55 @@ apt-get update
Git is officially maintained in Debian:
```bash
apt-get install git
```
## Curl
Curl is officially maintained in Debian:
```bash
apt-get install curl
sudo apt install git
```
## Ruby version manager
Ruby versions packaged in official repositories are not suitable to work with Consul Democracy, so we'll have to install it manually.
One possible tool is rvm:
### As a local user
First, we need to install Ruby's development dependencies:
```bash
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -L https://get.rvm.io | bash -s stable
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
```
then add rvm script source to user's bash (~/.bashrc) (this step is only necessary if you can't execute the rvm command)
```bash
[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm
```
and finally, reload .bashrc to be able to run RVM
The next step is installing a Ruby version manager, like rbenv:
```bash
wget -qO- https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
source ~/.bashrc
```
## Node.js
## CMake and pkg-config
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:
In order to compile some of the project dependencies, we need CMake and pkg-config:
```bash
curl -L https://git.io/n-install | bash -s -- -y lts
sudo apt install cmake pkg-config
```
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))
## Node.js version manager
Reload .bashrc to be able to run node
To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. To install Node.js, we will install a Node.js version manager, like NVM:
```bash
source /root/.bashrc
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
```
Check it's correctly installed by running:
## PostgreSQL
Install postgresql and its development dependencies with:
```bash
node -v
```
## PostgreSQL (>=9.4)
PostgreSQL version 9.4 is not official in debian 9.
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:
```text
deb http://security.debian.org/debian-security jessie/updates main
```
afterwards you'll have to download the key, and install it, by:
```bash
wget https://www.postgresql.org/media/keys/ACCC4CF8.asc
apt-key add ACCC4CF8.asc
```
and install postgresql
```bash
apt-get update
apt-get install postgresql-9.4 postgresql-server-dev-9.4 postgresql-contrib-9.4
sudo apt install postgresql libpq-dev
```
You also need to configure a user for your database. As an example, we'll choose the username "consul":
```bash
su - postgres
createuser consul --createdb --superuser --pwprompt
exit
sudo -u postgres createuser consul --createdb --superuser --pwprompt
```
## Imagemagick
@@ -130,34 +89,15 @@ exit
Install Imagemagick:
```bash
apt-get install imagemagick
sudo apt install imagemagick
```
## ChromeDriver
## Chrome or Chromium
To run E2E integration tests, we use Selenium along with Headless Chrome.
To get it working, install the chromedriver package:
In order to run the system tests, we need to install Chrome or Chromium.
```bash
apt-get install chromedriver
ln -s /usr/lib/chromedriver /usr/local/bin/
sudo apt install chromium
```
Make sure it'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 are using an Arch-based distro, installing `chromium` from the `extra` repository should be sufficient.
You also have the option of just installing ChromeDriver from AUR. If you use `pacaur`, run the following command:
```bash
pacaur -S chromedriver
```
Now you're ready to go get Consul Democracy [installed](local_installation.md)!!
Now you're ready to go [get Consul Democracy installed](local_installation.md)!

View File

@@ -1,6 +1,6 @@
# Local installation
Before installing Consul Democracy and having it up and running make sure you all [prerequisites](prerequisites.md) installed.
Before installing Consul Democracy and having it up and running make sure you have all [prerequisites](prerequisites.md) installed.
1. First, clone the [Consul Democracy Github repository](https://github.com/consuldemocracy/consuldemocracy/) and enter the project folder:
@@ -12,8 +12,8 @@ cd consuldemocracy
2. Install the Ruby version we need with your Ruby version manager. Here are some examples:
```bash
rvm install `cat .ruby-version` # If you're using RVM
rbenv install `cat .ruby-version` # If you're using rbenv
rvm install `cat .ruby-version` # If you're using RVM
asdf install ruby `cat .ruby-version` # If you're using asdf
```
@@ -24,43 +24,50 @@ ruby -v
=> # (it should be the same as the version in the .ruby-version file)
```
4. Install [Bundler](http://bundler.io/):
4. Install the Node.js version we need with your Node.js version manager. If you're using NVM:
```bash
gem install bundler --version 1.17.1
nvm install `cat .node-version`
nvm use `cat .node-version`
```
5. Install the required gems using Bundler:
```bash
bundle
```
6. Copy the environment example configuration files inside new readable ones:
5. Copy the example database configuration file:
```bash
cp config/database.yml.example config/database.yml
cp config/secrets.yml.example config/secrets.yml
```
And setup database credentials with your `consul` user in your new `database.yml` file.
6. Setup database credentials with your `consul` user in your new `database.yml` file
7. Run the following [Rake tasks](https://github.com/ruby/rake) to create and fill your local database with the minimum data needed to run the application:
Note: this step is not necessary if you're using a database user without a password and the same username as your system username, which is the default in macOS.
```bash
bin/rake db:create
bin/rake db:setup
bin/rake db:dev_seed
bin/rake db:test:prepare
nano config/database.yml
```
8. Check everything is fine by running the test suite (beware it might take more than an hour):
And edit the lines containing `username:` and `password:`, adding your credentials.
7. Install the project dependencies and create the database:
```bash
bin/setup
```
8. Run the following [Rake task](https://github.com/ruby/rake) to fill your local database with development data:
```bash
bin/rake db:dev_seed
```
9. Check everything is fine by running the test suite
Note: running the whole test suite on your machine might take more than an hour, so it's strongly recommended that you setup a Continuous Integration system in order to run them using parallel jobs every time you open or modify a pull request (if you use GitHub Actions or GitLab CI, this is already configured in `.github/workflows/tests.yml` and `.gitlab-ci.yml`) and only run tests related to your current task while developing on your machine. When you configure the application for the first time, it's recommended that you run at least one test in `spec/models/` and one test in `spec/system/` to check your machine is properly configured to run the tests.
```bash
bin/rspec
```
9. Now you have all set, run the application:
10. Now you have all set, run the application:
```bash
bin/rails s

View File

@@ -1,60 +1,61 @@
# Configuration for development and test environments (macOS)
# Configuration for development and test environments (macOS Sonoma 14.6)
## Homebrew
Homebrew is a very popular package manager for OS X. It's advised to use it since it makes the installation of some of the dependencies much easier.
Homebrew is a very popular package manager for macOS. It's advised to use it since it makes the installation of some of the dependencies much easier.
You can find the installation instructions at: [brew.sh](http://brew.sh)
## XCode and XCode Command Line Tools
## Git
To install *git* you'll first need to install *Xcode* (download it from the Mac App Store) and its *Xcode Command Line Tools* (you can install them from the Xcode's app menu)
You can install git:
## Git and Github
You can download git from: [git-scm.com/download/mac](https://git-scm.com/download/mac)
```bash
brew install git
```
## Ruby version manager
OS X already comes with a preinstalled Ruby version, but it's quite old and we need a newer one. One of the multiple ways of installing Ruby in OS X is through *rbenv*. The installation instructions are in its GitHub repository and are pretty straight-forward:
[github.com/rbenv/rbenv](https://github.com/rbenv/rbenv)
## Node.js
To compile the assets, you'll need a JavaScript runtime. OS X comes with an integrated runtime called `Apple JavaScriptCore` but Node.js is the preferred option.
To install it, you can use [n](https://github.com/tj/n)
Run the following command on your terminal:
macOS already comes with a preinstalled Ruby version, but it's quite old and we need a newer one. One of the multiple ways of installing Ruby in macOS is through [rbenv](https://github.com/rbenv/rbenv):
```bash
curl -L https://git.io/n-install | bash -s -- -y lts
brew install rbenv
rbenv init
source ~/.zprofile
```
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))
## CMake and pkg-config
## PostgreSQL (>=9.4)
In order to compile some of the project dependencies, we need CMake and pkg-config:
```bash
brew install postgres
brew install cmake pkg-config
```
Once installed, we need to *initialize* it:
## Node.js version manager
To compile the assets, you'll need a JavaScript runtime. macOS comes with an integrated runtime called `Apple JavaScriptCore` but Node.js is the preferred option. To install Node.js, we will install a Node.js version manager, like NVM:
```bash
initdb /usr/local/var/postgres
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.zprofile
```
## PostgreSQL
```bash
brew install postgresql
```
Now we're going to configure some things related to the *default user*. First we start postgres server with:
```bash
postgres -D /usr/local/var/postgres
brew services start postgresql
```
At this point we're supposed to have postgres correctly installed and a default user will automatically be created (whose name will match our username). This user hasn't got a password yet.
If we run `psql` we'll login into the postgres console with the default user. Probably it will fail since its required that a default database exists for that user. We can create it by typing:
If we run `psql` we'll login into the postgres console with the default user. It will probably fail since it's required that a default database exists for that user. We can create it by typing:
```bash
createdb 'your_username'
@@ -62,42 +63,26 @@ createdb 'your_username'
If we run `psql` again we should now get access to postgres console. With `\du` you can see the current users list.
In case you want to set a password for your user you can make it through postgres console by:
In case you want to set a password for your user you can make it through the postgres console by:
```sql
ALTER USER your_username WITH PASSWORD 'your_password';
```
Now we'll create the *consul* user, the one the application is using. Run in postgres console:
```sql
CREATE ROLE consul WITH PASSWORD '000';
ALTER ROLE consul WITH SUPERUSER;
ALTER ROLE consul WITH login;
```
If at any point during PostgreSQL installation you feel you have messed things up, you can uninstall it and start again by running:
```bash
brew uninstall postgres
```
You'll have to delete also this directory (otherwise the new installation will generate conflicts, source: [gist.github.com/lxneng/741932](https://gist.github.com/lxneng/741932)):
```bash
rm -rf /usr/local/var/postgres
```
## ChromeDriver
```bash
brew install chromedriver
```
## Imagemagick
Install Imagemagick:
```bash
brew install imagemagick
```
Now that we have all the dependencies installed we can go ahead and [install Consul Democracy](local_installation.md).
## Chrome or Chromium
In order to run the system tests, we need to install Chrome or Chromium.
```bash
brew install google-chrome
```
Now you're ready to go [get Consul Democracy installed](local_installation.md)!

View File

@@ -2,5 +2,5 @@
* [Ubuntu Linux](ubuntu.md)
* [Debian Linux](debian.md)
* [MacOS](macos.md)
* [macOS](macos.md)
* [Windows](windows.md)

View File

@@ -1,4 +1,4 @@
# Configuration for development and test environments (Ubuntu 18.04)
# Configuration for development and test environments (Ubuntu 24.04)
## System update
@@ -23,26 +23,31 @@ Ruby versions packaged in official repositories are not suitable to work with Co
First, we need to install Ruby's development dependencies:
```bash
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
```
The next step is installing a Ruby version manager, like rbenv:
```bash
wget -q https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer -O- | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
wget -qO- https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
source ~/.bashrc
```
## Node.js
## CMake and pkg-config
To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option.
Run the following command on your terminal:
In order to compile some of the project dependencies, we need CMake and pkg-config:
```bash
sudo apt install nodejs
sudo apt install cmake pkg-config
```
## Node.js version manager
To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. To install Node.js, we will install a Node.js version manager, like NVM:
```bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
```
## PostgreSQL
@@ -59,38 +64,6 @@ You also need to configure a user for your database. As an example, we'll choose
sudo -u postgres createuser consul --createdb --superuser --pwprompt
```
To make sure the UTF-8 enconding is used, create a file:
```bash
sudo nano /etc/profile.d/lang.sh
```
Add the following:
```bash
export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
```
Reconfigure Postgres to use the UTF-8 encoding:
```bash
sudo su - postgres
psql
```
```sql
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';
\q
exit
```
## Imagemagick
Install Imagemagick:
@@ -99,15 +72,12 @@ Install Imagemagick:
sudo apt install imagemagick
```
## ChromeDriver
## Chrome or Chromium
To run E2E integration tests, we use Selenium along with Headless Chrome.
To get it working, install the chromium-chromedriver package and make sure it's available on your shell's PATH:
In order to run the system tests, we need to install Chrome or Chromium.
```bash
sudo apt install chromium-chromedriver
sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/
sudo apt install chromium-browser
```
Now you're ready to go [get Consul Democracy installed](local_installation.md)!

View File

@@ -1,3 +1,3 @@
# Windows
Windows is not yet officially supported. Please install [Virtual Box](https://www.virtualbox.org/) to setup a virtual machine in [Linux](prerequisites.md).
Windows is not officially supported yet. Please install [Virtual Box](https://www.virtualbox.org/) to setup a virtual machine in [Linux](prerequisites.md) or use [Docker](docker.md).

View File

@@ -10,9 +10,11 @@ Puedes acceder a la página principal del proyecto en [http://consuldemocracy.or
## Configuración para desarrollo y tests
**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consuldemocracy.org)
**NOTA**: para unas instrucciones más detalladas, consulta la [documentación de instalación local](installation/local_installation.md).
Prerequisitos: tener instalado git, Ruby 3.2.4, CMake, pkg-config, shared-mime-info, Node.js 18.20.3 y PostgreSQL (9.5 o superior).
Prerrequisitos: tener instalado git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick y PostgreSQL (9.5 o superior).
**Nota**: Es posible que ejecutar `bin/setup`, como se indica a continuación, falle si has configurado un nombre de usuario y contraseña para PostgreSQL. Si es así, edita las líneas que contienen `username:` y `password:` (añadiendo tus credenciales) en el fichero `config/database.yml` y ejecuta `bin/setup` de nuevo.
```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git

View File

@@ -12,7 +12,7 @@
* [Prerrequisitos](installation/prerequisites.md)
* [Ubuntu Linux](installation/ubuntu.md)
* [Debian Linux](installation/debian.md)
* [MacOS](installation/macos.md)
* [macOS](installation/macos.md)
* [Windows](installation/windows.md)
* [Vagrant](installation/vagrant.md)
* [Servidores de producción y pruebas](installation/servers.md)

View File

@@ -1,24 +1,31 @@
# Configuración para los entornos de desarrollo y pruebas (Debian GNU/Linux 9.8)
# Configuración para los entornos de desarrollo y pruebas (Debian GNU/Linux 12 - Bookworm)
## Superusuario
El programa 'sudo' no viene instalado en Debian por defecto. Su instalación y configuración es posible, se puede encontrar información al respecto [aquí](https://wiki.debian.org/es/sudo). Pero no lo recomendamos porque puede causar otros problemas. Recomendamos que se ejecuten las siguientes instrucciones como un super usuario, así que asegúrate de que la primera instrucción que ejecutes sea:
Por defecto, en Debian ningún usuario puede utilizar `sudo` si se ha proporcionado una contraseña para el usuario root durante la instalación.
Por tanto, para instalar las dependencias del proyecto, tendremos dos opciones. La primera opción es abrir un terminal de superusuario. En un terminal, ejecuta:
```bash
su
```
> Para [Vagrant](/es/installation/vagrant.md) ejecutar:
> ```
> sudo su -
> ```
Te pedirá introducir la contraseña del usuario root.
La segunda opción es añadir un usuario regular al grupo `sudo`. Para ello, tras abrir un terminal de superusuario, ejecuta:
```bash
gpasswd -a <your_username> sudo
```
Tendrás que cerrar sesión y volverla abrir para que los cambios tengan efecto.
## Actualización de sistema
Ejecuta una actualización general de las librerías de sistema:
```bash
apt-get update
sudo apt update
```
## Git
@@ -26,101 +33,55 @@ apt-get update
Git es mantenido oficialmente en Debian:
```bash
apt-get install git
```
## Curl
Curl es mantenido oficialmente en Debian:
```bash
apt-get install curl
sudo apt install git
```
## Gestor de versiones de Ruby
Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para trabajar con Consul Democracy, así que debemos instalar manualmente.
Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para trabajar con Consul Democracy, así que debemos instalarlo manualmente.
Una opción es utilizar rvm:
### Como usuario local
En primer lugar, necesitamos los siguiente paquetes para poder instalar Ruby:
```bash
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -L https://get.rvm.io | bash -s stable
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
```
después añadimos el script rvm a nuestro bash (~/.bashrc) (este paso sólo es necesario si no puedes ejecutar el comando rvm)
```bash
[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm
```
por úlitmo, volvemos a cargar el .bashrc para poder ejecutar RVM
A continuación instalaremos un gestor de versiones de Ruby, como rbenv:
```bash
wget -qO- https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
source ~/.bashrc
```
## Node.js
## CMake y pkg-config
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:
Para compilar algunas de las dependencias del proyecto, necesitamos CMake y pkg-config:
```bash
curl -L https://git.io/n-install | bash -s -- -y lts
sudo apt install cmake pkg-config
```
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))
## Gestor de versiones de Node.js
vuelve a cargar el .bashrc para poder ejecutar node
Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada. Para instalar Node.js, instalaremos un gestor de versiones de Node.js, como NVM:
```bash
source /root/.bashrc
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
```
Comprueba que está correctamente instalado ejecutando:
## PostgreSQL
Instala postgresql y sus dependencias de desarrollo con:
```bash
node -v
sudo apt install postgresql libpq-dev
```
## PostgreSQL (>=9.4)
La versión 9.4 de PostgreSQL no es oficial en Debian 9.
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:
```text
deb http://security.debian.org/debian-security jessie/updates main
```
después deberás descargar la key e instalarla:
Para el correcto funcionamiento de Consul Democracy, necesitas configurar un usuario para tu base de datos. Como ejemplo, crearemos un usuario llamado "consul":
```bash
wget https://www.postgresql.org/media/keys/ACCC4CF8.asc
apt-key add ACCC4CF8.asc
```
y finalmente instalar postgresql
```bash
apt-get update
apt-get install postgresql-9.4 postgresql-server-dev-9.4 postgresql-contrib-9.4
```
Para el correcto funcionamiento de Consul Democracy, necesitas confgurar un usuario para tu base de datos. Como ejemplo, crearemos un usuario llamado "consul":
```bash
su - postgres
createuser consul --createdb --superuser --pwprompt
exit
sudo -u postgres createuser consul --createdb --superuser --pwprompt
```
## Imagemagick
@@ -128,34 +89,15 @@ exit
Instala Imagemagick:
```bash
apt-get install imagemagick
sudo apt install imagemagick
```
## ChromeDriver
## Chrome o Chromium
Para realizar pruebas de integración, usamos Selenium junto a Headless Chrome.
Para ello, primero instala el siguiente paquete:
Para poder ejecutar los tests de sistema, necesitaremos tener instalado Chrome o Chromium.
```bash
apt-get install chromedriver
ln -s /usr/lib/chromedriver /usr/local/bin/
sudo apt install chromium
```
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 Democracy](local_installation.md)!!
¡Ya estás listo para [instalar Consul Democracy](local_installation.md)!

View File

@@ -12,8 +12,8 @@ cd consuldemocracy
2. Instala la versión de Ruby necesaria con el gestor de versiones de tu elección. Algunos ejemplos:
```bash
rvm install `cat .ruby-version` # Si usas RVM
rbenv install `cat .ruby-version` # Si usas rbenv
rvm install `cat .ruby-version` # Si usas RVM
asdf install ruby `cat .ruby-version` # Si usas asdf
```
@@ -24,43 +24,50 @@ ruby -v
=> # (debería aparecer la versión mencionada en el fichero .ruby-version)
```
4. Instala [Bundler](http://bundler.io/)
4. Instala la versión de Node.js necesaria con tu gestor de versiones de Node.js. Si usas NVM:
```bash
gem install bundler --version 1.17.1
nvm install `cat .node-version`
nvm use `cat .node-version`
```
5. Instala las gemas requeridas usando Bundler:
```bash
bundle
```
6. Copia los archivos de configuración de ejemplo del entorno dentro de unos nuevos válidos:
5. Copia el archivo de ejemplo de configuración de base de datos:
```bash
cp config/database.yml.example config/database.yml
cp config/secrets.yml.example config/secrets.yml
```
Y configura los de tu usuario de base de datos `consul` en `database.yml`
6. Configura las credenciales de base de datos con tu usuario `consul` en tu nuevo fichero `database.yml`
7. Ejecuta las siguientes [tareas Rake](https://github.com/ruby/rake) para crear y rellenar tu base de datos local con el mínimo de información necesaria para que la aplicación funcione correctamente:
Nota: este paso no es necesario si estás utilizando un usuario de base de datos sin contraseña y el mismo nombre de usuario que tu usuario de sistema, que es el comportamiento por defecto en macOS.
```bash
bin/rake db:create
bin/rake db:setup
bin/rake db:dev_seed
bin/rake db:test:prepare
nano config/database.yml
```
8. Comprueba que todo funciona correctamente lanzando la suite de tests (ten en cuenta que podría tardar más de una hora):
Y edita las líneas que contienen `username:` y `password:`, añadiendo tus credenciales.
7. Instala las dependencias del proyecto y crea la base de datos:
```bash
bin/setup
```
8. Ejecuta la siguiente [tarea Rake](https://github.com/ruby/rake) para rellenar tu base de datos local con datos de desarrollo:
```bash
bin/rake db:dev_seed
```
9. Comprueba que todo funciona correctamente lanzando la suite de tests
Nota: ejecutar todos los tests en tu máquina puede tardar más de una hora, por lo que recomendamos encarecidamente que configures un sistema de Integración Continua para ejecutarlos utilizando varios trabajos en paralelo cada vez que abras o modifiques una PR (si usas GitHub Actions o GitLab CI, esto ya está configurado en `.github/workflows/tests.yml` y `.gitlab-ci.yml`) y cuando trabajes en tu máquina ejecutes solamente los tests relacionados con tu desarrollo actual. Al configurar la aplicación por primera vez, recomendamos que ejecutes al menos un test en `spec/models/` y un test en `spec/system/` para comprobar que tu máquina está configurada para ejecutar los tests correctamente.
```bash
bin/rspec
```
9. Ahora que ya está todo listo puedes ejecutar la aplicación:
10. Ahora que ya está todo listo puedes ejecutar la aplicación:
```bash
bin/rails s

View File

@@ -1,61 +1,56 @@
# Configuración para los entornos de desarrollo y pruebas (Mac OS X)
# Configuración para los entornos de desarrollo y pruebas (macOS Sonoma 14.6)
## Homebrew
Homebrew es un gestor de paquetes para OS X muy popular. Es recomendable usarlo pues facilita enormemente la instalación de algunos de los paquetes necesarios.
Homebrew es un gestor de paquetes para macOS muy popular. Es recomendable usarlo pues facilita enormemente la instalación de algunos de los paquetes necesarios.
Puedes encontrar las instrucciones de instalación en: [brew.sh](http://brew.sh)
## XCode y XCode Command Line Tools
## Git
Para utilizar git necesitarás instalar *Xcode* (está en la Mac App Store) y las *Xcode Command Line Tools* (se instalan desde el menú de Xcode).
Puedes instalar git:
## Git y Github
Puedes descargar git desde: [git-scm.com/download/mac](https://git-scm.com/download/mac)
```bash
brew install git
```
## Gestor de versiones de Ruby
OS X ya viene con una versión preinstalada de ruby, pero es bastante vieja y en nuestro caso no nos sirve. Una de las formas de instalar Ruby es a través de rbenv. Las instrucciones de instalación están en su GitHub y son bastante claras:
[github.com/rbenv/rbenv](https://github.com/rbenv/rbenv)
## Bundler
macOS ya viene con una versión preinstalada de ruby, pero necesitamos una versión más reciente. Una de las formas de instalar Ruby es a través de un gestor de versiones de Ruby como [rbenv](https://github.com/rbenv/rbenv):
```bash
gem install bundler
brew install rbenv
rbenv init
source ~/.zprofile
```
## Node.js
## CMake y pkg-config
Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. OS X viene con un _runtime_ integrado llamado `Apple JavaScriptCore` pero Node.js es la opción recomendada.
Para instalar Node, puedes usar [n](https://github.com/tj/n)
Ejecuta el siguiente comando en tu terminal:
Para compilar algunas de las dependencias del proyecto, necesitamos CMake y pkg-config:
```bash
curl -L https://git.io/n-install | bash -s -- -y lts
brew install cmake pkg-config
```
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))
## Gestor de versiones de Node.js
## PostgreSQL (>=9.4)
Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. macOS viene con un _runtime_ integrado llamado `Apple JavaScriptCore` pero Node.js es la opción recomendada. Para instalar Node.js, instalaremos un gestor de versiones de Node.js, como NVM:
```bash
brew install postgres
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.zprofile
```
Una vez instalado es necesario *inicializar* la instalación:
## PostgreSQL
```bash
initdb /usr/local/var/postgres
brew install postgresql
```
Ahora vamos a configurar algunos aspectos del usuario por defecto. Primero iniciamos el servidor de postgres con:
```bash
postgres -D /usr/local/var/postgres
brew services start postgresql
```
Llegados a este punto se supone que tenemos postgres correctamente instalado y se nos habrá creado un usuario por defecto (cuyo nombre es nuestro nombre de usuario), y que (todavía) no tiene contraseña.
@@ -66,7 +61,7 @@ Si ejecutamos `psql` accederemos a la consola de postgres con el usuario por def
createdb 'tu_nombre_de_usuario'
```
Si ahora ejecutamos `psql` de nuevo deberíamos poder acceder correctamente a la consola de postgres. Si sobre la consola de postgres ejecutas `\du` puede ver la lista de usuarios actual.
Si ahora ejecutamos `psql` de nuevo deberíamos poder acceder correctamente a la consola de postgres. Si sobre la consola de postgres ejecutas `\du` puedes ver la lista de usuarios actual.
En el caso de que quieras asignarte una contraseña puedes hacerlo desde la consola de postgres con:
@@ -74,36 +69,20 @@ En el caso de que quieras asignarte una contraseña puedes hacerlo desde la cons
ALTER USER tu_nombre_usuario WITH PASSWORD 'tu_contraseña';
```
Ahora vamos a crear el usuario *consul*, que es el que utiliza la aplicación. Ejecuta sobre la consola de postgres:
```sql
CREATE ROLE consul WITH PASSWORD '000';
ALTER ROLE consul WITH SUPERUSER;
ALTER ROLE consul WITH login;
```
Si en algún momento durante la instalación de PostgreSQL y sospechas que te has equivocado y deseas desinstalarlo y volver a empezar desde cero:
```bash
brew uninstall postgres
```
También tendrás que borrar el siguiente directorio para que no de conflictos cuando intentes volver a instalarlo (fuente: [gist.github.com/lxneng/741932](https://gist.github.com/lxneng/741932)):
```bash
rm -rf /usr/local/var/postgres
```
## ChromeDriver
```bash
brew install chromedriver
```
## Imagemagick
Instala Imagemagick:
```bash
brew install imagemagick
```
Ahora que ya tenemos todas las dependencias instalado podemos proceder con la [instalación de Consul Democracy](local_installation.md)
## Chrome o Chromium
Para poder ejecutar los tests de sistema, necesitaremos tener instalado Chrome o Chromium.
```bash
brew install google-chrome
```
¡Ya estás listo para [instalar Consul Democracy](local_installation.md)!

View File

@@ -2,5 +2,5 @@
* [Ubuntu Linux](ubuntu.md)
* [Debian Linux](debian.md)
* [MacOS](macos.md)
* [macOS](macos.md)
* [Windows](windows.md)

View File

@@ -1,4 +1,4 @@
# Configuración para los entornos de desarrollo y pruebas (Ubuntu 18.04)
# Configuración para los entornos de desarrollo y pruebas (Ubuntu 24.04)
## Actualización de sistema
@@ -23,26 +23,31 @@ Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para t
En primer lugar, necesitamos los siguiente paquetes para poder instalar Ruby:
```bash
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
```
A continuación instalaremos un gestor de versiones de Ruby, como rbenv:
```bash
wget -q https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer -O- | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
wget -qO- https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
source ~/.bashrc
```
## Node.js
## CMake y pkg-config
Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada.
Ejecuta en tu terminal:
Para compilar algunas de las dependencias del proyecto, necesitamos CMake y pkg-config:
```bash
sudo apt install nodejs
sudo apt install cmake pkg-config
```
## Gestor de versiones de 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. Para instalar Node.js, instalaremos un gestor de versiones de Node.js, como NVM:
```bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
```
## PostgreSQL
@@ -53,44 +58,12 @@ Instala postgresql y sus dependencias de desarrollo con:
sudo apt install postgresql libpq-dev
```
Para el correcto funcionamiento de Consul Democracy, necesitas confgurar un usuario para tu base de datos. Como ejemplo, crearemos un usuario llamado "consul":
Para el correcto funcionamiento de Consul Democracy, necesitas configurar un usuario para tu base de datos. Como ejemplo, crearemos un usuario llamado "consul":
```bash
sudo -u postgres createuser consul --createdb --superuser --pwprompt
```
Para asegurarse que se utiliza la codificación con UTF-8, crea un archivo:
```bash
sudo nano /etc/profile.d/lang.sh
```
Añade las siguientes líneas:
```bash
export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
```
Reconfigura Postgres para utilizar la codificación UTF-8:
```bash
sudo su - postgres
psql
```
```sql
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';
\q
exit
```
## Imagemagick
Instala Imagemagick:
@@ -99,15 +72,12 @@ Instala Imagemagick:
sudo apt install imagemagick
```
## ChromeDriver
## Chrome o Chromium
Para realizar pruebas de integración, usamos Selenium junto a Headless Chrome.
Para poder utilizarlo, instala el paquete chromium-chromedrive y asegúrate de que se encuentre enlazado en algún directorio que esté en la variable de entorno PATH:
Para poder ejecutar los tests de sistema, necesitaremos tener instalado Chrome o Chromium.
```bash
sudo apt install chromium-chromedriver
sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/
sudo apt install chromium-browser
```
¡Ya estás listo para [instalar Consul Democracy](local_installation.md)!

View File

@@ -1,3 +1,3 @@
# Windows
De momento Windows no es un sistema operativo compatible. Por favor instale [Virtual Box](https://www.virtualbox.org/) para crear una máquina virtual en [Linux](prerequisites.md).
De momento Windows no es un sistema operativo compatible. Por favor instala [Virtual Box](https://www.virtualbox.org/) para crear una máquina virtual en [Linux](prerequisites.md) o utiliza [Docker](docker.md).