[App Server] cloning app do local server with user management

Hi there!

As my app gets mor ‘sophisticated’ I run into more problems.

When I clone an app with git, the user table contents are not cloned. Is that correct?

What do I have to do to migrate the app with the user table contents such that I can log in to the app when starting it locally?

Or is there a way to edit the contents locally before starting the app locally?

Kind regards,

Vinz

Hi @frvi2, data is not transferred to local server. You can use custom authentication to create an admin account when the form initiates:
https://anvil.works/docs/how-to/custom-user-auth

Then export all table from the Online Editor to cvs, then upload it back to the local server:
https://anvil.works/docs/data-tables/csv-and-excel

1 Like

Hi @Tony.Nguyen, thanks for clarifying! I will try the suggested way.

Vinz

A further note is that if files are stored in the tables, they are not exported.
If you have questions, please feel free to reply or post a topic. Good luck

Hi @Tony.Nguyen

Thanks again for the hint. I finally had a go on it.

For testing I simply exported the Users Table (as csv) and followed the instructions to upload the table into the running app (still in the cloud for testing).

I am able to select the exported csv as is. But when uploading I get an error message again regarding the column of the users table which is of type boolean…
It turns out the the import of the export table is not straight forward als also the date/time columns are recognized by the server when uploading.
I got stuck again…

Kind regards,

Vinz

Hi @frvi2,

I am afraid that uploading users will not work since it is quite complicated an issue. I have to use custom authentication: Anvil Docs | Custom user authentication

The more I work with the app server, the more I appreciate the hosted one, since much less headache. There is performance problem with the hosted app, but I can overcome easily.

Hi @Tony.Nguyen
Thanks for responding. The hosted server, even though I like it very much, cannot be the solution due to the nature of the data used in the app.

Hi @frvi2

Given that you seem to want to share authentication data between the hosted Anvil App and an on-site App Server, have you considered creating an HTTP Endpoint in a hosted app which your (different) local app could use for authentication? You could pass username and password from a custom login form, and have the endpoint return a dict of the authenticated user.

I hope that helps!

3 Likes

Hi @daviesian

Thanks for the Idea! I had another one yesterday. After cloning the app one can edit the anvil.yaml file to allow sign up of new users to create a first local user and then change the yaml file again to remove the sign up option again. This seems to work :grinning:. As I have only a small number of users, I don’t mind creating them again after relocating app.

1 Like

Hi @Tony.Nguyen
After managing the user migration problem, which works nicely now. I ran into what you mentioned in your response.
I should some migrate data tables containing files (actually ttf fonts). As you mentioned the files are not download, hoewever db scheme is.
Any idea on how migrate the files?

Kind regards,

Vinz @frvi2

Hi, I am glad that my comment helps.
Files are stored on my servers and links are saved to tables. Not really secured though.

If you need more security, please let me know

Hi,

Thanks for the hint. I may try that!

Kind regards,

Vinz