Skip to main content

Setup

Feature release status badge: PriPrev
PriPrev

danger

The DataOps Development Environment (DDE) is in private preview. Therefore, the service may be unavailable for periods of time. There also may be occasions where service elements are rebuilt, and things like your stored credentials are removed, and you will need to re-add. This poses no risk to the rest of DataOps and is completely isolated.

As good development practice dictates, whether developing on local machines, remotely, or in the cloud, never rely on these for safe storage of configuration/code. Always create a new branch before any changes, and regularly commit your changes to this branch.

You can use the DataOps Development Environment locally (DDE Local), but Docker must be installed on your computer. If you are restricted from installing Docker locally, see our documentation on using the DDE for remote development.

Prerequisites

You must have the following on your local machine before you can start:

  • Docker installed

  • Visual Studio Code installed

  • The VS Code Dev Containers extension installed

  • Be authenticated to Docker Hub for DataOps images:

    On your command line, run the following command:

      docker login --username  dataopsreadserviceuser --password qf2h9372fg3ioug384
  • Confirm that you can successfully run:

      docker run -it dataopslive/dataops-development-workspace:5-latest bash -c "date"

    and see a result like:

      ubuntu@ip-172-31-7-62:~$ docker run -it dataopslive/dataops-development-workspace:5-latest bash -c "date"
    Mon 20 Feb 2023 12:26:48 PM UTC

Setting up the DDE Local

  1. Open an existing repository in VS Code.

  2. Create a folder called .devcontainer.

    Note that this change is inside the repository, so if another user uses the DDE, you may already see this folder.

  3. Create a file called devcontainer.json inside the .devcontainer folder.

    Note that this change is inside the repository, so if another user uses the DDE, you may already see this file. Here is a minimal example:

    {
    "name": "DataOpsDDE",
    "image": "dataopslive/dataops-development-workspace:5-latest"
    }
  4. Reopen the folder inside a container by running the Dev Containers: Reopen in container command from either the command palette or the quick actions status bar item.

    DevCon Prompt

Configuring the DDE Local

Configuring development credentials

To configure credentials for this environment, you must to set the following environment variables.

Here are the steps to configure the DDE:

  1. Create a file inside the .devcontainer folder called devcontainer.env — if you are using a remote host, you need to create this file on the host.

  2. Add the below to this file, replacing the example values with your own credentials.

    DBT_ENV_SECRET_ACCOUNT=ACCOUNT_NAME
    DBT_ENV_SECRET_PASSWORD=PASSWORD123
    DBT_ENV_SECRET_USER=USERNAME
    DBT_ENV_ROLE=DATAOPS_WRITER # In a default project, this will be DATAOPS_WRITER
    DBT_ENV_WAREHOUSE=DATAOPS_TRANSFORMATION # In a default project, this will be DATAOPS_TRANSFORMATION
  3. Add a run argument to your devcontainer.json file to load the devcontainer.env file.

    {
    "runArgs": ["--env-file", ".devcontainer/devcontainer.env"]
    }

There are various ways to configure VS Code and Devcontainers to store and inject environment variables, some of which are documented in Tips and Tricks.

Configuring Git credentials

When trying to do your first commit, VS Code might prompt you to set your Git username and email. The commands it suggests need to be modified to remove the --global flag, as the change will not persist if the container is re-created.

Instead, your commands should look like this:

git config user.email "you@example.com"
git config user.name "Your Name"

Now, your Git config is set locally on the files mounted from the host computer and will persist.

Advanced configuration

You can extend your container environment to your own needs, but you will always benefit from building on top of the built-in tooling provided by the DDE. Here is a reference for what you can configure through the devcontainer.json file.