Giter Club home page Giter Club logo

data-marketplace-infrastructure's Introduction

Data-marketplace infrastructure

This code can be used to create infrasturcture which includes for services of data marketplace.

Pre-requisites:

Local development

Use assume role access to run terraform plan locally.

  • Require AWS user account with assume role (ROLE_ARN=arn:aws:iam::855859226163:role/dm-gen-devops-role) access

  • Create sts session keys

    export ROLE_ARN="arn:aws:iam::855859226163:role/dm-gen-devops-role"
    export MFA_DEVICE_ARN="arn:aws:iam::855859226163:mfa/<MFANAME>"
    
    aws sts assume-role \
      --role-arn "$ROLE_ARN" \
      --serial-number "$MFA_DEVICE_ARN" \
      --token-code "<MFA_CODE>" \
      --role-session-name "terraform-session"
    
    export AWS_PROFILE=terraform-session
    

Alternately, the jump host (adm-instance) on AWS account can be used for deployment as well.

For Environment Creation:

There are multiple environments: dev, tst, mvp. One can create any other environment by copying one of them and updating the variables section (for example, CIDR, env name, etc). Below process is for dev envrionment creation. By replacing the dev to other environment, one can create the other environment as well

  • Run cd dev

  • Run terraform init

  • Run terraform plan and check the output. If the output is what you expect and there are no errors:

  • Run terraform apply

    If CoreDNS patch failed for due to some error then run terraform apply again and then kubectl rollout restart -n kube-system deployment coredns

  • For SSO, define client settings on security.gov.uk (for first time, only once!)

  • For restricted access to the env, create cognito user pool and define app client in the userpool

  • Go to Paramater Store in AWS Systems Manager portal and fill in the values for the parameters for /dm/dev/*.

  • Generate ACM for the required domain (To be automated)

  • cd app.

  • Create .env file with parameters (dev.env file is a template file for .env)

  • Then run sh dm-deploy.sh install.

  • define a custom DNS record (CNAME) for Application Load Balancer DNS

  • Update the EFS backup for the newly create environment.

Destroy Resources:

If you want to destroy the dev environment:

  • Run sh dm-deploy.sh uninstall from the app folder.
  • cd dev , then run terraform destroy
  • remove kubernetes config for the environment.

MVP & TST environments destroyed as new test environments created by AGM in Azure Cloud.

Update the services

  • cd app.
  • Create .env file with parameters (dev.env file is a template file for .env)
  • Then run sh dm-deploy.sh update.

Backup and Restore

Backend database fuseki using EFS as persistence and its protected by AWS backup service. Backup restore can be done manually in the event of any data loss using AWS backup restore feature.

Add IAM users to aws_auth config if required

kubectl edit configmap aws-auth -n kube-system

mapUsers: |
    - userarn: arn:aws:iam::<AWS_ACCOUNT_ID>:user/<USERNAME>
      username: admin
      groups:
        - system:masters

Additional improvements notes

CoreDNS plugin resources created for MVP environment to avoid applying DNS patching. Dev environment is still using CoreDNS patching which is controlled through terraform variable.

TODO by Code

  • Generate certificate the new test domain
  • Add DNS record for the new environment
  • CI/CD for IaC & app deployment
  • Import AWS backup resource creation in IaC

data-marketplace-infrastructure's People

Contributors

crinaid avatar prakash-cddo avatar soydaner avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

data-marketplace-infrastructure's Issues

deploy services

deployment of frontend, backend aoi and backend fuseki services

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.