add: adding support for devops stratagies
This commit is contained in:
parent
090d6f4eb3
commit
d53a80a767
10 changed files with 392 additions and 0 deletions
75
devops/README.md
Normal file
75
devops/README.md
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
# Protevus Platform DevOps
|
||||||
|
|
||||||
|
This directory contains Docker and Kubernetes configurations for the Protevus Platform. It is organized to support our containerization and orchestration needs across different environments.
|
||||||
|
|
||||||
|
## Directory Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
devops/
|
||||||
|
├── docker/
|
||||||
|
│ ├── Dockerfile
|
||||||
|
│ ├── docker-compose.yml
|
||||||
|
│ └── .dockerignore
|
||||||
|
├── kubernetes/
|
||||||
|
│ ├── deployment.yaml
|
||||||
|
│ ├── service.yaml
|
||||||
|
│ ├── ingress.yaml
|
||||||
|
│ └── configmap.yaml
|
||||||
|
├── scripts/
|
||||||
|
│ ├── docker-build.sh
|
||||||
|
│ ├── docker-push.sh
|
||||||
|
│ ├── k8s-deploy.sh
|
||||||
|
│ └── k8s-rollback.sh
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
### docker/
|
||||||
|
|
||||||
|
This directory contains Docker-related files for building and running the Protevus Platform in containers.
|
||||||
|
|
||||||
|
- `Dockerfile`: Defines the container image for the Protevus Platform.
|
||||||
|
- `docker-compose.yml`: Configures multi-container Docker applications for local development.
|
||||||
|
- `.dockerignore`: Specifies which files and directories should be excluded when building Docker images.
|
||||||
|
|
||||||
|
### kubernetes/
|
||||||
|
|
||||||
|
The kubernetes/ directory houses Kubernetes manifests for deploying and managing the Protevus Platform in a Kubernetes cluster.
|
||||||
|
|
||||||
|
- `deployment.yaml`: Defines the deployment configuration for the Protevus Platform.
|
||||||
|
- `service.yaml`: Specifies the service configuration for exposing the platform.
|
||||||
|
- `ingress.yaml`: Configures ingress rules for routing external traffic to the service.
|
||||||
|
- `configmap.yaml`: Stores configuration data that can be consumed by pods.
|
||||||
|
|
||||||
|
### scripts/
|
||||||
|
|
||||||
|
This directory contains utility scripts for Docker and Kubernetes operations.
|
||||||
|
|
||||||
|
- `docker-build.sh`: Script for building Docker images.
|
||||||
|
- `docker-push.sh`: Script for pushing Docker images to a registry.
|
||||||
|
- `k8s-deploy.sh`: Script for deploying the application to a Kubernetes cluster.
|
||||||
|
- `k8s-rollback.sh`: Script for rolling back a Kubernetes deployment.
|
||||||
|
|
||||||
|
## Usage Guidelines
|
||||||
|
|
||||||
|
1. Use the provided scripts in the `scripts/` directory for common Docker and Kubernetes operations.
|
||||||
|
2. Ensure all configuration files are properly parameterized for different environments (dev, staging, production).
|
||||||
|
3. Keep sensitive information (like passwords and API keys) out of these files and use Kubernetes secrets instead.
|
||||||
|
4. Regularly update and test these configurations as the Protevus Platform evolves.
|
||||||
|
|
||||||
|
## Deployment Process
|
||||||
|
|
||||||
|
1. Build the Docker image using `scripts/docker-build.sh`.
|
||||||
|
2. Push the image to the container registry with `scripts/docker-push.sh`.
|
||||||
|
3. Deploy to Kubernetes using `scripts/k8s-deploy.sh`.
|
||||||
|
4. If needed, rollback the deployment using `scripts/k8s-rollback.sh`.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
When contributing to the DevOps configurations:
|
||||||
|
|
||||||
|
1. Test all changes thoroughly in a non-production environment before applying to production.
|
||||||
|
2. Document any new scripts or significant changes to existing configurations.
|
||||||
|
3. Follow Kubernetes and Docker best practices for security and efficiency.
|
||||||
|
4. Submit a pull request with a clear description of the changes and their purpose.
|
||||||
|
|
||||||
|
For any questions or suggestions regarding the DevOps setup, please contact the Protevus Platform infrastructure team.
|
172
devops/docker/README.md
Normal file
172
devops/docker/README.md
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
# Docker Services
|
||||||
|
|
||||||
|
The required applications by the framework can be run using the docker compose files provided in this folder.
|
||||||
|
|
||||||
|
## PostreSQL
|
||||||
|
|
||||||
|
### Starting the PostreSQL container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-pg.yml -p pg up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stopping the PostreSQL container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-pg.yml -p pg stop
|
||||||
|
docker compose -f docker-compose-pg.yml -p pg down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking the PostreSQL container log
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs docker-pg-1 -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running psql
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec -it <container id> /bin/bash
|
||||||
|
psql --username postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create PostgreSQL database, user and grant access
|
||||||
|
|
||||||
|
```sql
|
||||||
|
create database orm_test;
|
||||||
|
create user test with encrypted password 'test123';
|
||||||
|
grant all privileges on database orm_test to test;
|
||||||
|
```
|
||||||
|
|
||||||
|
## MariaDB
|
||||||
|
|
||||||
|
### Starting the MariaDB container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-mariadb.yml -p maria up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stopping the MariaDB container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-mariadb.yml -p maria stop
|
||||||
|
docker compose -f docker-compose-mariadb.yml -p maria down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking the MariaDB container log
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs maria-mariadb-1 -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create MariaDB database, user and grant access
|
||||||
|
|
||||||
|
```sql
|
||||||
|
create database orm_test;
|
||||||
|
|
||||||
|
-- Granting localhost access only
|
||||||
|
create user 'test'@'localhost' identified by 'test123';
|
||||||
|
grant all privileges on orm_test.* to 'test'@'localhost';
|
||||||
|
|
||||||
|
-- Granting localhost and remote access
|
||||||
|
create user 'test'@'%' identified by 'test123';
|
||||||
|
grant all privileges on orm_test.* to 'test'@'%';
|
||||||
|
```
|
||||||
|
|
||||||
|
## MySQL
|
||||||
|
|
||||||
|
### Starting the MySQL container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-mysql.yml -p mysql up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stopping the MySQL container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-mysql.yml -p mysql stop
|
||||||
|
docker compose -f docker-compose-mysql.yml -p mysql down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking the MySQL container log
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs mysql-mysql-1 -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create MySQL database, user and grant access
|
||||||
|
|
||||||
|
```sql
|
||||||
|
create database orm_test;
|
||||||
|
|
||||||
|
-- Granting localhost access only
|
||||||
|
create user 'test'@'localhost' identified by 'test123';
|
||||||
|
grant all privileges on orm_test.* to 'test'@'localhost';
|
||||||
|
|
||||||
|
-- Granting localhost and remote access
|
||||||
|
create user 'test'@'%' identified by 'test123';
|
||||||
|
grant all privileges on orm_test.* to 'test'@'%';
|
||||||
|
```
|
||||||
|
|
||||||
|
## MongoDB
|
||||||
|
|
||||||
|
### Starting the MongoDB container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-mongo.yml -p mongo up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stopping the MongoDB container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-mongo.yml -p mongo stop
|
||||||
|
docker compose -f docker-compose-mongo.yml -p mongo down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking the MongoDB container log
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs mongo-mongo-1 -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## rethinkDB
|
||||||
|
|
||||||
|
### Starting the rethinkDB container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-rethinkdb.yml -p rethink up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stopping the rethinkDB container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-rethinkdb.yml -p rethink stop
|
||||||
|
docker compose -f docker-compose-rethinkdb.yml -p rethink down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking the rethinkDB container log
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs rethink-rethinkdb-1 -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## Redis
|
||||||
|
|
||||||
|
### Starting the Redis container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-redis.yml -p redis up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stopping the Redis container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose-redis.yml -p redis stop
|
||||||
|
docker compose -f docker-compose-redis.yml -p redis down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking the Redis container log
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs redis-redis-1 -f
|
||||||
|
```
|
19
devops/docker/services/docker-compose-mariadb.yml
Normal file
19
devops/docker/services/docker-compose-mariadb.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: mariadb:latest
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
environment:
|
||||||
|
- MARIADB_ROOT_PASSWORD=Qwerty
|
||||||
|
volumes:
|
||||||
|
- "mariadb:/var/lib/mysql"
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mariadb:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
appnet:
|
37
devops/docker/services/docker-compose-mongo.yml
Normal file
37
devops/docker/services/docker-compose-mongo.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
services:
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
restart: no
|
||||||
|
ports:
|
||||||
|
- 27017:27017
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: Qwerty
|
||||||
|
MONGO_INITDB_DATABASE: local
|
||||||
|
volumes:
|
||||||
|
- "mongo:/data/db"
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
mongo-express:
|
||||||
|
image: mongo-express
|
||||||
|
restart: no
|
||||||
|
depends_on:
|
||||||
|
- mongo
|
||||||
|
ports:
|
||||||
|
- 8081:8081
|
||||||
|
environment:
|
||||||
|
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||||
|
ME_CONFIG_MONGODB_ADMINPASSWORD: Qwerty
|
||||||
|
ME_CONFIG_MONGODB_URL: mongodb://root:Qwerty@mongo:27017/
|
||||||
|
ME_CONFIG_BASICAUTH: false
|
||||||
|
networks:
|
||||||
|
- webnet
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mongo:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
appnet:
|
19
devops/docker/services/docker-compose-mysql.yml
Normal file
19
devops/docker/services/docker-compose-mysql.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:latest
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=Qwerty
|
||||||
|
volumes:
|
||||||
|
- "mysql:/var/lib/mysql"
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
appnet:
|
31
devops/docker/services/docker-compose-pg.yml
Normal file
31
devops/docker/services/docker-compose-pg.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
services:
|
||||||
|
pgdb:
|
||||||
|
image: postgres:latest
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
volumes:
|
||||||
|
- "db:/var/lib/postgresql/data"
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
pgadmin4:
|
||||||
|
image: dpage/pgadmin4:latest
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "5050:80"
|
||||||
|
environment:
|
||||||
|
- PGADMIN_DEFAULT_EMAIL=admin@mydomain.com
|
||||||
|
- PGADMIN_DEFAULT_PASSWORD=Qwerty
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
appnet:
|
20
devops/docker/services/docker-compose-redis.yml
Normal file
20
devops/docker/services/docker-compose-redis.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
volumes:
|
||||||
|
- "redis:/data"
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
redis:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
appnet:
|
19
devops/docker/services/docker-compose-rethinkdb.yml
Normal file
19
devops/docker/services/docker-compose-rethinkdb.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
services:
|
||||||
|
rethinkdb:
|
||||||
|
image: rethinkdb:latest
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
- "28015:28015"
|
||||||
|
- "29015:29015"
|
||||||
|
volumes:
|
||||||
|
- "rethinkdb:/data"
|
||||||
|
networks:
|
||||||
|
- appnet
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
rethinkdb:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
appnet:
|
Loading…
Reference in a new issue