Commit 1b7ff6a4 authored by Andre Blanke's avatar Andre Blanke
Browse files

Add first HAProxy configuration file

parent d1f7df70
......@@ -65,6 +65,25 @@ The project is currently deployed using an Apache Web Server instance which serv
by itself and redirects requests other than `/index.html` to the Spring backend running on one of the
workers picked by HAProxy which is running on the frontend server.
## Introducing further workers
Currently three worker servers are used with each one running one instance of our backend application,
an Apache HTTP Server instance and a CockroachDB node.
At the present time some configuration files need to be edited in order to introduce further workers.
The workers are automatically assigned an IP address of the form `192.168.10.(10 + N)` where `N` is
the index of the worker starting with 1.
The IP address `192.168.10.10` is reserved for the frontend server running the load balancer.
The following files currently need to be changed when one wants to add or remove a worker:
- The `num_workers` variable in `Vagrantfile`
- The `haproxy.cfg` file located at `/ansible/roles/frontend/files/haproxy/haproxy.cfg`
- `/ansible/roles/worker/files/systemd/system/cockroach.service.d/override.conf`
Both of the latter two files should be changed at some point to make use of Ansible's templating
feature so that only `num_workers` has to be edited, at least this should be possible.
## API
See [API.md](API.md) for more information on the structure of the API.
......@@ -6,6 +6,15 @@
package:
name: haproxy
state: present
- name: Copy haproxy.cfg file to /etc/haproxy/
copy:
src: /vagrant/ansible/roles/frontend/files/haproxy/haproxy.cfg
dest: /etc/haproxy/haproxy.cfg
- name: Start and enable haproxy.service
systemd:
name: haproxy
state: started
enabled: yes
- name: Install base-devel
package:
......
frontend main
bind *:80
use_backend workers
backend workers
server worker-1 192.168.10.11:8080 check
# server worker-2 192.168.10.12:8080 check
# server worker-3 192.168.10.13:8080 check
......@@ -14,10 +14,12 @@
- name: Add aur_builder user
block:
- user:
- name: Add aur_builder user
user:
name: aur_builder
group: wheel
- lineinfile:
- name: Remove password check for aur_builder user for binary /usr/bin/pacman
lineinfile:
path: /etc/sudoers.d/00-aur_builder
line: 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman'
create: yes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment