Moped Documentation
  • Welcome 👋
  • User Guides
    • Getting started
    • Map a project
  • Product Management
    • User communication
    • User management
    • User analytics
    • Local testing
    • Release process
    • Patch release process
    • MUI X Pro License
    • Integrations
      • Dataset documentation
      • ArcGIS Online
      • eCapris
      • Power BI
    • Features
  • Dev Guides
    • DB Docs & Data dictionary
    • Database backup policy
    • Moped Read Replica
    • How-to's
      • How do I start the Hasura cluster locally?
      • How do I launch the Hasura Console?
      • How do I get a JWT token?
      • How to ping the GraphQL API
      • How to ping the REST API
      • How do I connect a database with Postgres GUIs?
      • How do I connect to the RDS instance?
      • How to load production data into a local instance
      • How do I update seed data?
    • Hasura
      • Hasura Roles
      • Hasura Migrations
        • Getting Started
        • Installing the Hasura CLI
        • Configuration Files
        • Hasura Migration Principles
        • The Migration file format
        • Development
        • Hasura Seed Data
        • Running the Hasura Cluster Locally (video)
        • Create a migration: Exercise 1 (video)
        • Create a migration: Exercise 2 (video)
        • Latest hasura-cluster features
    • User Management
    • Authentication
      • Authentication Architecture
      • DynamoDB & Cognito
      • Secrets Manager & Cognito
      • Hasura & Cognito
      • React & Cognito
      • Flask API & Cognito
      • Single Sign-On with CTM
    • Code organization
    • API
      • Configuration Files
      • Testing
      • User Management API
    • Maps and geospatial data
      • Access tokens and API keys
      • Map libraries
      • Map data
      • Map styles
      • Map layers and basemaps
      • React patterns
      • V1 Archive
        • Map libraries
        • Map data
        • Map custom hooks
        • Map styles
        • Map layers and basemaps
    • UI access control
    • Design system
      • Branding
      • Component styles
      • Text content
    • Activity Log
      • Architecture
      • GitHub Actions and Deployment of Updates
      • Hasura Event Logs and Truncate Cron Job
      • Authentication
  • See also
  • Get Moped support, report a bug, or request an enhancement
  • Data & Technology Services
  • Github repository
Powered by GitBook
On this page
  • Read replica database access
  • Environment file setup
  • Troubleshooting suggestions

Was this helpful?

  1. Dev Guides
  2. How-to's

How to load production data into a local instance

PreviousHow do I connect to the RDS instance?NextHow do I update seed data?

Last updated 26 days ago

Was this helpful?

See the for more details

Read replica database access

TPW DTS maintains a read-only copy of the production database, also known as a "read replica." This allows us to more efficiently make certain database queries without risking performance of the primary read/write database. This is also the database system we use to copy data from production for a local environment. The Moped database lives in a unified AWS RDS instance, and you can learn more .

You will need permission to the unified database read replica and your read replica user will need select access on all tables in the Moped and Hasura schema. More information about user management can be found .

This can be requested via Moped Technical PM, Mike Dilley, or another member of the Data Technology Service dev team who has admin permissions in AWS where our unified database and read replica are managed.

Environment file setup

Once you have unified read replica credentials, you'll need to add them to an env file. exists to give you an example of what values need to be filled out. Simply copy the template and rename it to env with the values filled out.

From there, you should be able to run the ./hasura-cluster replicate command to pull a replica of production data into your local development environment.

Troubleshooting suggestions

If you encounter errors, here are a couple suggestions:

  1. Check the moped-database/snapshots folder. When the replicate command functions properly, you will see a .sql file with today's date (ex: `moped-database/snapshots/production-2024-10-10.sql) and there should be SQL code in that file of the dumped data from production in a snapshot format that can be inserted into your local Postgres instance. Check this /snapshots folder and any newly created .sql file because it may contain error message in lieu of functioning SQL code. This file and any included error messages can provide clues for troubleshooting.

  2. Try to test your Read Replica credentials (the same ones you'd put into the env file) with a SQL GUI like TablePlus and ensure your DB connection works independently of the moped codebase. If you can't connect, there may be a problem with your credentials or you may not have adequate access to the database.

  3. Make sure the IP address you are working from is listed on the approved whitelist managed in the AWS security groups. Reach out to an AWS admin on the dev team in case you need help ensuring your IP is on this list. It is possible that your IP address at home can change and you may need to verify and update your current IP in AWS. You may also consider logging into the CoA network via VPN (ex: Cisco AnyConnect) and confirming your connections works while effectively using the CoA network's IP address range.

  4. If you notice an error during replication like ERROR: role "staff" does not exist, you can ignore as this message is expected during a successful replication. We do not rely on roles during local testing and development.

atd-moped/moped-database/README.md
The env_template file
here
here