Staging

Setting Up Your Environment

Create a .envrc File

  1. Create the .envrc file:

    • In the root directory of the project, create a file named .envrc.

    • The file should contain the following lines (fill in the values or ask Trevor/Britton):

    shCopy codeexport ETHEREUM_RPC_URL=
    export OPTIMISM_RPC_URL=
    export ARBITRUM_RPC_URL=
    export AVALANCHE_RPC_URL=
    export POLYGON_RPC_URL=
    export PRIV_KEY=
  2. Use direnv to load environment variables:

    • We recommend using direnv to automatically load the environment variables when you enter the root directory.

    • Follow the instructions to install direnv and hook into your shell.

Create a Virtual Environment

  1. Create the virtual environment:

    shCopy codepython3 -m venv .venv
  2. Activate the virtual environment:

    shCopy codesource .venv/bin/activate
    • Note: If you are using a shell other than bash or zsh, you may need to use a different activate binary.

  3. Install dependencies:

    shCopy codepip install -r requirements.txt
  4. Allow direnv to load the .envrc file:

    shCopy codedirenv allow

Running the Server Locally

After setting up your environment, run the server locally with:

shCopy codeuvicorn frontend:app --host localhost --port 8080

Working on a Branch Locally

  1. Clone the repository:

    • Using HTTPS:

      shCopy codegit clone https://github.com/tristeroresearch/cache-half-full
    • Using SSH:

      shCopy codegit clone git@github.com:tristeroresearch/cache-half-full
  2. Check out the staging branch (or any other branch):

    shCopy codegit checkout staging
  3. Create a new branch:

    shCopy codegit checkout -b new_branch_name

Pushing Local Changes

  1. Add your changes:

    • Add everything:

      shCopy codegit add .
    • Add specific files:

      shCopy codegit add <file_path>
  2. Commit your changes:

    shCopy codegit commit -m "commit message"
  3. Push your changes:

    shCopy codegit push
  4. Push a new branch to origin:

    shCopy codegit push -u origin new_branch_name

Reading Logs

  1. Access logs and metrics:

    • Go to the Fly.io dashboard and ensure you have an invite.

    • Navigate to the Tristero project:

    View Logs and Metrics

Changing Secrets/Environment Variables of the Deployed App

  1. Install Flyctl:

    • Follow the instructions to install Flyctl.

  2. Log in to Flyctl:

    shCopy codeflyctl auth login
  3. Push to rebuild:

    • After making changes to secrets or environment variables, push to rebuild the staging app.

Last updated