Giter Site home page Giter Site logo

zcemycl / alembic-rds-vpn-terraform Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 336 KB

Database migration from local to aws cloud using alembic.

License: MIT License

HCL 26.95% Python 67.07% Mako 1.49% Dockerfile 1.15% HTML 3.34%
alembic aws docker docker-compose postgresql rds terraform vpn secrets-manager boto3

alembic-rds-vpn-terraform's Introduction

alembic-rds-vpn-terraform

image

Local Development

Initialisation (DO NOT RUN AGAIN)

  • Start docker server for postgres. docker compose up --build
  • Install package. pip install -e .[dev,alembic]
  • Initialise alembic structure.
    alembic init alembic
    alembic -n dev revision --autogenerate -m "init persons table"
    alembic -n dev upgrade head
    

Maintance

  • Start docker server for postgres. docker compose up --build
  • Install package. pip install -e .[dev,alembic]
  • Initialise postgres table.
    alembic -n dev upgrade head
    
  • Update table.
    pip install -e .[dev,alembic]
    alembic -n dev revision --autogenerate -m "new feature"
    alembic -n dev upgrade head
    

Cloud Development

Initialisation (DO NOT RUN AGAIN)

  • Build cloud infrastructure for postgres.
    git clone https://github.com/OpenVPN/easy-rsa.git
    cd easy-rsa/easyrsa3
    ./easyrsa init-pki
    ./easyrsa build-ca  # add your passphrase
    ./easyrsa build-server-full server nopass
    ./easyrsa build-client-full client1.domain.tld nopass
    mkdir ~/my-vpn-files/
    cp pki/ca.crt ~/my-vpn-files/
    cp pki/issued/server.crt ~/my-vpn-files/
    cp pki/private/server.key ~/my-vpn-files/
    cp pki/issued/client1.domain.tld.crt ~/my-vpn-files
    cp pki/private/client1.domain.tld.key ~/my-vpn-files/
    cd architecture
    terraform init
    terraform apply -auto-approve
    
  • Download VPN file.
    • AWS Console > VPN Endpoint > download client configuration > downloaded-client-config.ovpn
    • In downloaded-client-config.ovpn, above reneg-sec 0 and below </ca>, insert followings...
      <cert>
      # ...from client1.domain.tld.cert wrapped (Don't include this line)
      -----BEGIN CERTIFICATE-----
      xxxxxx
      -----END CERTIFICATE-----
      </cert>
      
      <key>
      # ...from client1.domain.tld.key wrapped (Don't include this line)
      -----BEGIN PRIVATE KEY-----
      xxxxxx
      -----END PRIVATE KEY-----
      </key>
      
    • Import downloaded-client-config.ovpn to openvpn client.
  • Install package. pip install -e .[dev,alembic]
  • Initialise alembic structure.
    export AWS_ACCESS_KEY_ID=
    export AWS_SECRET_ACCESS_KEY=
    export AWS_DEFAULT_REGION=
    alembic init alembic
    alembic -n cloud revision --autogenerate -m "init persons table"
    alembic -n cloud upgrade head
    

Maintance

  • Install package. pip install -e .[dev,alembic]
  • Initialise postgres table.
    export AWS_ACCESS_KEY_ID=
    export AWS_SECRET_ACCESS_KEY=
    export AWS_DEFAULT_REGION=
    alembic -n cloud upgrade head
    
  • Update table.
    export AWS_ACCESS_KEY_ID=
    export AWS_SECRET_ACCESS_KEY=
    export AWS_DEFAULT_REGION=
    pip install -e .[dev,alembic]
    alembic -n cloud revision --autogenerate -m "new feature"
    alembic -n cloud upgrade head
    

Entity Relationship Diagram

alembic-rds-vpn-terraform's People

Contributors

zcemycl avatar

Watchers

 avatar

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.