Skip to content

AletheiaFact/baremetal-infrastructure

Repository files navigation

Aletheia Fact Baremetal Infrastructure

This repository contains Ansible playbooks and roles for deploying and configuring the infrastructure components required for the Aletheia Fact platform on bare metal servers.

Overview

The Aletheia Fact platform requires several backend services to function properly:

  • MongoDB: Document database for storing application data
  • PostgreSQL: Relational database for identity management
  • Ory Kratos: Identity and user management system
  • Aletheia: The main application service

This repository provides Ansible playbooks to automate the deployment and configuration of these services on bare metal servers.

Prerequisites

Before you begin, ensure you have the following:

  1. Ansible (version 2.9 or higher) installed on your control machine
  2. SSH access to your target servers
  3. Python 3 installed on both control and target machines
  4. Sudo privileges on the target servers

Control Machine Requirements

  • Ansible 2.9+
  • Python 3.6+
  • SSH client

Target Server Requirements

  • Debian/Ubuntu-based Linux distribution (tested on Ubuntu 20.04 LTS)
  • Python 3.6+
  • Sudo access
  • Minimum hardware requirements:
    • 2 CPU cores
    • 4GB RAM
    • 20GB disk space

Getting Started

1. Clone the Repository

git clone https://github.com/yourusername/aletheia_fact-baremetal-infrastructure.git
cd aletheia_fact-baremetal-infrastructure

2. Configure Inventory

Create a hosts file based on the provided hosts.example:

cp hosts.example hosts

Edit the hosts file to include your server information:

[servers]
server1 ansible_host=192.168.1.10 ansible_user=ubuntu
server2 ansible_host=192.168.1.11 ansible_user=ubuntu

3. Configure Variables

Review and modify the variables in the group_vars/all.yml file to match your environment requirements.

You can also create host-specific variable files in the host_vars/ directory if needed.

4. Run the Playbook

To deploy the entire infrastructure:

ansible-playbook -i hosts site.yml

To deploy specific components only:

# Deploy MongoDB only
ansible-playbook -i hosts mongodb.yml

# Deploy PostgreSQL only
ansible-playbook -i hosts postgresql.yml

# Deploy Ory Kratos only
ansible-playbook -i hosts kratos.yml

Component Details

Common Configuration

The common.yml playbook applies basic configuration to all servers, including:

  • Setting locale to en_US.UTF-8
  • Updating package cache
  • Installing common dependencies

MongoDB

The MongoDB role installs and configures MongoDB server with the following features:

  • Version: 7.0 (configurable)
  • Authentication: Optional (disabled by default)
  • Network binding: Configurable (defaults to 0.0.0.0)

PostgreSQL

The PostgreSQL role installs and configures PostgreSQL database server with:

  • Secure default configuration
  • Custom pg_hba.conf for access control
  • Performance tuning based on server resources

Ory Kratos

The Kratos role installs and configures Ory Kratos identity server with:

  • Identity schemas
  • Email verification
  • Password recovery
  • CORS configuration (conditional based on variables)
  • Systemd service for automatic startup

Customization

Modifying Configuration Templates

Each role contains templates in the templates/ directory that can be modified to customize the configuration of each service.

Adding New Roles

To add a new component:

  1. Create a new role directory under roles/
  2. Add the necessary tasks, handlers, templates, and defaults
  3. Create a new playbook file (e.g., component_x.yml)
  4. Add the playbook to site.yml

Troubleshooting

Common Issues

  1. SSH Connection Failures:

    • Verify SSH key permissions
    • Check firewall settings
    • Ensure the ansible_user has sudo privileges
  2. Package Installation Failures:

    • Check internet connectivity on target servers
    • Verify apt sources are correctly configured
  3. Service Start Failures:

    • Check service logs: journalctl -u <service-name>
    • Verify configuration files for syntax errors

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

GPLv3

About

Ansible scripts to setup Aletheia in a Baremetal cluster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages