Server URL keeps resetting

Hi all,

I’m running an ODK-X sync-endpoint server. Every time I go to sync my data the server URL has changes from my server URL to the default opendatakit-simpledemo.appspot.com.

Any idea of what is happening and how to prevent this from happening?

Best,
Andreas

2 Likes

Hi Andreas,

Is it just the server URL that keeps reverting to default, or is it all the settings in ODKX Services (i.e. username etc.)?

I’m thinking perhaps there could be a permission problem persisting or retrieving the settings (writing to/reading from the SD-card) - does it manage to sync successfully when you type in the correct end point location?

best
/emil

1 Like

Hi Emil,

Only the server URL changes, the username and password is unchanged.
I have to change the URL, authenticate user, and then I can synchronize without any problems.

Best,
Andreas

1 Like

My guess is that the file /config/assets/app.properties has the incorrect address in it so when a sync happens the app.properties file gets reset to the “server” version which as the wrong URL.

The app level files are only changed by the administrator pushing to the server or with suitcase updating a file.

3 Likes

Thank you @W_Brunette.

Your guess was correct!

1 Like

@W_Brunette We also experienced this issue, but couldn’t figure out what exactly need to be done to get this app.properties uploaded with Suitcase, and to make it working on a tablet. Could you give me some hint?

I tried to create an admin password in the settings of ODK-X Tables app, and did not allow user to change, but the URL was still changed back to the demo site.

1 Like

I believe the app.properties file stores the server URL. The one on your server that the mobile devices are syncing to is wrong or doesn’t exist. You need to get a correct app.properties file setup on your server (e.g, sync-endpoint).

There are three ways to do this, I would suggest using either 1 or 2b.

Three approach/options

  1. Use the mobile device. Login as a user with administrator or site_admin permissions. A button will appear in the bottom right that will allow you to reset the server to match all the settings that are currently on the phone. However, this will reset all version strings so if you are already deployed with lots of users this is sub-optimal because they will all need to delete their opendatakit folder and get a fresh copy after the server is reset.
  2. Use suitcase. Two options here
    2a) Use suitcase upload feature with the ‘uploadop’ set to RESET_APP. You will need EVERYTHING correctly configured in a directory you point suitcase at. The RESET_APP should function similar to the “reset app” on the mobile device (Option #1 above, so same caveats).
    2b) Use suitcase upload feature with the ‘uploadop’ set to FILE. You will need to make sure you put the file in the right place/directory structure. You will also need to update the file with the correct URL. When you upload the corrected file to the server, the sync process will redistribute the file to the mobile devices on the mobile device next sync. This will mean that going forward the URL will default to the URL in app.properties.

For more information about ODK-X file structure see: https://docs.odk-x.org/config-file-structure/

2 Likes

@W_Brunette Many thanks for these details!

We uploaded the app.properties to this path on the server https://<server_url>/odktables/default/files/2/assets/app.properties . Is this correct path?

1 Like

I do not think so as you left out config.

Personally, I generally just recreate the structure on my computer and then point suitcase at it so I don’t have to think about it. Here is a previous topic that might help if you want to point to the correct server address: Map tiles not loaded

When I use suitecase I create the directory structure on the computer. Therefore, I create a directory and inside that directory I create a config directory and inside that an assets directory and then put the app.properties file in that. Then I point suitcase at the folder and use the RESET_APP most of the time.

For more information about ODK-X file structure see: https://docs.odk-x.org/config-file-structure/

1 Like

@W_Brunette note that the RESET_APP command doesn’t seem to be documented anywhere that I could find. If you can find that documentation that’s great! Otherwise we should create an issue to document that function.

@elmps2018 we do have an outstanding issue. I think the bigger issue is someone needs to take on looking at the available options in the code and write up documentation. The best step is to push for it to be prioritized at the meeting.

As an example, there is documentation generated by the Suitcase to help the user. However, it is not in our documentation.

1 Like

@W_Brunette We actually followed the examples here: ODK-X Sync Protocol

“downloadUrl”: “https://msundt-test.appspot.com:443/odktables/default/files/2/assets/app.properties

Now this works.