GitBook: [master] 86 pages and 110 assets modified

This commit is contained in:
consuldocs
2020-07-14 22:51:03 +00:00
committed by gitbook-bot
parent 06fe16d6b4
commit 5ed5960428
196 changed files with 5304 additions and 122 deletions

View File

@@ -0,0 +1,22 @@
# Production and Staging servers
## Recommended Minimum System Requirements:
### 1. Production Server:
* Distribution: Ubuntu 16.04.X
* RAM: 32GB
* Processor: Quad core
* Hard Drive: 20 GB
* Database: Postgres
### 2. Staging Server:
* Distribution: Ubuntu 16.04.X
* RAM: 16GB
* Processor: Dual core
* Hard Drive: 20 GB
* Database: Postgres
If your city has a population of over 1.000.000, consider balancing your load using 2-3 production servers and a separate server for the database.

View File

@@ -0,0 +1,81 @@
# Create a deploy user
[The installer](https://github.com/consul/installer) by default connects as the `root` user only to create a `deploy` user. This `deploy` user is the one who installs all libraries. If you do not have `root` access, please ask your system administrator to follow these instructions to create a user manually.
You could create a user called `deploy` or any other name. As as example, we are going to create a user named `jupiter`.
```text
adduser jupiter
```
I'm using jupiter as the user name, you should change that for whatever makes sense to you. Input a password when prompted, and just leave empty the rest of the options.
Let's create a `wheel` group and add the user `jupiter` to this group.
```text
sudo groupadd wheel
sudo usermod -a -G wheel jupiter
```
Now let's give sudo privileges to the `wheel` group and allow it to not use a password, this is important so that the installer doesn't get stalled waiting for a password.
First we open the sudoers file:
```text
sudo visudo -f /etc/sudoers
```
And we add this line at the end:
```text
%wheel ALL=(ALL) NOPASSWD: ALL
```
Now we need to give the keys of the server to the new user. Dont close the server terminal window, because you can lock yourself out of your server if there is a mistake.
Let's create the necessary directory in the server to upload the public key:
```text
su jupiter
cd ~
mkdir .ssh
cd .ssh
nano authorized_keys
```
Make sure you have [generated a public key](generating_ssh_key.md) in your local terminal.
Open another local terminal window \(not in the server\) and type:
```text
cat ~/.ssh/id_rsa.pub
```
Copy the content of your public key to the file authorized\_keys that should still be open in the server.
Test that your user can log in by typing:
```text
ssh jupiter@your-copied-ip-address
```
You should see the server welcome page and a prompt like this:
```text
jupiter@consulserver:~$
```
Note the username at the prompt is not "root", but your username. So everything is fine and we can now block the root account from outside access and also stop allowing password access so only people with SSH keys can log in.
Type the following command to edit the SSH config file of the server:
```text
sudo nano /etc/ssh/sshd_config
```
Look for the "PasswordAuthentication yes" line and change it to "PasswordAuthentication no". Type Control-K to close the nano editor and type:
```text
sudo service ssh restart
```

View File

@@ -0,0 +1,53 @@
# Development Mail Server
This is a example to how integrate a mailing service with a development environment of Consul.
In this example we used [Mailgun](https://www.mailgun.com/).
## Create an account in Mailgun
![Creating an account in Mailgun](../../../.gitbook/assets/mailgun-create-account%20%281%29.png)
* Skip the credit card form
* And activate your account with the link sent by email
## Domain configuration
* Go to the Domains section: ![Mailgun domain section](../../../.gitbook/assets/mailgun-domains%20%281%29.png)
* Since you don't have a domain yet, you should click in the sandbox that is already created;
* Remember the next credentials:
![Mailgun sandbox](../../../.gitbook/assets/mailgun-sandbox%20%281%29.png)
## Consul mailing configuration for development environment
* Go to `config/environments/development.rb` file;
* Add the lines on the file to configure the mail server:
```ruby
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:address => '',
:port => 2525,
:domain => '',
:user_name => '',
:password => '',
:authentication => :plain,
:enable_starttls_auto => true,
:ssl => false
}
```
* Fill, `address`, `domain`, `user_name`, `password` with your information. The file would look like:
![development.rb file](../../../.gitbook/assets/development.rb%20%281%29.png)
## Consul mailing configuration for production environment
* Go to `config/environments/production.rb` file.
* Add the same **action mailer settings** configuration, but now with your production mail server information.
* Pay attention because you will need to change the **port** number to **587**.
You can also use Mailgun to production, adding your custom domain. Mailguns logs sent and delivered emails.

View File

@@ -0,0 +1,60 @@
# Digital Ocean
These instructions will help you register and buy a server in Digital Ocean to install CONSUL.
First you need to [sign up](https://cloud.digitalocean.com/registrations/new) and provide your personal information.
Once you are logged in, you need to create a Droplet \(thats the name that Digital Ocean uses for a Virtual Server\). Click on the “Create” green button at the top of the page and select "Droplets":
![Digital Ocean Droplets](../../../.gitbook/assets/droplets%20%281%29.png)
In the next page, you need to select Ubuntu \(it should be pre-selected\) and change the version **from 18.04 x64 to 16.04 x64**.
![Digital Ocean Choose an image](../../../.gitbook/assets/image%20%281%29.png)
In the "Choose a size" section select the **$80/mo 16GB/6CPUs** option if this is going to be a production server. If you are just setting up a test system with a few users the cheapest $5/mo option can be enough.
![Digital Ocean Choose a size](../../../.gitbook/assets/size%20%281%29.png)
Leave the rest of the options with their defaults until “Choose a datacenter”. Select the one that will be geographically closer to your users. If you are in the EU, select either Frankfurt or Amsterdam data centers.
![Digital Ocean Choose a region](../../../.gitbook/assets/region%20%281%29.png)
In the "Add you SSH keys" section click "New SSH Key" button.
![Digital Ocean Add your SSH Keys](../../../.gitbook/assets/ssh_keys%20%281%29.png)
In the pop up window that appears you need to copy and paste the public key that we [generated in the previous step](generating_ssh_key.md). To see the content of this key in the terminal window type:
```text
cat ~/.ssh/id_rsa.pub
```
You should see a text like this:
```text
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDy/BXU0OsK8KLLXpd7tVnqDU+d4ZS2RHQmH+hv0BFFdP6PmUbKdBDigRqG6W3QBexB2DpVcb/bmHlfhzDlIHJn/oki+SmUYLSWWTWuSeF/1N7kWf9Ebisk6hiBkh5+i0oIJYvAUsNm9wCayQ+i3U3NjuB25HbgtyjR3jDPIhmg1xv0KZ8yeVcU+WJth0pIvwq+t4vlZbwhm/t2ah8O7hWnbaGV/MZUcj0/wFuiad98yk2MLGciV6XIIq+MMIEWjrrt933wAgzEB8vgn9acrDloJNvqx25uNMpDbmoNXJ8+/P3UDkp465jmejVd/6bRaObXplu2zTv9wDO48ZpsaACP your_username@your_computer_name
```
Select and copy all the text and paste it in the pop-up window like this:
![Digital Ocean New SSH Key](../../../.gitbook/assets/new_ssh%20%281%29.png)
Please note that there will be two little green checks. If they are not there, retry copying the text because you probably left something out. Give your key a meaningful name, like **CONSUL\_key** and click "Add SSH Key" button.
By using an SSH key instead of a user/password combination to access your server, it will be much more secure, as only someone with the private SSH key can access the server.
Now in the "Choose a hostname" section change the default for something more meaningful, like **consulserver** for example.
![Digital Ocean hostname](../../../.gitbook/assets/hostname%20%281%29.png)
At the bottom of the page youll see a summary of your options. Check that everything is OK and click the big green "Create" button.
![Digital Ocean create](../../../.gitbook/assets/create%20%281%29.png)
It will take a few minutes, and at the end you will have a shiny new server. It will look like this in the Digital Ocean page:
![Digital Ocean server](../../../.gitbook/assets/server%20%281%29.png)
Next to setup CONSUL in the server check the [installer's README](https://github.com/consul/installer)

View File

@@ -0,0 +1,152 @@
# Docker
You can use Docker to have a local CONSUL installation for development if:
* You're having troubles having [prerequisites](../local_installation/prerequisites.md) installed.
* You want to do a quick local installation just to try CONSUL or make a demo.
* You prefer not to interfer with other rails installations.
## Prerequisites
You should have installed Docker and Docker Compose in your machine:
### macOS
You can follow the [official docker install](https://docs.docker.com/docker-for-mac/install/)
Or if you have [homebrew](http://brew.sh) and [cask](https://caskroom.github.io/) installed you can just:
```bash
brew install docker
brew install docker-compose
brew cask install docker
open -a docker
```
You'll be asked to give Docker app permissions and type your password, then you're set.
### Linux
1. Install Docker:
```bash
sudo apt-get update
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
apt-cache policy docker-engine
sudo apt-get install -y docker-engine
```
2. Install Docker Compose
```bash
sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
sudo chmod +x /usr/local/bin/docker-compose
```
### Windows
Pending to be completed... Contributions Welcome!
## Installation
Clone the repo on your computer and enter the folder:
```bash
git clone git@github.com:consul/consul.git
cd consul
```
### macOS & Linux
Then lets create our secrets and database config files based on examples:
```bash
cp config/secrets.yml.example config/secrets.yml
cp config/database-docker.yml.example config/database.yml
```
Then you'll have to build the container with:
```bash
docker build -t consul .
```
Create your app database images:
```bash
docker-compose up -d database
```
Once built you can initialize your development DB and populate it with:
```text
docker-compose run app rake db:create
docker-compose run app rake db:migrate
docker-compose run app rake db:seed
docker-compose run app rake db:dev_seed
```
### Windows
Pending to be completed... Contributions Welcome!
## Running local CONSUL with Docker
### macOS & Linux
Now we can finally run the application with:
```bash
docker-compose up
```
And you'll be able to access it at your browser visiting [http://localhost:3000](http://localhost:3000)
Additionally, if you want to run the rails console just run in another terminal:
```bash
docker-compose run app rails console
```
To verify the containers are up execute:
```bash
docker ps .
```
You should see output similar to this: ![docker ps](https://i.imgur.com/ASvzXrd.png)
### Windows
Pending to be completed... Contributions Welcome!
## Having trouble?
Run these commands at **Consul's directory**, to erase all your previous Consul's Docker images and containers. Then restart the Docker [installation process](docker.md#installation):
1. Remove all CONSUL images:
```bash
docker-compose down --rmi all -v --remove-orphans
```
2. Remove all CONSUL containers
```bash
docker-compose rm -f -s -v
```
3. Verify if there is some container yet:
```bash
docker ps -a
```
Case positive, remove each one manually:
```bash
docker container rm <container_id>
```

View File

@@ -0,0 +1,19 @@
# Generating SSH Key
These instructions will help you generate a public key with which you can connect to the server without using a password.
In the terminal window, type:
```text
ssh-keygen
```
When prompted for the file in which to save the key just press ENTER to leave the default. When prompted for a passphrase, just press ENTER again to leave this empty. At the end you should see a message like this:
```text
Your identification has been saved in /your_home/.ssh/id_rsa.
Your public key has been saved in /your_home/.ssh/id_rsa.pub.
```
Take note of the **id\_rsa.pub** file location, because youll need the content of this file later.

View File

@@ -0,0 +1,6 @@
# Installer
## Installation notes for Production and Staging servers
Check out the [installer's README](https://github.com/consul/installer)