Development Guide
This document provides guidelines for contributing to the Fawkes Internal Developer Platform (IDP). It includes instructions for setting up a local development environment, coding standards, and best practices for contributing to the project.
Table of Contents
- Setting Up Your Development Environment
- Coding Standards
- Branching and Workflow
- Testing
- Azure Development Best Practices
- Submitting Contributions
Setting Up Your Development Environment
Prerequisites
Ensure you have the following tools installed:
- Git: Version control system
- Docker: For containerized development
- Terraform: For infrastructure provisioning
- kubectl: For managing Kubernetes clusters
- Helm: For managing Kubernetes applications
- Azure CLI (if working with Azure):
Install using:curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Steps to Set Up
-
Clone the Repository:
git clone https://github.com/paruff/fawkes.git cd fawkes
-
Set Up Environment Variables: Copy the
.env.example
file to.env
and update the values:cp .env.example .env
-
Provision Infrastructure: Use the scripts in the
infra/
directory to provision the required infrastructure:cd infra ./buildinfra.sh -p aws -e dev
-
Deploy Platform Services: Navigate to the
platform/
directory and deploy services:cd platform ./deploy-services.sh
-
Run Tests: Execute the test suite to validate your setup:
cd qa ./run-tests.sh
Coding Standards
- Language: Follow the conventions of the language used in the respective module (e.g., Java, Python, Bash).
- Linting: Use linters to ensure code quality:
- YAML:
yamllint
- Shell:
shellcheck
- Python:
flake8
- Java: Checkstyle or SonarQube
- Documentation: Add comments and update relevant documentation for any changes.
Branching and Workflow
-
Create a Feature Branch:
git checkout -b feature/<feature-name>
-
Commit Changes: Write clear and concise commit messages:
git commit -m "Add <feature-name>: <short description>"
-
Push Changes:
git push origin feature/<feature-name>
-
Submit a Pull Request: Open a pull request (PR) on GitHub and request a review.
Testing
Fawkes includes multiple layers of testing:
- Static Analysis: Run tools like SonarQube or Trivy to check for vulnerabilities.
- Unit Tests: Located in the
qa/unit/
directory. - Integration Tests: Located in the
qa/integration/
directory. - Acceptance Tests: Located in the
qa/acceptance/
directory. - Performance Tests: Located in the
qa/performance/
directory.
Run all tests before submitting a PR:
cd qa
./run-all-tests.sh
Azure Development Best Practices
If you are working with Azure, follow these best practices:
-
Use Azure CLI for Authentication:
az login
-
Set the Active Subscription:
az account set --subscription <subscription-id>
-
Follow Azure Resource Naming Conventions: Use consistent and descriptive names for resources.
-
Use Infrastructure as Code (IaC): Use Terraform or Bicep for provisioning Azure resources.
-
Enable Logging and Monitoring: Configure Azure Monitor and Log Analytics for all deployed resources.
-
Secure Secrets: Store secrets in Azure Key Vault and reference them in your deployments.
Submitting Contributions
-
Fork the Repository: Create a fork of the repository on GitHub.
-
Make Changes: Work on your feature branch and ensure all tests pass.
-
Submit a Pull Request: Open a PR with a detailed description of your changes.
-
Address Feedback: Respond to reviewer comments and make necessary updates.
Need Help?
If you encounter any issues, refer to the troubleshooting guide or open an issue on GitHub.