Merge pull request #99 from jfoclpf/patch-1

Add instructions for manual installation on production
This commit is contained in:
Javi Martín
2021-12-10 14:20:10 +01:00
committed by GitHub
3 changed files with 189 additions and 1 deletions

View File

@@ -20,6 +20,7 @@
* [Installer](en/installation/installer.md)
* [Create a deploy user](en/installation/create_deploy_user.md)
* [Generating SSH Key](en/installation/generating_ssh_key.md)
* [Manual installation (not recommended)](en/installation/manual_installation_production.md)
* [Digital Ocean](en/installation/digital_ocean.md)
* [Heroku](en/installation/deploying-on-heroku.md)
* [Docker](en/installation/docker.md)
@@ -50,7 +51,6 @@
* [Contributing](en/open_source/contributing.md)
* [License](es/open_source/license.md)
## SPANISH Documentation
* [Introducción](es/README.md)
@@ -72,6 +72,7 @@
* [Instalador](es/installation/installer.md)
* [Crear usuario](es/installation/create_deploy_user.md)
* [Generación de claves SSH](es/installation/generating_ssh_key.md)
* [Instalación manual (no recomendada)](es/installation/manual_installation_production.md)
* [Digital Ocean](es/installation/digital_ocean.md)
* [Heroku](es/installation/deploying-on-heroku.md)
* [Docker](es/installation/docker.md)

View File

@@ -0,0 +1,94 @@
# Manual installation for production
**WARNING:** This method is *not recommended* and not officially supported, since you should use the [installer](https://github.com/consul/installer) instead. Use this method if the installer isn't an option and you can already deal with PostgreSQL, puma or passenger, NGNIX and SSL (with letsencrypt, for instance).
This guide assumes you've already [installed all the necessary packages](prerequisites.md) on your system.
The created directory structure herein is to be used with [capistrano](https://capistranorb.com/documentation/getting-started/structure/).
## Folder structure
First, create the main folder, clone the repo to a repo directory, and create the needed folders:
```
mkdir consul
cd consul
git clone --mirror https://github.com/consul/consul.git repo
mkdir releases shared
mkdir shared/log shared/tmp shared/config shared/public shared/storage
mkdir -p shared/public/assets shared/public/system shared/public/ckeditor_assets shared/public/machine_learning/data
```
## Initial release
Extract from the repo the first release to the respective directory, and create the symbolic link of the current release (replace `<latest_consul_stable_version>` with the latest version number, like 1.3.1 or 1.4.1):
```
cd repo
git archive <latest_consul_stable_version> | tar -x -f - -C ../releases/first
cd ..
ln -s releases/first current
```
## Gems installation
Install the gems CONSUL depends on:
```
cd releases/first
bundle install --path ../../shared/bundle --without development test
cd ../..
```
## Configuration files
Generate the `database.yml` and `secrets.yml` files:
```
cp current/config/secrets.yml.example shared/config/secrets.yml
cp current/config/database.yml.example shared/config/database.yml
cd releases/first/config
ln -s ../../../shared/config/database.yml
ln -s ../../../shared/config/secrets.yml
cd ../../..
```
Edit the `shared/config/database.yml` file, filling in `username` and `password` with the data generated during the [PostgreSQL setup](debian.md#postgresql-94).
We now need to generate a secret key:
```
cd current
bin/rake secret RAILS_ENV=production
cd ..
```
Copy that generated key, and edit the `shared/config/secrets.yml` file; under the section `production`, change the following data:
```
secret_key_base: enter_the_secret_key_you_have_just_generated
server_name: enter_your_domain
```
If you aren't using a SSL certificate, replace the line saying `force_ssl: true` with `force_ssl: false`.
## Database setup
Create a database, load the seeds and compile the assets:
```
cd current
bin/rake db:migrate RAILS_ENV=production
bin/rake db:seed RAILS_ENV=production
bin/rake assets:precompile RAILS_ENV=production
```
## Starting the application
And, finally, start the Rails server:
```
bin/rails s -e production
```
Congratulations! Your server is now running in the production environment :smile:.

View File

@@ -0,0 +1,93 @@
# Instalación manual en producción
**AVISO:** Recomendamos *no usar* este sistema, para el que no damos soporte oficial, ya que siempre que sea posible debe utilizarse el [instalador](https://github.com/consul/installer). Utiliza este método si usar el instalador no es una opción y si tienes experiencia configurando PostgreSQL, puma o passenger, NGNIX y SSL (con letsencrypt, por ejemplo).
Esta guía asume que ya has [instalado todas las dependencias necesarias](prerequisites.md) en tu sistema.
La estructura de directorios que se crea a continuación está pensada para usarse con [capistrano](https://capistranorb.com/documentation/getting-started/structure/).
## Estructura de directorios
En primer lugar, crea el directorio principal, clona el repositorio y crea los subdirectorios necesarios:
```
mkdir consul && cd consul
git clone --mirror https://github.com/consul/consul.git repo
mkdir releases shared
mkdir shared/log shared/tmp shared/config shared/public shared/storage
mkdir -p shared/public/assets shared/public/system shared/public/ckeditor_assets shared/public/machine_learning/data
```
## Versión inicial
Crea una primera carpeta en "releases" a partir del repositorio, junto con un enlace simbólico a la versión actual (sustituye `<latest_consul_stable_version>` por el número de la última versión estable de CONSUL, como 1.3.1 o 1.4.1):
```
cd repo
git archive <latest_consul_stable_version> | tar -x -f - -C ../releases/first
cd ..
ln -s releases/first current
```
## Instalación de gemas
Instala las gemas de las que depende CONSUL:
```
cd releases/first
bundle install --path ../../shared/bundle --without development test
cd ../..
```
## Ficheros de configuración
Genera los ficheros `database.yml` y `secrets.yml`:
```
cp current/config/secrets.yml.example shared/config/secrets.yml
cp current/config/database.yml.example shared/config/database.yml
cd releases/first/config
ln -s ../../../shared/config/database.yml
ln -s ../../../shared/config/secrets.yml
cd ../../..
```
Edita el fichero `shared/config/database.yml`, rellenando `username` y `password` con los datos generador durante la [configuración de PostgreSQL](debian.md#postgresql-94).
Ahora generamos una clave secreta:
```
cd current
bin/rake secret RAILS_ENV=production
cd ..
```
Copia la clave generada y edita el fichero `shared/config/secrets.yml`; en la sección `production`, cambia los siguientes datos:
```
secret_key_base: introduce_la_clave_secreta_que_acabas_de_generar
server_name: introduce_tu_dominio
```
Si no tienes un certificado SSL, cambia además `force_ssl: true` por `force_ssl: false`.
## Base de datos
Crea una base de datos, genera los datos necesarios para que la aplicación funcione y compila los ficheros de CSS y JavaScript:
```
cd current
bin/rake db:migrate RAILS_ENV=production
bin/rake db:seed RAILS_ENV=production
bin/rake assets:precompile RAILS_ENV=production
```
## Arranque de la aplicación
Y, por último, inicia el servidor de Rails:
```
bin/rails s -e production
```
¡Enhorabuena! Ahora tu servidor está funcionando en el entorno de producción :smile:.