polyglot-sentences

module
v0.0.0-...-fd201ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: MIT

README ΒΆ

Polyglot Sentences

Polyglot Sentences is a Go-based application designed to help users learn and master sentences in multiple languages. The app provides a wide range of sentence structures and vocabulary to facilitate language learning through practical and contextual examples.

Go Version

  • The project uses Go version 1.22.5

Installation and Setup

To simplify the installation and setup process for developers, we have provided an install_service.sh script. This script will:

  • Check if Docker is installed, and if not, it will install Docker.
  • Install Docker Compose if it is not already installed.
  • Set up the environment file.
  • Run Docker Compose to start the necessary containers.
  • Wait for the PostgreSQL and Kong containers to be ready.
  • Run the database migrations.
  • Set up the services in the API Gateway.
  • Set up the API Gateway.
Steps to Install and Run the Service
  • Make the script executable:
chmod +x install_service.sh
  • Run the script:
./install_service.sh

Default admin user detail

  • username(email): john.doe@gmail.com
  • password: QWer123!@#

Project Architecture

The project is structured using the Hexagonal Architecture. Here’s an overview of the directory structure:

πŸ“polyglot-sentences/
β”œβ”€β”€ πŸ“.github/
β”œβ”€β”€ πŸ“cmd/
β”‚   β”œβ”€β”€ πŸ“apigateway/
β”‚   β”‚   └── πŸ“„main.go
β”‚   β”œβ”€β”€ πŸ“authserver/
β”‚   β”‚   └── πŸ“„main.go
β”‚   β”œβ”€β”€ πŸ“migration/
β”‚   β”‚   └── πŸ“„main.go
β”‚   β”œβ”€β”€ πŸ“notificationserver/
β”‚   β”‚   └── πŸ“„main.go
β”‚   β”œβ”€β”€ πŸ“setup/
β”‚   β”‚   └── πŸ“„setup.go
β”‚   └── πŸ“userserver/
β”‚       └── πŸ“„main.go
β”œβ”€β”€ πŸ“deploy/
β”‚   β”œβ”€β”€ πŸ“„Deployment.yml
β”‚   └── πŸ“„Service.yml
β”œβ”€β”€ πŸ“docker/
β”‚   β”œβ”€β”€ πŸ“alertmanager/
β”‚   β”œβ”€β”€ πŸ“elk/
β”‚   β”œβ”€β”€ πŸ“grafana/
β”‚   β”œβ”€β”€ πŸ“kong/
β”‚   └── πŸ“prometheus/
β”œβ”€β”€ πŸ“docs/
β”‚   β”œβ”€β”€ πŸ“„docs.go
β”‚   β”œβ”€β”€ πŸ“„swagger.json
β”‚   └── πŸ“„swagger.yaml
β”œβ”€β”€ πŸ“internal/
β”‚   β”œβ”€β”€ πŸ“adapter/
β”‚   β”‚   β”œβ”€β”€ πŸ“constant/
β”‚   β”‚   β”‚   └── πŸ“„messages.go
β”‚   β”‚   β”œβ”€β”€ πŸ“email/
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_sendgrid.go
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„sendgrid.go
β”‚   β”‚   β”‚   └── πŸ“„sendgrid_test.go
β”‚   β”‚   β”œβ”€β”€ πŸ“grpc/
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“client/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_user_client.go
β”‚   β”‚   β”‚   β”‚   └── πŸ“„user_client.go
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“proto/
β”‚   β”‚   β”‚   β”‚   └── πŸ“user/
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ πŸ“„user.pb.go
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ πŸ“„user.proto
β”‚   β”‚   β”‚   β”‚       └── πŸ“„user_grpc.pb.go
β”‚   β”‚   β”‚   └── πŸ“server/
β”‚   β”‚   β”‚       └── πŸ“„user_server.go
β”‚   β”‚   β”œβ”€β”€ πŸ“http/
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“handler/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„health.go
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„status_code_mapping.go
β”‚   β”‚   β”‚   β”‚   └── πŸ“„user.go
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“middleware/
β”‚   β”‚   β”‚   β”‚   └── πŸ“„custom_recovery.go
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“presenter/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„base.go
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„base_test.go
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„user.go
β”‚   β”‚   β”‚   β”‚   └── πŸ“„user_test.go
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“request/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„base.go
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„user.go
β”‚   β”‚   β”‚   β”‚   └── πŸ“„user_test.go
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“routes/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„auth_router.go
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„router.go
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„swagger.go
β”‚   β”‚   β”‚   β”‚   └── πŸ“„user_router.go
β”‚   β”‚   β”‚   └── πŸ“validations/
β”‚   β”‚   β”‚       β”œβ”€β”€ πŸ“„validator.go
β”‚   β”‚   β”‚       └── πŸ“„validator_test.go
β”‚   β”‚   β”œβ”€β”€ πŸ“messagebroker/
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„queue.go
β”‚   β”‚   β”‚   └── πŸ“„rabbitmq.go
β”‚   β”‚   β”œβ”€β”€ πŸ“minio/
β”‚   β”‚   β”‚   └── πŸ“„client.go
β”‚   β”‚   └── πŸ“storage/
β”‚   β”‚       β”œβ”€β”€ πŸ“postgres/
β”‚   β”‚       β”‚   β”œβ”€β”€ πŸ“authrepository/
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„access_control.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_access_control.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_permission.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_role.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_unit_of_work.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„permission.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„role.go
β”‚   β”‚       β”‚   β”‚   └── πŸ“„unit_of_work.go
β”‚   β”‚       β”‚   β”œβ”€β”€ πŸ“migrations/
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„202404031147_create_users_table.down.sql
β”‚   β”‚       β”‚   β”‚   └── πŸ“„202404031147_create_users_table.up.sql
β”‚   β”‚       β”‚   β”œβ”€β”€ πŸ“tests/
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„access_control_test.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„permission_test.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„repositories_test.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„role_test.go
β”‚   β”‚       β”‚   β”‚   └── πŸ“„user_test.go
β”‚   β”‚       β”‚   β”œβ”€β”€ πŸ“userrepository/
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_unit_of_work.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„mock_user.go
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„unit_of_work.go
β”‚   β”‚       β”‚   β”‚   └── πŸ“„user.go
β”‚   β”‚       β”‚   └── πŸ“„db.go
β”‚   β”‚       └── πŸ“redis/
β”‚   β”‚           β”œβ”€β”€ πŸ“authrepository/
β”‚   β”‚           β”‚   β”œβ”€β”€ πŸ“„auth.go
β”‚   β”‚           β”‚   β”œβ”€β”€ πŸ“„mock_auth.go
β”‚   β”‚           β”‚   β”œβ”€β”€ πŸ“„mock_otp.go
β”‚   β”‚           β”‚   β”œβ”€β”€ πŸ“„mock_role.go
β”‚   β”‚           β”‚   β”œβ”€β”€ πŸ“„otp.go
β”‚   β”‚           β”‚   └── πŸ“„role.go
β”‚   β”‚           └── πŸ“„db.go
β”‚   └── πŸ“core/
β”‚       β”œβ”€β”€ πŸ“config/
β”‚       β”‚   └── πŸ“„config.go
β”‚       β”œβ”€β”€ πŸ“constant/
β”‚       β”‚   └── πŸ“„cache.go
β”‚       β”œβ”€β”€ πŸ“domain/
β”‚       β”‚   β”œβ”€β”€ πŸ“„access_control.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„base.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„grammer.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„language.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„permission.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„role.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„sentence.go
β”‚       β”‚   └── πŸ“„user.go
β”‚       β”œβ”€β”€ πŸ“event/
β”‚       β”‚   └── πŸ“authevent/
β”‚       β”‚       β”œβ”€β”€ πŸ“„send_email_otp_queue.go
β”‚       β”‚       β”œβ”€β”€ πŸ“„send_reset_password_link_queue.go
β”‚       β”‚       └── πŸ“„send_welcome_queue.go
β”‚       β”œβ”€β”€ πŸ“port/
β”‚       β”‚   β”œβ”€β”€ πŸ“„access_control.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„aut.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„email.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„event.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„otp.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„permission.go
β”‚       β”‚   β”œβ”€β”€ πŸ“„role.go
β”‚       β”‚   └── πŸ“„user.go
β”‚       β”œβ”€β”€ πŸ“service/
β”‚       β”‚   β”œβ”€β”€ πŸ“authservice/
β”‚       β”‚   β”‚   └── πŸ“„jwt.go
β”‚       β”‚   β”œβ”€β”€ πŸ“roleservice/
β”‚       β”‚   β”‚   β”œβ”€β”€ πŸ“„cache.go
β”‚       β”‚   β”‚   └── πŸ“„role.go
β”‚       β”‚   └── πŸ“userservice/
β”‚       β”‚       └── πŸ“„user.go
β”‚       └── πŸ“views/
β”‚           └── πŸ“email/
β”‚               β”œβ”€β”€ πŸ“auth
β”‚               β”‚   β”œβ”€β”€ πŸ“„verify_email.html
β”‚               β”‚   └── πŸ“„welcome.html
β”‚               └── πŸ“„base.html
β”œβ”€β”€ πŸ“logs/
β”‚   └── πŸ“„logs-2024-05-21.log
β”œβ”€β”€ πŸ“pkg/
β”‚   β”œβ”€β”€ πŸ“claim/
β”‚   β”‚   └── πŸ“„gin.go
β”‚   β”œβ”€β”€ πŸ“helper/
β”‚   β”‚   β”œβ”€β”€ πŸ“„authenticate.go
β”‚   β”‚   β”œβ”€β”€ πŸ“„authenticate_bench_test.go
β”‚   β”‚   └── πŸ“„string.go
β”‚   β”œβ”€β”€ πŸ“logger/
β”‚   β”‚   β”œβ”€β”€ πŸ“„const.go
β”‚   β”‚   └── πŸ“„logger.go
β”‚   β”œβ”€β”€ πŸ“metrics/
β”‚   β”‚   β”œβ”€β”€ πŸ“„counters.go
β”‚   β”‚   └── πŸ“„histograms.go
β”‚   β”œβ”€β”€ πŸ“oauth/
β”‚   β”‚   └── πŸ“„google.go
β”‚   β”œβ”€β”€ πŸ“serviceerror/
β”‚   β”‚   β”œβ”€β”€ πŸ“„error_message.go
β”‚   β”‚   β”œβ”€β”€ πŸ“„grpc.go
β”‚   β”‚   └── πŸ“„service_error.go
β”‚   └── πŸ“translation/
β”‚       β”œβ”€β”€ πŸ“„trans.go
β”‚       └── πŸ“lang/
β”‚           β”œβ”€β”€ πŸ“„ar.json
β”‚           β”œβ”€β”€ πŸ“„en.json
β”‚           └── πŸ“„fa.json
β”œβ”€β”€ πŸ“proto/
β”‚   └── πŸ“common/
β”‚       β”œβ”€β”€ πŸ“„error_details.pb.go
β”‚       └── πŸ“„error_details.proto
β”œβ”€β”€ πŸ“„go.mod
β”œβ”€β”€ πŸ“„.env
└── πŸ“„docker-compose.yml

Profiling

To profile the application, we use the pprof tool for CPU, goroutine, and memory usage data.

curl http://localhost:2526/debug/pprof/goroutine --output goroutine.o
go tool pprof -http=:2020 goroutine.o

Make sure the debug mode is enabled for the above links to work.

API Gateway

We use Kong as the API gateway for managing the APIs. The APIs are available at http://localhost:8000. You can access the Kong Dashboard here: workspaces

Requirements

Authentication/Authorization:

  • Proto buffer: To get user details, run the protoc command for the user management service:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/common/error_details.proto
protoc --experimental_allow_proto3_optional --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
internal/adapter/grpc/proto/user/user.proto

User Management

Questions Management

Questions Planner

Telegram Integration

Test

Setup

Create a .env.test file with the necessary test environment variables.

Running Tests

To run the tests, execute:

go test -cover -count=1 ./...

To generate a coverage profile:

go test -covermode=count -coverprofile=prof.out ./...

To visualize the coverage profile:

go tool cover -html=prof.out
Test Suites

The project includes comprehensive test suites to ensure the functionality and reliability of the codebase, covering various components and features.

Running All Tests

To run all the tests in the project:

go test ./... -v

Linter

To install the linter package:

go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

To check code with the linter:

golangci-lint run

Cloud

Install minikube in local machine

  1. Download the Minikube binary:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
  1. Install Minikube and remove the binary:
sudo install minikube-linux-amd64 /usr/local/bin/minikube
rm minikube-linux-amd64
  1. Start Minikube:
minikube start
minikube start --memory=6144 --cpus=4
  1. Verify the Minikube installation:
minikube status
  1. Check Kubernetes pods across all namespaces:
kubectl get po -A
  1. Configure Docker to use Minikube's Docker daemon:
eval $(minikube -p minikube docker-env)
  1. List Docker images:
docker images
Create Polyglot sentences namespace
  1. Create the polyglot-sentences namespace:
kubectl create namespace polyglot-sentences
  1. Set the current context to the polyglot-sentences namespace:
kubectl config set-context --current --namespace=polyglot-sentences
Create config map
  1. Apply the configuration map from the specified YAML file:
kubectl apply -f deploy/configs/config-maps.yaml
  1. Verify the config maps:
kubectl get configmaps
kubectl describe configmap polyglot-sentences-env-config
kubectl describe configmap polyglot-sentences-file-config
Create Services
  1. Apply the auth-service configuration:
kubectl apply -f deploy/authservice/service.yaml
  1. Apply the gRPC user management service configuration:
kubectl apply -f deploy/userservice/grpc-service.yaml
  1. Apply the HTTP user management service configuration:
kubectl apply -f deploy/userservice/http-service.yaml
  1. Verify the created services:
kubectl get services -o wide
Create Secrets for environments
  1. Create a secret for the polyglot-sentences namespace:
kubectl -n=polyglot-sentences create secret generic polyglot-sentences-secret --from-literal JWT_ACCESS_TOKEN_SECRET="your-access-token-secret" --from-literal SEND_GRID_KEY="send-grid-key"
  1. Verify the secret:
kubectl get secret polyglot-sentences-secret -o yaml
Create deployments
  1. Apply the user management deployment:
kubectl apply -f deploy/userservice/deployment.yaml
  1. Apply the authentication deployment:
kubectl apply -f deploy/authservice/deployment.yaml
  1. Apply the notification deployment:
kubectl apply -f deploy/notificationservice/deployment.yaml
  1. Verify the deployments:
kubectl get deployments -o wide
  1. Check the status of the pods:
kubectl get pods -o wide

Apply all Micro services related configurations at once:

kubectl apply -f deploy/userservice
kubectl apply -f deploy/authservice
kubectl apply -f deploy/notificationservice

Rollout deployments for apply new version images

  1. Rollout restart for all deployments in the polyglot-sentences namespace:
kubectl rollout restart deployment -n polyglot-sentences
  1. Rollout restart specific deployments:
kubectl rollout restart deployment.apps/auth-deployment -n polyglot-sentences
kubectl rollout restart deployment.apps/user-management-deployment -n polyglot-sentences
kubectl rollout restart deployment.apps/notification-deployment -n polyglot-sentences

Jenkins

  1. Create the jenkins namespace:
kubectl create namespace jenkins
  1. Set the current context to the jenkins namespace:
kubectl config set-context --current --namespace=jenkins
  1. Apply the Jenkins persistent volume configuration:
kubectl apply -f deploy/jenkins/persistent-volume.yaml
  1. Apply the Jenkins persistent volume claim configuration:
kubectl apply -f deploy/jenkins/persistent-volume-claim.yaml
  1. Verify the persistent volume:
kubectl get pvc
kubectl describe pvc jenkins-volume-claim
  1. Apply the Jenkins service configuration:
kubectl apply -f deploy/jenkins/service.yaml
  1. Apply the Jenkins master deployment configuration:
kubectl apply -f deploy/jenkins/master-deployment.yaml
  1. Apply all Jenkins-related configurations at once:
kubectl apply -f deploy/jenkins
Setup docker sock API
  1. Edit the Docker service file:
sudo nano /lib/systemd/system/docker.service
  1. Find and remove the following line: ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  2. Replace it with:
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock
  1. Reload the systemd daemon and restart Docker:
sudo systemctl daemon-reload
sudo service docker restart
  1. Check the Docker service status:
sudo service docker status
  1. Verify the Docker daemon is working:
curl http://localhost:4243/version

Dashboard URL

http://jenkins.local:30080
  • Get jenkins secrets
kubectl -n jenkins exec -it $(kubectl get pods -n jenkins -o jsonpath="{.items[0].metadata.name}") -- cat /var/jenkins_home/secrets/initialAdminPassword
plugins

After running the Jenkins service, navigate to: Manage Jenkins -> System Configuration -> Plugins -> Available plugins. Search for and install the following plugins:

  • Kubernetes
  • SSH Agent
  • Blue Ocean
  • ThinBackup
  • Slack Notification
  • Role-based Authorization Strategy

Setup Kubernetes plugins

To configure the Kubernetes plugin, follow these steps:

  1. Go to: Manage Jenkins -> Clouds -> New cloud, select Kubernetes, and enter a name (e.g., kubernetes).
  2. Set the Kubernetes URL by retrieving it with the following command:
kubectl cluster-info
  1. Check the Disable https certificate check option.
  2. Set the Kubernetes Namespace to jenkins.
  3. Add credentials:
  • Select Secret text
    • ID: JENKINS_SECRET
    • For the secret, retrieve the Kubernetes service account token by following these steps:
kubectl create serviceaccount jenkins --namespace=jenkins
kubectl apply -f deploy/jenkins/token.yaml
kubectl create rolebinding jenkins-admin-binding --clusterrole=admin --serviceaccount=jenkins:jenkins --namespace=jenkins
TOKEN_NAME=$(kubectl get secret --namespace=jenkins | grep jenkins-token | awk '{print $1}')
kubectl describe secret $TOKEN_NAME --namespace=jenkins
  1. Check WebSocket under the connection options.

Credentials

  • Docker Hub: Use Username and Password.
    • ID: docker-hub-credentials
    • Username: Your Docker Hub Username.
    • Password: Your Docker Hub Password.
  • Kubernetes: Use service account token as Secret text.
  • GitHub App: Use the following:
    • ID: GitHub-APP
    • App ID: Your GitHub App ID
    • Token: Convert and provide the token with $ cat path/to/converted-github-app.pem
  • DB_PASSWORD_TEST: Use Secret text (Your test DB password).
  • DB_PASSWORD_STAGE: Use Secret text (Your stage DB password).
  • SSH Agent: Use SSH Username with private key:
    • ID: k8s
    • Username: Kubernetes host user
    • Private key:
      • Generate: $ ssh-keygen -t rsa -b 4096 -C "jenkins@example.com"
      • Copy: $ ssh-copy-id Β«kubernetes host userΒ»@Β«kubernetes remote addressΒ»
      • Retrieve value: $ cat ~/.ssh/id_rsa

Variable

  • DB_HOST_TEST: Your test DB Host address
  • DB_PORT_TEST: 5425
  • DB_NAME_TEST: Your test DB name
  • DB_USERNAME_TEST: Your test DB username
  • REDIS_HOST_TEST: Your test Redis Host address
  • REDIS_PORT_TEST: 6325
  • K8S_USER: Kubernetes host user
  • K8S_REMOTE_ADDRESS: Kubernetes remote address
  • DB_HOST_STAGE: Your stage DB Host address
  • DB_PORT_STAGE: 5425
  • DB_NAME_STAGE: Your stage DB name
  • DB_USERNAME_STAGE: Your stage DB username

Jobs

First Job: Polyglot Sentences Linting and Run Test
  1. Name: Polyglot Sentences linting and run test
  2. Trigger: Check GitHub hook trigger for GITScm polling
  3. Pipeline:
    • Definition: Pipeline script from SCM
    • SCM: Git
    • Repository URL: https://github.com/mohsenabedy91/polyglot-sentences.git
    • Credentials: GitHub-APP
    • Branches to build:
      • Branch Specifier: :^(?!origin/master$|origin/develop$).*
    • Script Path: jenkinsfile-linter-and-test
Second Job: Polyglot Sentences Deploy to Develop
  1. Name: Polyglot Sentences deploy to develop
  2. Trigger: Check GitHub hook trigger for GITScm polling
  3. Pipeline:
    • Definition: Pipeline script from SCM
    • SCM: Git
    • Repository URL: https://github.com/mohsenabedy91/polyglot-sentences.git
    • Credentials: GitHub-APP
    • Branches to build:
      • Branch Specifier: */develop
    • Script Path: Jenkinsfile

Kong Api gateway

  1. Create the kong namespace:
kubectl create namespace kong
  1. Set the current context to the kong namespace:
kubectl config set-context --current --namespace=kong
  1. Create a ConfigMap for Kong plugins:
kubectl create configmap kong-plugins --from-file=/path/to/polyglot-sentences/docker/kong/plugins/ps-authorize/
  1. Verify the ConfigMap:
kubectl get configmaps
kubectl describe configmap kong-plugins
  1. Create a secret for the Kong database:
kubectl -n=kong create secret generic kong-db-secrets --from-literal POSTGRES_PASSWORD="password"
  1. Verify the secret:
kubectl get secret
kubectl describe secret kong-db-secrets
  1. Apply the Kong persistent volume claim configuration:
kubectl apply -f deploy/kong/persistent-volume-claim.yaml
  1. Verify the persistent volume:
kubectl get pvc
kubectl describe pvc gateway-postgres-volume-claim
  1. Apply the PostgreSQL service configuration for Kong:
kubectl apply -f deploy/kong/postgres-service.yaml
  1. Apply the PostgreSQL deployment configuration for Kong:
kubectl apply -f deploy/kong/postgres-deployment.yaml
  1. Apply the Kong service configuration:
kubectl apply -f deploy/kong/kong-service.yaml
  1. Apply the Kong ingress configuration:
kubectl apply -f deploy/kong/ingress.yaml
  1. Apply the Kong deployment configuration:
kubectl apply -f deploy/kong/kong-deployment.yaml
  1. Check the status of the pods:
kubectl get pods -o wide
  1. Apply all Kong-related configurations at once:
kubectl apply -f deploy/kong
  1. Rollout restart for all deployments in the kong namespace:
kubectl rollout restart deployment -n kong

Dashboard URL

http://kong.local:30080

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL