syncstorage-rs icon indicating copy to clipboard operation
syncstorage-rs copied to clipboard

tokenserver Database Tables don't get populated

Open simpz opened this issue 2 years ago • 5 comments

Unless I've missed something in the documentation.

The Tokenserver Database tables don't get created unless you have:

tokenserver.run_migrations = true

set in the config file.

So the method needed to populate the tokenserver database fails:

INSERT IGNORE INTO services (id, service, pattern) VALUES ('1', 'sync-1.5', '{node}/1.5/{uid}'); INSERT INTO nodes (id, service, node, available, current_load, capacity, downed, backoff)
VALUES ('1', '1', '${DOMAIN}', '1', '0', '1', '0', '0') ON DUPLICATE KEY UPDATE node='${DOMAIN}';"

I notice,

tokenserver.run_migrations = true is set in the docker compose yaml files. so this issue is known?

Either the option is confusingly named or this requirement should be documented.

Spent ages trying to figure out why my build of syncserver-rs wasn't working and never setting up the tokenserver db.

┆Issue is synchronized with this Jira Task

simpz avatar Jan 04 '23 12:01 simpz

I had the same problem, you use the latest tag for the docker image, which hasn't been updated for 2 years (see #1362) If you use the 0.13.2 tag everything should work.

jonasled avatar Feb 10 '23 07:02 jonasled

Dropped my tables, because I still can't get things working.

Set my docker image to 0.13.2, and restarted syncstorage-rs, tables get filled but not the services and nodes tables.

So it's either not fixed, or I still miss config items for my docker container.

ictabc avatar Feb 13 '23 14:02 ictabc

You can compare your compose file with mine, maybe it helps:

version: "3.2"

services:
  syncserver:
    image: mozilla/syncstorage-rs:0.13.2
    restart: always
    environment:
      SYNC_HOST: 0.0.0.0
      SYNC_MASTER_SECRET: MY_SECRET
      SYNC_SYNCSTORAGE__DATABASE_URL: "mysql://user:[email protected]:3306/storage"
      SYNC_RUN_MIGRATIONS: "true"

      SYNC_TOKENSERVER__ENABLED: "true"
      SYNC_TOKENSERVER__RUN_MIGRATIONS: "true"
      SYNC_TOKENSERVER__NODE_TYPE: mysql
      SYNC_TOKENSERVER__DATABASE_URL: "mysql://user:[email protected]:3306/token"
      SYNC_TOKENSERVER__FXA_EMAIL_DOMAIN: api.accounts.firefox.com
      SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL: https://oauth.accounts.firefox.com/v1
      SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET: MY_OTHER_SECRET
      SYNC_TOKENSERVER__ADDITIONAL_BLOCKING_THREADS_FOR_FXA_REQUESTS: 2

jonasled avatar Feb 13 '23 15:02 jonasled

Same settings, just doesn't fills the services and nodes table.

ictabc avatar Feb 13 '23 15:02 ictabc

The issue is that we don't configure anywhere what domain we use, so these can't be filled. Maybe services can be filled. But we also need the node, but that info isn't given as a variable in the docker settings. So I think this can't work at this time. We need to add an environment variable, for the nodes to be added. If that is fixed.

Re-did it manually again.

ictabc avatar Feb 13 '23 16:02 ictabc