This repository contains the Kubernetes configurations and Docker setup for the Shodapp project, which includes both frontend and backend applications.
- Project Description
- Frontend Application
- Backend Service
- Docker Compose Setup
- Kubernetes Setup
- CI Process
- Contributing
- License
Shodapp is a web application that provides a seamless user experience for interacting with the Shodan API. It consists of a frontend application built with modern web technologies and a backend service that handles API requests, processes data, and interacts with the database.
This is the frontend application for the Shodapp project. It is built using modern web technologies to provide a seamless user experience.
To install the dependencies, run the following command:
npm install
In the project directory, you can run:
npm start
: Runs the app in development mode.npm test
: Launches the test runner in interactive watch mode.npm run build
: Builds the app for production.npm run eject
: Ejects the configuration files and dependencies.
For more information, refer to the frontend README.
This repository contains the backend service for the Shodapp application. The backend is responsible for handling API requests, processing data, and interacting with the database. Note: The backend application works with an online RDS, so you need an available RDS endpoint or any other available database to run the backend app.
To install the backend service, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/shodapp-k8s.git cd shodapp-k8s/backend
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in thebackend
directory and add the necessary environment variables. Refer to.env.example
for the required variables.Example
.env
file:DB_USER=your_db_user DB_PASSWORD=your_db_password DB_HOST=your_db_host DB_NAME=your_db_name JWT_SECRET_KEY=your_jwt_secret_key SHODAN_API_KEY=your_shodan_api_key
Note: You need to have an RDS Postgres endpoint filled within the DB_HOST in the
.env
file in order to run the backend application. -
Start the development server:
python3 shodan_app.py
For more information, refer to the backend README.
To run the entire application stack using Docker Compose, use the provided docker-compose.yaml
file.
-
Ensure Docker and Docker Compose are installed on your machine.
-
Navigate to the root directory of the repository.
-
Create the necessary secret files in the
docker-compose/secrets
directory:db_user.txt
db_password.txt
jwt_secret_key.txt
shodan_api_key.txt
db_host.txt
db_name.txt
Example content for
db_user.txt
:postgres
-
Run the following command to start the services:
docker-compose up
The Kubernetes configurations for deploying the Shodapp project are located in the k8s
directory. To deploy the application to a Kubernetes cluster, follow these steps:
- Ensure
kubectl
andkustomize
are installed on your machine. - Navigate to the
k8s
directory. - Apply the configurations using
kubectl
:kubectl apply -k .
Note: The shodapp-k8s-infra
repository uses the k8s
folder to provision the applications via ArgoCD as the GitOps tool. ArgoCD automatically deploys the application and ensures it is synced with the folder configuration.
The CI process for both the frontend and backend applications is managed using GitHub Actions workflows.
The frontend CI workflow is defined in .github/workflows/frontend-ci-workflow.yml
. It triggers on pull request merges and manual dispatches. The workflow performs the following steps:
- Checks out the code.
- Sets up QEMU and Docker Buildx.
- Logs in to Docker Hub.
- Builds and pushes the Docker image for the frontend application.
- Updates the Kubernetes manifests with the new image.
The backend CI workflow is defined in .github/workflows/backend-ci-workflow.yml
. It triggers on pull request merges and manual dispatches. The workflow performs the following steps:
- Checks out the code.
- Sets up QEMU and Docker Buildx.
- Logs in to Docker Hub.
- Builds and pushes the Docker image for the backend application.
- Updates the Kubernetes manifests with the new image.
We welcome contributions to the Shodapp project. To contribute, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch
- Make your changes and commit them:
git commit -m "Description of your changes"
- Push to the branch:
git push origin feature-branch
- Create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.