This guide tracks useful steps to learn how to maintain and modify this system.
- Go to https://transport.data.gouv.fr and explore the various public pages (home, search, details)
- Read the user documentation to understand the purpose and overall process
- Ask the team to get access to the admin dashboard
- Expect a bit of delay / cache refresh period
- Get into the dashboard and go around (via the "Administration" top link)
- Install the required tooling (Elixir/Erlang/Node/Postgres) - see readme
- Restore a production database - see readme
- Do not attempt to install the "validator" yet, nor to access the admin backoffice
- Make sure to run ChromeDriver in a way or another
- Run the test suite with
mix test
- Learn how to run a single test (see readme), as this is very useful for debugging
⚠️ All the tests should pass locally! If they don't, file an issue
(More will come here later, especially with Elixir 1.15+)
IO.puts(x)
IO.inspect(x, IEx.inspect_opts)
dbg
+iex -S mix phx.server
find apps/transport | entr -c mix run my_script.exs
@tag :focus
andfind debug.exs apps/transport/{lib,test} | entr -c mix cmd --app transport mix test --color --only focus
mix test apps/transport/test/transport/import_data_test.exs --only focus
doctest ImportData, import: true, tags: [:focus]
elixir --sname node -S mix phx.server
andiex --sname console --remsh node
(https://github.com/etalab/transport-site/pull/2960/files) to connect to a running node and make evaluations (useful to inspect ETS state for instance)- LiveBook in non-standalone mode (create a notebook then switch from standalone to connected in the settings)
- Check out the /stats page, entry point for bizdev questions on data quality
- Look at
_maps.html.eex
andmap.js
- Search the code responsible for
quality_features_query
- Go to https://transport.data.gouv.fr
- Click on "Analyser la qualité d'un fichier GTFS"
- Find a small GTFS file
- Check the result
- Run
mix phx.routes TransportWeb.Router
locally- Examine the listed routes
- Check-out
apps/transport/lib/transport_web/router.ex
where they are defined
- Check-out
apps/transport/lib/transport_web/plugs/router.ex
(/api
& the rest)- This top-level router is referred to in
apps/transport/lib/transport_web/endpoint.ex
- This top-level router is referred to in
- Run
mix phx.routes TransportWeb.API.Router
(this will list all the/api
sub-routes) - In short: the "endpoint" includes a main router, which in turn includes 3 sub-routers
- The site is deployed on Clever Cloud
- Install
clever-tools
clever login
clever --help
- Go to your local
transport-site
git clone clever link $$REPLACE_BY_APP_ID$$
(pickapp_id
in the Clever Cloud dashboard fortransport-site
)clever status
clever logs --help
clever logs
to stream the current logsclever logs --addon $$REPLACE_BY_PG_ADDON_ID$$
(pick addon_id at top-right of CC dashboard fortransport-site-postgresql
"Information" tab)
- Use a force push of your branch, e.g.
git push <remote> <branche>:prochainement -f
(so if your branch issome-feature
, this will usually be:git push origin some-feature:prochainement -f
) - This will trigger a redeploy. Redeploy process can be monitored from the Clever Cloud dashboard and takes roughly 5 to 10 minutes.
- If you see errors in the CC app logs due to Ecto migrations (due to divergence of branches), you'll want to reset the staging database (see below)
- Go to the Clever Cloud dashboard for the production Postgres database and download it locally
- Read the restore_db.sh script
- Go to the Clever Cloud dashboard for the staging Postgres database, and run
restore_db.sh
with proper parameters
- Make sure to link the correct app (production or staging) with
clever link $$REPLACE_BY_APP_ID$$
(as displayed in the staging/production app CC dashboards) - Verify the linking status with
clever applications
- Log with the app alias:
clever ssh --alias transport-prochainement
cd apps/transport/client
yarn outdated
shows the outdated packages (see here for a sample)- Use
yarn upgrade abc [def]
(doc) to upgrade one or more packages - Look into package.json to see how to specify versions
- Most javascript-enabled features are not tested specifically - use
prochainement
or a local rendering to verify if nothing is broken
- @thbar bought https://gumroad.com/l/gtfsbundle (available to the team on demand)
- Download a tiny GTFS (example)
- Check out this diagram
- Read the GTFS guide
- Read the GTFS-realtime guide
- Clone the transport-validator project locally
- Install Rust
- Install Rust Analyzer for VSCode completion
- Run all the tests with
cargo run test
- Compile the validator project with
cargo build --release
- Run it as a server with
./target/release/main
- Override in dev.secret.exs the
gtfs_validator_url
defined in dev.exs with the displayed host & port (e.g.http://127.0.0.1:7878
) - Run the site with
mix phx.server
- Go to
http://localhost:5000/validate
- Upload a GTFS file
- Verify that it goes through the Elixir apps logs, then the validator logs
- Make sure to have Rust Analyzer installed
- If you use VSCode, install the CodeLLDB extension to help with debugging
- Run "Debug unit tests in library 'validator'"
- Add a breakpoint and verify that it is effective
- Read this article for more information
- Clone the transpo-rt project locally
- TODO
- Clone https://github.com/CanalTP/transit_model/tree/master/gtfs2netexfr
- Compile it and launch the tests
- Download one GTFS and convert it locally
- Understanding the code behind #1373
- Overall architecture (diagram by Francis)
- Structure of the Umbrella app (apps)
- Measuring code coverage
- Discovering the database structure
- Clever Cloud deployment and operations (Sentry, UptimeRobot)
- Running import jobs (locally)
- Diving into import jobs (locally)
- What is GBFS (workshop, slides)
- How to upgrade Elixir, Erlang and Node
- How to launch linters etc (like CI does)