Update instructions for the bin/setup command

This command simplifies some of the steps. However, there's a gotcha: it
might fail if the database requires username and password and they
haven't been configured before executing it.
This commit is contained in:
Javi Martín
2024-08-06 13:50:28 +02:00
parent 1b61e8e2e0
commit e666c28c5c
6 changed files with 46 additions and 34 deletions

View File

@@ -37,6 +37,8 @@ You can access the main website of the project at [http://consuldemocracy.org](h
Prerequisites: install git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick 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 ```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git git clone https://github.com/consuldemocracy/consuldemocracy.git
cd consuldemocracy cd consuldemocracy

View File

@@ -36,6 +36,8 @@ Puedes acceder a la página principal del proyecto en [http://consuldemocracy.or
Prerrequisitos: tener instalado git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick 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 ```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git git clone https://github.com/consuldemocracy/consuldemocracy.git
cd consuldemocracy cd consuldemocracy

View File

@@ -14,6 +14,8 @@ You can access the main website of the project at [http://consuldemocracy.org](h
Prerequisites: install git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick 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 ```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git git clone https://github.com/consuldemocracy/consuldemocracy.git
cd consuldemocracy cd consuldemocracy

View File

@@ -24,37 +24,39 @@ ruby -v
=> # (it should be the same as the version in the .ruby-version file) => # (it should be the same as the version in the .ruby-version file)
``` ```
4. Install the required gems using Bundler: 4. Copy the example database configuration file:
```bash
bundle
```
5. Copy the environment example configuration files inside new readable ones:
```bash ```bash
cp config/database.yml.example config/database.yml 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. 5. Setup database credentials with your `consul` user in your new `database.yml` file
6. 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:
```bash ```bash
bin/rake db:create nano config/database.yml
bin/rake db:setup
bin/rake db:dev_seed
bin/rake db:test:prepare
``` ```
7. 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.
6. Install the project dependencies and create the database:
```bash
bin/setup
```
7. Run the following [Rake task](https://github.com/ruby/rake) to fill your local database with development data:
```bash
bin/rake db:dev_seed
```
8. Check everything is fine by running the test suite (beware it might take more than an hour):
```bash ```bash
bin/rspec bin/rspec
``` ```
8. Now you have all set, run the application: 9. Now you have all set, run the application:
```bash ```bash
bin/rails s bin/rails s

View File

@@ -14,6 +14,8 @@ Puedes acceder a la página principal del proyecto en [http://consuldemocracy.or
Prerrequisitos: tener instalado git, Ruby 3.2.4, CMake, pkg-config, Node.js 18.20.3, ImageMagick 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 ```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git git clone https://github.com/consuldemocracy/consuldemocracy.git
cd consuldemocracy cd consuldemocracy

View File

@@ -24,37 +24,39 @@ ruby -v
=> # (debería aparecer la versión mencionada en el fichero .ruby-version) => # (debería aparecer la versión mencionada en el fichero .ruby-version)
``` ```
4. Instala las gemas requeridas usando Bundler: 4. Copia el archivo de ejemplo de configuración de base de datos:
```bash
bundle
```
5. Copia los archivos de configuración de ejemplo del entorno dentro de unos nuevos válidos:
```bash ```bash
cp config/database.yml.example config/database.yml 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` 5. Configura las credenciales de base de datos con tu usuario `consul` en tu nuevo fichero `database.yml`
6. 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:
```bash ```bash
bin/rake db:create nano config/database.yml
bin/rake db:setup
bin/rake db:dev_seed
bin/rake db:test:prepare
``` ```
7. 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.
6. Instala las dependencias del proyecto y crea la base de datos:
```bash
bin/setup
```
7. 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
```
8. Comprueba que todo funciona correctamente lanzando la suite de tests (ten en cuenta que podría tardar más de una hora):
```bash ```bash
bin/rspec bin/rspec
``` ```
8. Ahora que ya está todo listo puedes ejecutar la aplicación: 9. Ahora que ya está todo listo puedes ejecutar la aplicación:
```bash ```bash
bin/rails s bin/rails s