Added configurations part.
This commit is contained in:
115
README.md
115
README.md
@@ -1,116 +1,127 @@
|
||||
# Capital Index Database Middleware
|
||||
|
||||
## Description:
|
||||
## Overview
|
||||
|
||||
### About this project:
|
||||
### About This Project
|
||||
The **Capital Index Database Middleware** provides an abstraction layer for your database, enhancing query management and change monitoring. It streamlines database interactions while ensuring efficient performance and security.
|
||||
|
||||
Database Middleware that handles database's querying and changes monitoring.
|
||||
### Repository Contents
|
||||
This repository includes:
|
||||
- **Middleware Source Code** – The core logic for database interaction.
|
||||
- **Dockerfile** – Configuration for containerized deployment.
|
||||
- **Install & Management Scripts** – Scripts for streamlined installation and maintenance.
|
||||
|
||||
Adds an abstraction layer on top of your Database.
|
||||
|
||||
### This repo contains:
|
||||
|
||||
1. Middleware Source Code
|
||||
2. Dockerfile
|
||||
3. Install & Manage Scripts
|
||||
## Getting Started
|
||||
|
||||
## Getting Started:
|
||||
### Installation
|
||||
|
||||
### Installation:
|
||||
|
||||
#### 1. Install the required dependencies:
|
||||
|
||||
Needed to download and build the docker container.
|
||||
#### Step 1: Install Required Dependencies
|
||||
Before installing, ensure you have the necessary dependencies to download and build the Docker container.
|
||||
|
||||
<details>
|
||||
<summary>Debian/Ubuntu</summary>
|
||||
|
||||
```bash
|
||||
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install wget git docker.io -y
|
||||
sudo apt-get update && sudo apt-get upgrade -y
|
||||
sudo apt-get install -y wget git docker.io
|
||||
```
|
||||
|
||||
[Optional] Install Docker build-kit:
|
||||
|
||||
[Optional] Install Docker BuildKit:
|
||||
```bash
|
||||
sudo apt-get install docker-buildx -y
|
||||
sudo apt-get install -y docker-buildx
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>CentOS/Fedora</summary>
|
||||
|
||||
- Note: CentOS 7 uses yum instead of dnf. Replace dnf with yum if on CentOS 7.
|
||||
> **Note:** If using CentOS 7, replace `dnf` with `yum`.
|
||||
|
||||
```bash
|
||||
sudo dnf update -y
|
||||
sudo dnf upgrade -y
|
||||
sudo dnf update -y && sudo dnf upgrade -y
|
||||
sudo dnf install -y wget git docker
|
||||
```
|
||||
|
||||
[Optional] Install Docker build-kit:
|
||||
|
||||
[Optional] Install Docker BuildKit:
|
||||
```bash
|
||||
sudo dnf install -y docker-buildx
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Arch Linux:</summary>
|
||||
<summary>Arch Linux</summary>
|
||||
|
||||
```bash
|
||||
sudo pacman -Syu --noconfirm && sudo pacman -S --noconfirm wget git docker
|
||||
sudo pacman -Syu --noconfirm
|
||||
sudo pacman -S --noconfirm wget git docker
|
||||
```
|
||||
|
||||
[Optional] Install Docker build-kit:
|
||||
|
||||
[Optional] Install Docker BuildKit:
|
||||
```bash
|
||||
sudo pacman -S --noconfirm docker-buildx
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Alpine Linux:</summary>
|
||||
<summary>Alpine Linux</summary>
|
||||
|
||||
```bash
|
||||
sudo apk update
|
||||
sudo apk upgrade
|
||||
sudo apk update && sudo apk upgrade
|
||||
sudo apk add --no-cache wget git docker
|
||||
```
|
||||
|
||||
[Optional] Install Docker build-kit:
|
||||
|
||||
[Optional] Install Docker BuildKit:
|
||||
```bash
|
||||
sudo apk add --no-cache docker-cli-buildx
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### 2. Run the setup script:
|
||||
|
||||
Add your user to the docker group and login again:
|
||||
#### Step 2: Run the Setup Script
|
||||
After installing dependencies, configure Docker permissions and run the setup script:
|
||||
|
||||
1. Add your user to the Docker group and re-login:
|
||||
```bash
|
||||
sudo usermod -aG docker $USER && sudo su - $USER
|
||||
```
|
||||
|
||||
This will download & execute the `setup.sh` script.
|
||||
|
||||
2. Download and execute the `setup.sh` script:
|
||||
```bash
|
||||
mkdir -p ~/.db-middleware/scripts &&
|
||||
rm -rf ~/.db-middleware/scripts/* &&
|
||||
cd ~/.db-middleware/scripts &&
|
||||
wget -qO setup.sh https://gitea.abdulhade.com/abdulhade/db-middleware/raw/branch/main/scripts/setup.sh &&
|
||||
bash setup.sh
|
||||
mkdir -p ~/.db-middleware/scripts \
|
||||
&& rm -rf ~/.db-middleware/scripts/* \
|
||||
&& cd ~/.db-middleware/scripts \
|
||||
&& wget -qO setup.sh https://gitea.abdulhade.com/abdulhade/db-middleware/raw/branch/main/scripts/setup.sh \
|
||||
&& bash setup.sh
|
||||
```
|
||||
|
||||
<!-- #### 3. Add your user to the docker group:
|
||||
---
|
||||
|
||||
So you don't have to use `sudo` to run the script.
|
||||
## Configuration
|
||||
During installation, you will be prompted to configure the following variables:
|
||||
|
||||
### 1. API_PORT
|
||||
- Defines the port the middleware listens on.
|
||||
- **Default:** `8080`
|
||||
- Access within your machine: `http://localhost:8080`
|
||||
- Ensure this port is forwarded if external access is required.
|
||||
|
||||
### 2. CONTAINER_NAME
|
||||
- Specifies the name of the Docker container running the middleware.
|
||||
|
||||
### 3. HAS_LOCAL_DBS
|
||||
Determines how the middleware connects to databases:
|
||||
- **Enter `0`** – If the database is hosted on a remote server.
|
||||
- **Enter `1`** – If the database runs on the same machine.
|
||||
|
||||
> **Note:** By default, Docker containers operate on an isolated network. If your database is local, the middleware must be configured to run on the same network to ensure connectivity.
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
- [ ] **Test Your Setup** – Run a sample query to verify functionality.
|
||||
- [ ] **Configure External Access** – If needed, update firewall and network settings.
|
||||
- [ ] **Monitor Logs** – Use `docker logs <container_name>` to check for issues.
|
||||
|
||||
For further assistance, refer to the project documentation or open an issue in the repository.
|
||||
|
||||
```bash
|
||||
sudo usermod -aG docker $USER
|
||||
``` -->
|
||||
|
||||
Reference in New Issue
Block a user