GithubHelp home page GithubHelp logo

dfc-iac's Introduction

Data For Change Infrastructure As Code

Prerequisites

Install Python Dependencies:

python3 -m pip install -r requirements.txt

Create a directory for secret files:

sudo mkdir -p /etc/dfc
sudo chown -R $USER /etc/dfc

Apps

The apps are defined using Docker Compose with some additional configurations under apps/

Anyway app is continuously deployed on any change to apps/anyway, the other apps need to be deployed manually.

To manage the apps you need to get a Vault TOKEN, access vault at https://vault.dataforchange.org.il and login. Once logged-in, click on your name in the top right corner and select "Copy token". Set the Token in an env var:

export VAULT_TOKEN=<paste token here>

You might need to get a new token occasionally, if you get an error message about an invalid token, just repeat the above steps.

Now you can run the apps management script to manage the apps, following are some examples:

# Run Docker Compose commands
bin/apps.py compose APP_NAME COMMAND
# for example:
bin/apps.py compose anyway ps
bin/apps.py compose anyway logs -f anyway-main

# SSH to the server
bin/apps.py ssh

# Run a command on the server
bin/apps.py ssh docker ps

# Deploy an app
bin/apps.py deploy_app APP_NAME

Terraform

Prerequisites:

Running locally

Initialize (should only be done once):

terraform init "-backend-config=$(bin/get_backend_config.py)"

Set secret envvars:

eval "$(bin/get_secret_envvars.py)"

Check the plan:

terraform plan

Apply:

terraform apply

dfc-iac's People

Contributors

atalyaalon avatar orihoch avatar

Watchers

 avatar

dfc-iac's Issues

Cannot log in to server via ssh or see logs

I followed README instructions but didn't manage to perform basic commands:

โžœ  dfc-iac git:(main) bin/apps.py ssh
Traceback (most recent call last):
  File "bin/apps.py", line 204, in <module>
    main(*sys.argv[1:])
  File "bin/apps.py", line 196, in main
    res = globals()[cmd](*args)
  File "bin/apps.py", line 46, in ssh
    hostname = ssh_init()
  File "bin/apps.py", line 30, in ssh_init
    data = get_vault_kv_path('projects/iac/docker-server')
  File "bin/apps.py", line 24, in get_vault_kv_path
    'VAULT_TOKEN': VAULT_TOKEN,
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'vault': 'vault'

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.