MyETM is the central hub of the Energy Transition Model (ETM), allowing users to view saved scenarios and collections across different versions. To run MyETM locally, you will need to set up the entire ETM ecosystem, which consists of: MyETM: The central hub for scenario management. ETEngine: The main calculation system and API. ETModel: The front-end for creating scenarios with a user interface. ETSource: The repository containing source data required by ETEngine.
MyETM is released under the MIT License.
MyETM, ETEngine, and ETModel are configured to run with Docker (via Docker Compose), simplifying dependency management. This guide assumes that Docker is already installed and configured on your machine.
Ensure all ETM components reside in the same parent directory by cloning the repositories:
git clone https://github.com/quintel/etengine.git
git clone https://github.com/quintel/etmodel.git
git clone https://github.com/quintel/etsource.git
git clone https://github.com/quintel/myetm.git
This will create a directory with the following structure:
├─ parent_dir
│ ├─ etmodel
│ ├─ myetm
│ ├─ etsource
│ └─ etengine
ETSource requires a password to decrypt certain datasets. To set this up: 1. Create a .password file in the ETSource directory. 2. Obtain the password from the "Quintel → Shared" 1Password vault. 3. Save the password inside .password.
├─ etsource
│ ├─ .password # <- Place password here
│ ├─ carriers
│ ├─ config
│ ├─ datasets
Public users will not have access to encrypted datasets and should use alternative datasets as indicated in the documentation.
cd myetm
docker-compose builddocker-compose run --rm web bash -c 'chmod +x bin/setup && bin/rails db:drop && bin/setup'This command drops any existing database. Use only during initial setup!
For updates, install new dependencies using:
docker-compose run --rm web bin/setupThis command is idempotent and can be run anytime as needed.
docker-compose upOnce running, MyETM will be available at http://localhost:3002.
Installing MyETM on a local machine can be a bit involved, owing to the number of dependencies. Assuming you can run a 'normal' rails application on your local machine, you have to follow these steps to run MyETM.
-
Install the "Graphviz" library
- Mac users with [Homebrew][homebrew]:
brew install graphviz - Ubuntu:
sudo apt-get install graphviz libgraphviz-dev
- Mac users with [Homebrew][homebrew]:
-
Install "MySQL" server
- Mac: Install latest version using the [Native Package][mysql] (choose the 64-bit DMG version), or install via brew:
brew install mysql - Ubuntu:
sudo apt-get install mysql-server-5.5 libmysqlclient-dev
- Mac: Install latest version using the [Native Package][mysql] (choose the 64-bit DMG version), or install via brew:
-
Clone this repository with
git clone git@github.com:quintel/myetm.git -
Run
bundle installto install the dependencies required by MyETM. -
Clone a copy of [ETSource][etsource] –– which contains the data for each region:
cd ..; git clone git@github.com:quintel/etsource.gitcd etsource; bundle install
-
Create the database you specified in your "database.yml" file, and
- run
bundle exec rake db:prepareto create the tables and an administrator account –– whose name and password will be output at the end –– OR - run
bundle exec rake db:createto create your database and contact the private Quintel slack channel to fill your database with records from staging server
- run
-
Either way, log in with the auto generated administrator account first! You need to be an admin to set up your applications (see connecting ETEngine, ETModel and Collections below).
-
You're now ready to run MyETM! Fire up the Rails process with
bin/dev -p 3002. -
If you run into an dataset error, check out this explanation on CSV files
After setting up MyETM, configure it to communicate with ETEngine and ETModel:
- Log in to MyETM as an administrator.
- Navigate to Your Applications in the admin panel.
- Create new applications for ETEngine (Local), ETModel (Local) and Collections (Local).
- Copy the generated configuration into
config/settings.local.ymlfor both ETEngine and ETModel. Copy it into.env.localfor Collections.
This guide covers setting up your local ETM databases and importing scenarios using the dump-n-load architecture.
Important: MyETM must be set up first because it's the OAuth provider for ETEngine and ETModel. Follow the steps in order.
Note: If using Docker these steps are not necessary
brew install mysql
brew services start mysqlMyETM is the authentication provider for the entire ETM ecosystem, so it must be configured before ETEngine or ETModel.
cd myetm
bundle install
bin/rails db:prepareThis creates the database, runs migrations, and seeds an admin user. Save the password displayed in the output:
+------------------------------------------------------------------------------+
| Created admin user 'Seeded Admin' with password: aBc123Xy |
| and email: seeded_admin@localdevelopment.com. |
+------------------------------------------------------------------------------+
bin/dev -p 3002
# Or: rails s -p 3002Wait for "Listening on..." before proceeding.
cd etengine
bundle install
bin/rails db:prepareThis creates and initializes three databases for ETEngine:
etengine_development- Main application tables (scenarios, users, etc.)etengine_queue_development- Background job processing (Solid Queue)etengine_cache_development- Application caching (Solid Cache)
Note: db:prepare automatically sets up all three databases. You should see a seeded admin user with a password - save this password!
Warning: ETEngine requires ETSource to be cloned in the same parent directory. If you get errors about missing datasets, ensure etsource is cloned alongside etengine.
bin/dev -p 3000
# Or: rails s -p 3000Note: The first time you create a scenario, ETEngine calculates the base dataset (Netherlands). This takes 5-15 seconds. Be patient!
- MyETM: http://localhost:3002
- ETEngine: http://localhost:3000
You should be able to access both URLs in your browser.
To import scenarios, you first need a .etm file. There are two ways to get one:
If you have access to a production or staging MyETM instance:
-
Log in as admin
-
Navigate to admin section
- Click "Admin" in the navigation
- Click "All Scenarios" in the admin menu
- URL:
https://my.energytransitionmodel.com/admin/saved_scenarios
-
Filter for scenarios
- Check "Show Featured" to show only featured scenarios
- Filter by version, end year, or area code as needed
-
Select scenarios to export
- Click checkboxes next to desired scenarios
- Or click "Select all" to export all filtered scenarios
-
Export
- Click the "Export selected" button
- A
.etmfile will download (format:YYYYMMDDHHMM_env.etm)
-
Save the file
- File downloads to your Downloads folder by default
- Ready to import to your local environment
With both servers running and a .etm file ready:
cd myetm
bin/import-scenariosThe script will:
- Detect any
.etmfile - Warn you that import will modify your database
- Prompt for confirmation
- Load scenarios via ETEngine API
- Create SavedScenario records in MyETM
- Display results and ID mappings
Check the output for:
- Number of scenarios loaded
- Scenario ID mappings (production ID → local ID)
- Any warnings about missing data
- View in MyETM: http://localhost:3002
- Open in ETModel: http://localhost:3001 (requires ETModel setup)
bin/import-scenarios --user your.email@example.comBy default, scenarios are owned by the first admin user.
Control what happens when a scenario ID already exists:
# Always update existing scenarios (default)
bin/import-scenarios --on-dup update
# Always create new scenarios
bin/import-scenarios --on-dup create
# Prompt for each duplicate
bin/import-scenarios --on-dup prompt# Look for .etm files in db/dumps instead of ~/Downloads
bin/import-scenarios db/dumps
# Or specify exact file path
bin/import-scenarios /path/to/scenarios.etmbin/import-scenarios --helpProblem: Import fails with "Connection refused" or timeout errors
Solution: Ensure ETEngine is running on port 3000:
cd etengine
bin/dev -p 3000
# Wait for "Listening on..."Check that you can access http://localhost:3000 in your browser.
Problem: Script error: "Database connection failed" or similar
Solution: The import-scenarios script runs within MyETM's context. Ensure the database is set up:
cd myetm
bin/rails db:prepareProblem: "No users found in database!"
Solution: Re-run the seeds:
cd myetm
bin/rails db:seed
# Save the password displayed!
# You can then create an account with your own credentials and make yourself an admin if you like!Problem: Application fails with errors like "Table 'etengine_development.scenarios' doesn't exist" or "Unknown database" errors.
Root Causes:
- Database setup command was run in the wrong directory
- Partial/incomplete database setup from a previous attempt
- Running
db:createwithoutdb:schema:loadordb:prepare
Solutions:
-
Verify you're in the correct application directory:
pwd # Should show .../etengine, .../etmodel, or .../myetm
-
Complete fresh database setup:
# Drop all databases and start fresh bin/rails db:drop:all # Create and set up all databases (primary + cache + queue) bin/rails db:prepare # Verify tables were created bin/rails runner "puts Scenario.count rescue 'Error: scenarios table missing'"
-
Manual verification (for ETEngine):
# Check that all 3 databases exist with tables mysql -u root -e " SELECT 'PRIMARY' as DB, COUNT(*) as tables FROM information_schema.TABLES WHERE TABLE_SCHEMA='etengine_development' UNION SELECT 'QUEUE', COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='etengine_queue_development' UNION SELECT 'CACHE', COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='etengine_cache_development'; " # Should show: PRIMARY=18, QUEUE=13, CACHE=3
Understanding Multi-Database Architecture:
ETEngine and ETModel use multiple databases per application:
- Primary database: Main application tables (scenarios, users, etc.)
- Queue database: Background job management (Solid Queue)
- Cache database: Application caching (Solid Cache)
The db:prepare command automatically sets up ALL databases. If you see errors about missing tables:
- Check you ran
bundle installfirst - Ensure MySQL is running:
brew services start mysql - Try the complete fresh setup above
Problem: Import keeps asking about duplicate scenarios
Solution: Use --on-dup update to automatically update existing scenarios:
bin/import-scenarios --on-dup update ~/Downloads/scenarios.etmProblem: "No .etm scenario dump files found"
Solution:
- Ensure the file has a
.etmextension - Check you're looking in the right directory (defaults to
~/Downloads) - Specify the file path directly:
bin/import-scenarios /path/to/file.etm
Each .etm file contains:
From ETEngine:
- Slider values (user_values)
- Custom hourly curves
- User sortables
- Area code, end year, privacy settings
- Balanced values
From MyETM:
- Scenario title and description
- User permissions (owner, collaborators, viewers)
- Version tags
- Scenario ID history (tracks origin from production)
To create a .etm file from your local scenarios to share with your team:
- Access MyETM admin: https://my.energytransitionmodel.com/admin/saved_scenarios
- Select scenarios you want to export using checkboxes
- Click "Export selected" button
- Share the downloaded
.etmfile with your team
They can then import it using bin/import-scenarios.
After importing scenarios:
- Access them in MyETM at http://localhost:3002
- Set up ETModel to view and modify scenarios in the UI
- Use imported scenarios as starting points for development
- Export modified scenarios to share with your team