Skip to content

FleetCorePlatform/Deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FleetCoreServer – Automated Deployment

This repository contains infrastructure-as-code (IaC) definitions and playbooks to automate deployment of the FleetCoreServer application using Terraform and Ansible.


📦 Overview

  • Terraform provisions cloud infrastructure (currently AWS only).
  • Ansible configures servers and deploys the application from the GitHub repository.
  • GitHub Actions provides an automated CI/CD pipeline for provisioning and configuration.

🛠 Prerequisites

Local Development

  • Terraform
  • Ansible
  • AWS CLI v2 configured with valid credentials
  • SSH key pair (Terraform can generate automatically if not provided)

GitHub Actions

  • AWS credentials stored as GitHub Actions secrets:
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY

📂 Repository Structure

infra/
  terraform/
    main.tf
    variables.tf
    outputs.tf
    terraform.tfvars.sample   # template config (copy to terraform.tfvars)
  ansible/
    inventory/
      hosts.ini (auto-generated)
    group_vars/
      all.yml                 # default vars (non-sensitive)
    playbooks/
      site.yml                # main playbook
.github/
  workflows/
    deploy.yml                # CI/CD workflow

🚀 Usage

1. Configure Terraform Variables

Copy the sample file and edit as needed:

cd infra/terraform
cp terraform.tfvars.sample terraform.tfvars

Update values inside terraform.tfvars:

cloud_provider = "aws"
ssh_key_name   = "fleetcore_key"
app_branch     = "main"

2. Run Terraform (Local)

terraform init
terraform apply -auto-approve

Outputs will include:

  • Public IP(s) of instances
  • SSH private key (if generated)
  • Application branch

3. Run Ansible (Local)

cd ../ansible
ansible-playbook -i inventory/hosts.ini playbooks/site.yml

4. Run Deployment via GitHub Actions

Push changes to the main branch (or open PRs against it):

on:
  workflow_dispatch:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

The workflow will:

  1. Run Terraform (infra/terraform)
  2. Save outputs (public IPs, private key, branch)
  3. Run Ansible to configure the servers and deploy FleetCoreServer

🔑 Notes on Secrets and Security

  • Never commit terraform.tfvars with real values.
  • Only commit terraform.tfvars.sample for reference.
  • Use GitHub Secrets for AWS credentials and other sensitive data.
  • The SSH private key generated by Terraform is stored as an artifact only during the workflow run.

📖 References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages