Git Product home page Git Product logo

d10s0vsky-oss / stack-lifecycle-deployment Goto Github PK

View Code? Open in Web Editor NEW
222.0 7.0 34.0 12.23 MB

OpenSource self-service infrastructure solution that defines and manages the complete lifecycle of resources used and provisioned into a cloud! It is a terraform UI with rest api for terraform and OpenTofu automation

License: MIT License

Shell 0.59% Dockerfile 0.35% Python 23.91% CSS 52.06% JavaScript 3.98% HTML 19.09% HCL 0.02%
terraform ui stack python api fastapi celery website continuous-deployment kubernetes

stack-lifecycle-deployment's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Stack Lifecycle Deployment

OpenSource solution that defines and manages the complete lifecycle of resources used and provisioned into a cloud!
Explore the docs Β»

Table of Contents
  1. About SLD
  2. Getting Started
  3. Usage
  4. Custom settings
  5. Architecture
  6. Roadmap
  7. Contributing
  8. License
  9. Contact
  10. Acknowledgements
  11. Built With

About SLD

SLD helps to accelerate deployment, weighting and making IaaC reusable, generating dynamic forms and maintaining different variables in each environment with the same code. With SLD you can schedule infrastructure deployments like its destruction, manage users by roles and separate stacks by squad and environment

Everything Is AWESOME

Product Name Screen Shot

Main features:

  • Fast API async
  • Dashboard / UI
  • Distributed tasks routing by squad
  • Infrastructure as code (IaC) based in terraform code
  • Dynamic html form from terraform variables
  • Re-deploy infrastructure keeping the above parameters
  • Distributed architecture based microservices
  • Task decouple and event driven pattern
  • Resilient, rollback deployment and retry if failure

SLD is the easy way to use your terrafrom code!

Getting Started

Prerequisites

You need docker and docker-compse or kind ( recomended ).

Installation

  1. Clone the SLD repo

    git clone https://github.com/D10S0VSkY-OSS/Stack-Lifecycle-Deployment.git
  2. Deploy SLD in k8s with kind

    cd Stack-Lifecycle-Deployment/play-with-sld/kubernetes 
    sh kplay.sh start

    Result:

    Starting SLD for play
    Creating cluster "kind" ...
    βœ“ Ensuring node image (kindest/node:v1.20.2) πŸ–Ό
    βœ“ Preparing nodes πŸ“¦ πŸ“¦  
    βœ“ Writing configuration πŸ“œ 
    βœ“ Starting control-plane πŸ•ΉοΈ 
    βœ“ Installing CNI πŸ”Œ 
    βœ“ Installing StorageClass πŸ’Ύ 
    βœ“ Joining worker nodes 🚜 
    Set kubectl context to "kind-kind"
    You can now use your cluster with:
    
    kubectl cluster-info --context kind-kind
  3. Create init user

    sh kplay.sh init

    Result:

    kind ok
    docker ok
    kubectl ok
    jq ok
    curl ok
    
    init SLD
    #################################################
    #  Now, you can play with SLD πŸ•ΉοΈ                #
    #################################################
    API: http://localhost:5000/docs
    DASHBOARD: http://localhost:5000/
    ---------------------------------------------
    username: admin
    password: Password08@
    ---------------------------------------------
    

    List endopints

    sh kplay.sh list

    Result:

    kind ok
    docker ok
    kubectl ok
    
    List endpoints
    API: http://localhost:8000/docs
    DASHBOARD: http://localhost:5000/

Usage

  1. Sign-in to DASHBOARD:

    sign-in

    Click the dashboard link:

    sign-in

  2. Add Cloud account

    sign-in

    fill in the form with the required data. in our example we will use

    • Squad: squad1
    • Environment: develop

    by default workers are running as squad1 and squad2 for play purpose, but you can change it and scale when you want

    When you add an account to a provider ( aws, gcp, azure ) one squad is created, you must create a worker for the name of the created squad, if you don't do it the deployment will remain in a "PENDING" state Read Workers

    finally add:

    • Access_key_id
    • Secret_access_key
    • Default_region ( default eu-west-1) In case you use assume role, fill in the rest of the data.
  3. Add terraform module or stack

    sign-in

    • Name: Add the name with a valid prefix according to the cloud provider.

    Prefixs supported: aws_ , gcp_, azure_

    You can pass user and password as https://username:[email protected]/aws_vpc For ssh you can pass it as a secret in the deployment to the user sld

    • Branch: Add the branch you want to deploy by default is master
    • Squad Access: Assign who you want to have access to this stack by squad

    '*' = gives access to all, you can allow access to one or many squads separated by commas: squad1,squad2

    • tf version: indicates the version of terraform required by the module or stack

    https://releases.hashicorp.com/terraform/

    • Description: Describe the module or stack to help others during implementation.
  4. Deploy your first stack!!!

    List stacks for deploy

    sign-in

    Choose deploy

    sign-in

    SLD will generate a dynamic form based on the stack variables, fill in the form and press the Deploy button

    sign-in

    Important! assign the same squad and environment that we previously created when adding the account (See Add Cloud account)

    Now, the status of the task will change as the deployment progresses.

    sign-in

    You can control the implementation life cycle sign-in You can destroy, re-implement that SLD will keep the old values ​​or you can also edit those values ​​at will. sign-in And finally you can manage the life cycle programmatically, handle the destruction / creation of the infrastructure, a good practice for the savings plan!!! sign-in

Custom settings

Storage backend

SLD uses its own remote backend, so you don't need to configure any backend in terraform. The following example shows a backend config

        terraform {
          backend "http" {
            address = "http://remote-state:8080/terraform_state/aws_vpc-squad1-develop-vpc_core"
            lock_address = "http://remote-state:8080/terraform_lock/aws_vpc-squad1-develop-vpc_core"
            lock_method = "PUT"
            unlock_address = "http://remote-state:8080/terraform_lock/aws_vpc-squad1-develop-vpc_core"
            unlock_method = "DELETE"
          }
        }
        

At the moment SLD supports MongoDB, S3 and local backend (for testing purposes only) To configure MongoDB as a backend, you must pass the following variables as parameters to the remote-state service:

# docker-compose.yaml
    environment:                                                                                                     
      SLD_STORE: mongodb                                                                                             
      SLD_MONGODB_URL: "mongodb:27017/"
      MONGODB_USER: admin
      MONGODB_PASSWD: admin
# k8s yaml
    env:
    - name: SLD_STORE
      value: mongodb
    - name: SLD_MONGODB_URL
      value: "mongodb:27017/"
    - name: MONGODB_USER
      value: admin
    - name: MONGODB_PASSWD
      value: admin

To configure S3 you can pass the access and secret keys of aws, in case SLD is running in AWS it is recommended to use roles

    env:
    - name: SLD_STORE
      value: "S3"
    - name: SLD_BUCKET
      value: "s3-sld-backend-cloud-tf-state"
    - name: AWS_ACCESS_KEY
      value: ""
    - name: AWS_SECRET_ACCESS_KEY
      value: ""

For Azure env you need set the next env

          env:                                                                                                                                    
          - name: SLD_STORE
            value: azure
          - name: AZURE_STORAGE_CONNECTION_STRING
            value: "DefaultEndpointsProtocol=https;AccountName=<YOUR ACCOUNT>;AccountKey=<YOUR ACCESS KEY>;EndpointSuffix=core.windows.net"

See azure-storage-configure-connection-string

For google cloud storage set:

SLD_STORE=gcp
export GOOGLE_APPLICATION_CREDENTIALS="/app/sld-gcp-credentials.json"

Import google service account key to k8s secret

kubectl create secret generic gcp-storage --from-file=~/Downloads/storage.json

Modify sld-remote-state.yml set gcp storage cloud backend and mount secret:

apiVersion: apps/v1                                                                                                                               
kind: Deployment                                                                                                                                  
metadata:                                                                                                                                         
  name: remote-state                                                                                                                              
  labels:                                                                                                                                         
    name: remote-state                                                                                                                            
spec:                                                                                                                                             
  replicas: 1                                                                                                                                     
  selector:                                                                                                                                       
    matchLabels:                                                                                                                                  
      name: remote-state         
  template:                                                                                                                                                                                                        
    metadata:                                                                  
      labels:                                                            
        name: remote-state                                               
    spec:                        
      subdomain: primary                                                                                                                                                                                                                                                        
      containers:                                                                              
        - name: remote-state                                                                   
          image: d10s0vsky/sld-remote-state:latest                                                                     
          volumeMounts:                    
          - name: gcp                                                                                                                                         
            mountPath: "/app/gcp"                                                                                                                                            
            readOnly: true                          
          env:                                      
          - name: SLD_STORE                         
            value: gcp                              
          - name: GOOGLE_APPLICATION_CREDENTIALS                                                                                                                                                                   
            value: "/app/gcp/storage.json"                                                                             
          resources:                                                
            limits:                                                 
              memory: 600Mi                                         
              cpu: 1                                                                                                                                                                                                                                                            
            requests:                                                          
              memory: 300Mi                                                    
              cpu: 500m                                                        
          imagePullPolicy: Always                                              
          command: ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1"]                                          
          ports:                                                                               
            - containerPort: 8080                                                              
          livenessProbe:                                                                       
            httpGet:                                                                           
              path: /                                                                          
              port: 8080                                                                                                                                                                      
              httpHeaders:                                                                                             
              - name: status                                                                                           
                value: healthy                                                                                         
            initialDelaySeconds: 60                                                                                    
            periodSeconds: 60                                                                                          
      volumes:                                                                                                         
      - name: gcp                                                                                                      
        secret:                                                                                                        
          secretName: gcp-storage                                                    

Data remote state

To be able to use the outputs of other stacks you can configure it as follows the key alwys is the same like "Task Name"

stack-name squad account env deploy name
aws_vpc squad1 develop vpc_core
data "terraform_remote_state" "vpc_core" {
  backend = "http"
  config = {
    address = "http://remote-state:8080/terraform_state/aws_vpc-squad1-develop-vpc_core"
  }
}

Test example:

echo "data.terraform_remote_state.vpc_core.outputs"|terraform console

Workers

The workers in sld are responsible for executing the infrastructure deployment. You can use one or more workers for each account or several accounts at the same time. It all depends on the degree of parallelism and segregation that you consider

# Example k8s worker for account squad1, change this for each of your accounts
# Stack-Lifecycle-Deployment/play-with-sld/kubernetes/k8s/sld-worker-squad1.yml
# Add replicas for increment paralelism
# Add more squad accounts if you want to group accounts in the same worker:
# command: ["celery", "--app", "tasks.celery_worker", "worker", "--loglevel=info", "-c", "1", "-E", "-Q", "squad1,"another_squad_account"]

apiVersion: apps/v1
kind: Deployment
metadata:
  name: stack-deploy-worker-squad1
  labels:
    name: stack-deploy-worker-squad1
spec:
  replicas: 1 
  selector:
    matchLabels:
      name: stack-deploy-worker-squad1
  template:
    metadata:
      labels:
        name: stack-deploy-worker-squad1
    spec:
      subdomain: primary
      containers:
        - name: stack-deploy-worker-squad1
          image: d10s0vsky/sld-api:latest
          imagePullPolicy: Always
          env:
          - name: TF_WARN_OUTPUT_ERRORS
            value: "1"
          resources:
            limits:
              memory: 600Mi
              cpu: 1
            requests:
              memory: 300Mi
              cpu: 500m
          command: ["celery", "--app", "tasks.celery_worker", "worker", "--loglevel=info", "-c", "1", "-E", "-Q", "squad1"]

  # Example docker-compose worker for account squad1, change this for each of your accounts
  # Stack-Lifecycle-Deployment/play-with-sld/docker/docker-compose.yml

  worker:
    image: d10s0vsky/sld-api:latest
    entrypoint: ["celery", "--app", "tasks.celery_worker", "worker", "--loglevel=info", "-c", "1", "-E", "-Q", "squad1"]
    environment:
      BROKER_USER: admin
      BROKER_PASSWD: admin
    depends_on:
      - rabbit
      - redis
      - db
      - remote-state

Users roles

SLD has three preconfigured roles for users to easily manage this.

roles scope description
yoda global Global scope, can see all squads and are full admin
darth_vader one or many squad Limit the scope of the squad, can see the assigned squads and you are a full manager of only those squads
stormtrooper one or many squad Limits squad range, can see assigned squads and can only deploy assigned deployment on belong squad
R2-D2 all, one or many squad This role is only for identification and must be associated with the previous ones, its use case is for bot users who access the api

Architecture

sign-in

Roadmap

  • LDAP and SSO authentication
  • Slack integration
  • FluenD / elasticSearch integration
  • InfluxDB integration
  • Prometheus
  • Estimate pricing by stack
  • Anomaly detection
  • Advance metrics and logs
  • Resource size recommendation based on metrics
  • Shift Left Security deployment
  • Multi tenancy
  • Topology graphs
  • Mutal TLS
  • Added workers automatically by squad
  • Onboarding resources
  • Add more cloud and on-prem providers

Contributing

Contributions are what makes the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

[email protected]

Stack Lifecycle Deployment

Acknowledgements

Built With

stack-lifecycle-deployment's People

Contributors

d10s0vsky-oss avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

stack-lifecycle-deployment's Issues

Update "Stack" failed

Hi @D10S0VSkY-OSS ,
When I tried to update a "Stack", edit -> "Update" OR click on "sync" the repo I got the error below:
image

Logs from sld-dashboard:

    • [05/Jul/2022:10:22:32 +0200] "GET /static/assets/vendor/simplebar/dist/simplebar.min.js HTTP/1.1" 304 0 "http://ac-sld:5000/edit-stack/2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
      • [05/Jul/2022:10:22:32 +0200] "GET /static/assets/vendor/vanillajs-datepicker/dist/js/datepicker.min.js HTTP/1.1" 304 0 "http://ac-sld:5000/edit-stack/2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
        [2022-07-05 10:23:07 +0200] [1] [CRITICAL] WORKER TIMEOUT (pid:22)
        [2022-07-05 10:23:07 +0200] [1] [CRITICAL] WORKER TIMEOUT (pid:24)
        [2022-07-05 10:23:07 +0200] [22] [INFO] Worker exiting (pid: 22)
        [2022-07-05 10:23:07 +0200] [24] [INFO] Worker exiting (pid: 24)
        [2022-07-05 10:23:07 +0200] [25] [INFO] Booting worker with pid: 25
        [2022-07-05 10:23:07 +0200] [1] [WARNING] Worker with pid 24 was terminated due to signal 9
        [2022-07-05 10:23:07 +0200] [26] [INFO] Booting worker with pid: 26

Thanks for your help.

Deploy record stuck

Discussed in #254

Originally posted by ramazulay March 10, 2024
Hi @D10S0VSkY-OSS,
How are you?
I installed the latest version and it looks amazing, thanks for your hard work.
I have a some bugs there, can I make an appointment and I will show you?

No inventory was parsed, only implicit localhost is available

When try to deploy stack with terraform 1.1.6, an error appear "No inventory was parsed, only implicit localhost is available", and then the deploy failed.

Terraform Version
1.1.6

SLD Version
2.1.1

Crash Output
No inventory was parsed, only implicit localhost is available

Debug Output

[2022-03-03 11:23:52,446: INFO/ForkPoolWorker-1] create config a-hismanto in /home/sld/.aws/config done
[2022-03-03 11:23:52,447: INFO/ForkPoolWorker-1] create credentials a-hismanto in /home/sld/.aws/credentials done
[2022-03-03 11:23:52,858: WARNING/ForkPoolWorker-1] [WARNING]: No inventory was parsed, only implicit localhost is available
[2022-03-03 11:24:07,533: WARNING/ForkPoolWorker-1] [WARNING]: Failed to list Terraform workspaces: workspaces not supported
[2022-03-03 11:24:07,534: WARNING/ForkPoolWorker-1] localhost | FAILED! => {
"changed": false,
"cmd": "/tmp/1.1.6/terraform destroy -no-color -auto-approve -lock=true -var-file aws_vpc.tfvars.json",
"msg": "\nError: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.\n\nPlease see https://registry.terraform.io/providers/hashicorp/aws\nfor more information about providing credentials.\n\nError: NoCredentialProviders: no valid providers in chain\ncaused by: EnvAccessKeyNotFound: failed to find credentials in the environment.\nSharedCredsLoad: failed to load profile, .\nEC2RoleRequestError: no EC2 instance role found\ncaused by: EC2MetadataError: failed to make EC2Metadata request\n404 Not Found\n\nThe resource could not be found.\n\n \n\tstatus code: 404, request id: \n\n\n with provider["registry.terraform.io/hashicorp/aws"],\n on provider.tf line 1, in provider "aws":\n 1: provider "aws" {",
"rc": 1,
"stderr": "\nError: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.\n\nPlease see https://registry.terraform.io/providers/hashicorp/aws\nfor more information about providing credentials.\n\nError: NoCredentialProviders: no valid providers in chain\ncaused by: EnvAccessKeyNotFound: failed to find credentials in the environment.\nSharedCredsLoad: failed to load profile, .\nEC2RoleRequestError: no EC2 instance role found\ncaused by: EC2MetadataError: failed to make EC2Metadata request\n404 Not Found\n\nThe resource could not be found.\n\n \n\tstatus code: 404, request id: \n\n\n with provider["registry.terraform.io/hashicorp/aws"],\n on provider.tf line 1, in provider "aws":\n 1: provider "aws" {\n\n",
"stderr_lines": [
"",
"Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.",
"",
"Please see https://registry.terraform.io/providers/hashicorp/aws",
"for more information about providing credentials.",
"",
"Error: NoCredentialProviders: no valid providers in chain",
"caused by: EnvAccessKeyNotFound: failed to find credentials in the environment.",
"SharedCredsLoad: failed to load profile, .",
"EC2RoleRequestError: no EC2 instance role found",
"caused by: EC2MetadataError: failed to make EC2Metadata request",
"404 Not Found",
"",
"The resource could not be found.",
"",
" ",
"\tstatus code: 404, request id: ",
"",
"",
" with provider["registry.terraform.io/hashicorp/aws"],",
" on provider.tf line 1, in provider "aws":",
" 1: provider "aws" {",
""
],
"stdout": "",
"stdout_lines": []
}

Clone deploy erro when name exist

Error in deployment when creating or cloning a deployment with a repeated name, results in an SQL error because a try-catch is not being implemented for the exception
image

Add OpenStack as supported cloud account

Would it be possible to add OpenStack as a supported cloud account? I can see it being something good to have as more and more smaller cloud providers are using OpenStack.

I'd also recommend being able to add more than 1, as sometimes we need to deploy to multiple OpenStack cloud providers.

Plan stuck in Pending state

Hi Team, need some help to move further. I added a stack and kicked of a plan and it is stuck in pending state forever.

Stacks as YAML?

Is it possible to define stacks using YAML files? Main idea being a sort of infrastructure as code.

Deploy status stuck on 'PENDING'

Hi,
I have a issue when I try to deploy, the status is stuck on 'PENDING'.
The SLD installed on EKS cluster.
The log from worker(stack-deploy-worker-default-7dcbdfd87f-57mvm):

[2022-04-07 13:18:34,045: INFO/MainProcess] Task pipeline git pull[f9c33aed-f988-426f-bdc4-25c99b29d48b] received
[2022-04-07 13:18:34,051: INFO/ForkPoolWorker-2] Download git repo https://github.com/D10S0VSkY-OSS/aws_vpc_poc branch master
[2022-04-07 13:18:34,983: WARNING/ForkPoolWorker-2] [WARNING]: No inventory was parsed, only implicit localhost is available
[2022-04-07 13:18:35,909: WARNING/ForkPoolWorker-2] localhost | SUCCESS => {
"after": "8076b398a8db5f535436298e912f1367b296088a",
"before": "8076b398a8db5f535436298e912f1367b296088a",
"changed": false,
"remote_url_changed": false
}
[2022-04-07 13:18:36,139: INFO/ForkPoolWorker-2] Task pipeline git pull[f9c33aed-f988-426f-bdc4-25c99b29d48b] succeeded in 2.092451297910884s: {'command': 'get_vars_json', 'rc': 0, 'stdout': '{"variable": {"region": {"default": "eu-west-1"}, "vpc_cidr": {"type": "string", "description": "The allowed block size is between a /28 netmask and /16 netmask", "default": "10.0.0.0/16"}, "subnet_cidr": {"type": "map("string")", "description": "Don't change this without first changing vpc_cidr", "default": {"be1": "10.0.0.0/24", "be2": "10.0.1.0/24", "fe1": "10.0.2.0/24", "fe2": "10.0.3.0/24"}}, "vpc_name": {"type": "string", "description": "Set VPC name without special characters", "default": "name"}, "enable_dns_support": {"type": "bool", "description": "Set true or false if you want dns support", "default": false}}}'}
[2022-04-07 13:21:06,506: INFO/MainProcess] Task pipeline git pull[ce2c9f7c-e3bc-4b75-9062-2294eb8db26f] received
[2022-04-07 13:21:06,508: INFO/ForkPoolWorker-2] Download git repo https://github.com/D10S0VSkY-OSS/aws_vpc_poc branch master
[2022-04-07 13:21:07,399: WARNING/ForkPoolWorker-2] [WARNING]: No inventory was parsed, only implicit localhost is available
[2022-04-07 13:21:08,401: WARNING/ForkPoolWorker-2] localhost | SUCCESS => {
"after": "8076b398a8db5f535436298e912f1367b296088a",
"before": "8076b398a8db5f535436298e912f1367b296088a",
"changed": false,
"remote_url_changed": false
}
[2022-04-07 13:21:08,604: INFO/ForkPoolWorker-2] Task pipeline git pull[ce2c9f7c-e3bc-4b75-9062-2294eb8db26f] succeeded in 2.096647311002016s: {'command': 'get_vars_json', 'rc': 0, 'stdout': '{"variable": {"region": {"default": "eu-west-1"}, "vpc_cidr": {"type": "string", "description": "The allowed block size is between a /28 netmask and /16 netmask", "default": "10.0.0.0/16"}, "subnet_cidr": {"type": "map("string")", "description": "Don't change this without first changing vpc_cidr", "default": {"be1": "10.0.0.0/24", "be2": "10.0.1.0/24", "fe1": "10.0.2.0/24", "fe2": "10.0.3.0/24"}}, "vpc_name": {"type": "string", "description": "Set VPC name without special characters", "default": "name"}, "enable_dns_support": {"type": "bool", "description": "Set true or false if you want dns support", "default": false}}}'}
[2022-04-07 13:21:15,040: INFO/MainProcess] Task pipeline git pull[a1fc132c-b86f-4acf-93c5-774e3350ed3c] received
[2022-04-07 13:21:15,043: INFO/ForkPoolWorker-2] Download git repo http://172.16.132.170/test-ram branch master
[2022-04-07 13:21:15,916: WARNING/ForkPoolWorker-2] [WARNING]: No inventory was parsed, only implicit localhost is available
[2022-04-07 13:21:16,408: WARNING/ForkPoolWorker-2] localhost | SUCCESS => {
"after": "a0b548490759552a9813a40cd58de96c0bbe6902",
"before": "a0b548490759552a9813a40cd58de96c0bbe6902",
"changed": false,
"remote_url_changed": false
}
[2022-04-07 13:21:16,604: INFO/ForkPoolWorker-2] Task pipeline git pull[a1fc132c-b86f-4acf-93c5-774e3350ed3c] succeeded in 1.5627696781884879s: {'command': 'get_vars_json', 'rc': 0, 'stdout': '{"variable": {"instance_type": {"type": "string", "description": "instance type", "default": "t2.micro"}}}'}
[2022-04-07 13:22:00,693: INFO/MainProcess] Task schedule remove[b1eb0191-7f1d-4c3e-a717-bd303c2b0e31] received
[2022-04-07 13:22:00,694: INFO/MainProcess] Task schedule add[922932d4-9b4b-40d2-8295-03372ccab376] received
[2022-04-07 13:22:00,701: INFO/ForkPoolWorker-2] Task schedule remove[b1eb0191-7f1d-4c3e-a717-bd303c2b0e31] succeeded in 0.0072300180327147245s: {'result': '{'11': 'removed'}'}
[2022-04-07 13:22:01,044: INFO/ForkPoolWorker-2] Task schedule add[922932d4-9b4b-40d2-8295-03372ccab376] succeeded in 0.34154637693427503s: {'deploy': 'start-test-sld_test-ram_test (trigger: cron[month='', day='', day_of_week='0-4', hour='', minute=''], next run at: 2022-04-07 13:23:00 CEST)', 'destroy': 'destroy-test-sld_test-ram_test (trigger: cron[month='', day='', day_of_week='0-4', hour='18', minute='30'], next run at: 2022-04-07 18:30:00 CEST)'}

The log from dashboard(sld-dashboard-75f9bf9476-l9rcr):

cko) Chrome/99.0.4844.51 Safari/537.36"
[2022-04-07 13:22:45 +0200] [1] [CRITICAL] WORKER TIMEOUT (pid:437)
[2022-04-07 13:22:45 +0200] [437] [INFO] Worker exiting (pid: 437)
[2022-04-07 13:22:45 +0200] [441] [INFO] Booting worker with pid: 441

The log from schedule(schedule-584bc87b48-xqz67):
INFO Get deploy info by id 11 - 200
INFO Update deploy info by id 11 - 409
INFO Job "start-test-sld_test-ram_test (trigger: cron[month='', day='', day_of_week='0-4', hour='', minute=''], next run at: 2022-04-07 13:34:00 CEST)" executed successfully
INFO Get deploy info by id 13 - 200
INFO Update deploy info by id 13 - 409
INFO Job "start-test_vpc_test-ram_test (trigger: cron[month='', day='', day_of_week='0-4', hour='', minute=''], next run at: 2022-04-07 13:34:00 CEST)" executed successfully
INFO Get deploy info by id 12 - 200
INFO Update deploy info by id 12 - 409
INFO Job "start-test-sld2_test-ram_test (trigger: cron[month='', day='', day_of_week='0-4', hour='', minute=''], next run at: 2022-04-07 13:34:00 CEST)" executed successfully
INFO: 172.16.143.162:58988 - "GET / HTTP/1.1" 200 OK

All other microservices show ok in the logs.
I tried to deploy manually with the same cred and I succeeded.

kubectl get all -n sld
NAME READY STATUS RESTARTS AGE
pod/api-backend-f949d77ff-kpkj5 1/1 Running 3 26h
pod/db-544bbbd454-4dc86 1/1 Running 0 26h
pod/rabbit-755f8645d9-9b9zq 1/1 Running 0 26h
pod/redis-b98595559-jhn9x 1/1 Running 0 26h
pod/remote-state-77b6c66b78-mpwpw 1/1 Running 0 26h
pod/schedule-584bc87b48-xqz67 1/1 Running 1 26h
pod/sld-dashboard-75f9bf9476-l9rcr 1/1 Running 0 23h
pod/stack-deploy-worker-default-7dcbdfd87f-57mvm 1/1 Running 0 23h
pod/stack-deploy-worker-squad1-699bdfff74-jlmzv 1/1 Running 0 23h
pod/stack-deploy-worker-squad2-866457b57f-m9b9x 1/1 Running 0 23h

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/api-backend NodePort 10.100.227.176 8000:30003/TCP 26h
service/db NodePort 10.100.53.70 3306:30006/TCP 26h
service/rabbit NodePort 10.100.92.172 5672:30001/TCP 26h
service/redis NodePort 10.100.56.110 6379:30002/TCP 26h
service/remote-state NodePort 10.100.10.91 8080:30004/TCP 26h
service/schedule NodePort 10.100.27.100 10000:30007/TCP 26h
service/sld-dashboard LoadBalancer 10.100.52.220 internal-XXXXXXXXX 5000:30005/TCP 26h

NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/api-backend 1/1 1 1 26h
deployment.apps/db 1/1 1 1 26h
deployment.apps/rabbit 1/1 1 1 26h
deployment.apps/redis 1/1 1 1 26h
deployment.apps/remote-state 1/1 1 1 26h
deployment.apps/schedule 1/1 1 1 26h
deployment.apps/sld-dashboard 1/1 1 1 26h
deployment.apps/stack-deploy-worker-default 1/1 1 1 26h
deployment.apps/stack-deploy-worker-squad1 1/1 1 1 26h
deployment.apps/stack-deploy-worker-squad2 1/1 1 1 26h

NAME DESIRED CURRENT READY AGE
replicaset.apps/api-backend-f949d77ff 1 1 1 26h
replicaset.apps/db-544bbbd454 1 1 1 26h
replicaset.apps/rabbit-755f8645d9 1 1 1 26h
replicaset.apps/redis-b98595559 1 1 1 26h
replicaset.apps/remote-state-77b6c66b78 1 1 1 26h
replicaset.apps/schedule-584bc87b48 1 1 1 26h
replicaset.apps/sld-dashboard-75f9bf9476 1 1 1 26h
replicaset.apps/stack-deploy-worker-default-7dcbdfd87f 1 1 1 26h
replicaset.apps/stack-deploy-worker-squad1-699bdfff74 1 1 1 26h
replicaset.apps/stack-deploy-worker-squad2-866457b57f 1 1 1 26h

Please assist.

Filter Deploys

Create a filter option for the deploys..

Filters from:

  • Stack
  • Squad
  • Environment
  • User
  • Action
  • Status

MODULE FAILURE See stdout/stderr for the exact error when try deploy with terraform 0.12.x and older.

when try deploy stack with terraform 0.12.x and older SLD crash message:

Terraform Version

0.12.x and older

SLD Version

latest

Crash Output

Exception: {'command': 'destroy', 'rc': 2, 'stdout': ['MODULE FAILURE\nSee stdout/stderr for the exact error']}

Debug Output

module_stderr": "Traceback (most recent call last):\n File \"/home/sld/.ansible/tmp/ansible-tmp-1632761458.0782676-142755-844871809039/AnsiballZ_terraf orm.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/sld/.ansible/tmp/ansible-tmp-1632761458.0782676-142755-844871809039/AnsiballZ_terrafor m.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/sld/.ansible/tmp/ansible-tmp-1632761458.07826 76-142755-844871809039/AnsiballZ_terraform.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.general.plugins.modul es.terraform', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n return _run_modul e_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_gl obals,\n File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_terraform_payload_90p18m_y/ansible_t erraform_payload.zip/ansible_collections/community/general/plugins/modules/terraform.py\", line 497, in <module>\n File \"/tmp/ansible_terraform_payload_90p1 8m_y/ansible_terraform_payload.zip/ansible_collections/community/general/plugins/modules/terraform.py\", line 393, in main\n File \"/tmp/ansible_terraform_pa yload_90p18m_y/ansible_terraform_payload.zip/ansible_collections/community/general/plugins/modules/terraform.py\", line 238, in get_version\n File \"/usr/lib /python3.8/json/__init__.py\", line 357, in loads\n return _default_decoder.decode(s)\n File \"/usr/lib/python3.8/json/decoder.py\", line 337, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/usr/lib/python3.8/json/decoder.py\", line 355, in raw_decode\n raise JSONDecodeError(\"Exp ecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

Steps to Reproduce

Create stack with terraform 0.12.x and older and try deploy

Private git repository

Hey @D10S0VSkY-OSS ,

I was very interested in SLD. Could you tell me if there is integration, does the distribution layer have integration with a private git repository?

Regards,

Backend storage

Discussed in #90

Originally posted by ramazulay August 3, 2022
Hi @D10S0VSkY-OSS,
Do you have an ETA for "Support storage backend gcp cloud storage and azure blob storage"

Thanks.

schedule pod crush

Hi @D10S0VSkY-OSS,
As I see you update the schedule image, please see the error log:
kubectl logs schedule-77ddb5d66f-58jt9 -n sld
INFO Check_Task Add schedule
INFO Adding job tentatively -- it will be properly scheduled when the scheduler starts
WARNING Can't validate in the api-backend, Set user and password bot in api-backend try 999 of 1000
INFO Get deploy by id 2 - 200 - squad1 - eup-dev
Traceback (most recent call last):
File "/app/./helpers/get_deploy_schedule.py", line 76, in get_deploy_by_id
"project_path": response["json"]["project_path"],
KeyError: 'project_path'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 4, in
uvicorn.main()
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 437, in main
run(app, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 463, in run
server.run()
File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/usr/local/lib/python3.10/dist-packages/uvicorn/config.py", line 458, in load
self.loaded_app = import_from_string(self.app)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/app/./main.py", line 11, in
init_check_schedule()
File "/app/./helpers/get_deploy_schedule.py", line 51, in init_check_schedule
raise err
File "/app/./helpers/get_deploy_schedule.py", line 49, in init_check_schedule
addDeployToSchedule(i)
File "/app/./helpers/get_deploy_schedule.py", line 232, in addDeployToSchedule
data = get_deploy_by_id(deploy_id)
File "/app/./helpers/get_deploy_schedule.py", line 80, in get_deploy_by_id
raise HTTPException(status_code=404, detail=f"{err}")
fastapi.exceptions.HTTPException

Thanks.

Terragrunt Support?

Really love this project and I'm hoping we can use it but our entire stack uses terragrunt which means we don't have any vanilla terraform to deploy. It's all provisioned and configured by terragrunt. Is there some way I can modify the stack config to use terragrunt or is this on the roadmap perhaps?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.