Back

(Automate) how can I create the administration user for appwrite without GUI?

  • 0
  • Tools
Victor
22 Aug, 2023, 10:08

I need to automate the deploymnet/recreation of appwrite and need a way to create automatically the administrator of AppWrite using the CLI.

I tried to check the config files, .env and everything I saw around, also inspected the appwrite-cli but apparently the only way to create the administration user (the very first account) is only possible with the webpage.

How can I do that?

TL;DR
The problem is that the user wants to create the administration user for Appwrite without using the GUI. There doesn't seem to be a documented CLI command for this. However, one suggestion is to inspect the network traffic of the Appwrite Console to see what requests are made and then manually make those requests using curl or a similar tool. This is an undocumented method, so it may not be reliable or stable in future versions of Appwrite.
Drake
22 Aug, 2023, 18:29

Even the Appwrite Console uses Appwrite's APIs. So, you can look at the network traffic to see what requests are made and then manually make those network requests with curl or whatever you prefer

Victor
23 Aug, 2023, 08:16

so I guess there is no CLI command for that, and the recommendation is to use the (undocumented?) API... @Steven is it reliable and stable to trust not to change in future versions?

Drake
23 Aug, 2023, 15:35

What do you mean by undocumented APIs? All the APIs are documented. For example: https://appwrite.io/docs/server/databases?sdk=dart-default

ideclon
23 Aug, 2023, 21:36

To my knowledge, there’s no (documented) API for managing Console users? Or is the Console it’s own Project, and @Victor can just use the regular Users API?

Drake
23 Aug, 2023, 22:06

Yes, it's the same API but for the console project

Victor
25 Aug, 2023, 07:50

what I mean is that there is no pointer on how to create the very first user, the admin

Victor
25 Aug, 2023, 07:50

and I found no pointer nowhere on how to create the organization it belongs to, which is apparently part of the teams API already

Victor
25 Aug, 2023, 07:55

e.g to create anew admin I needed to use v1/account and assign to it on a team with a POST to v1/teams using the cookie. If I repeat the operation no proper error is coming, just a 500 saying Server Error etc

Victor
25 Aug, 2023, 08:23

additionally, console is not accessible from the cli, and with rest... basically I did login and reused the cookie

Victor
25 Aug, 2023, 08:23

(and observed the interactions on the browser)

Drake
25 Aug, 2023, 14:08

What do the docker logs for the appwrite container say for the 500 error?

Drake
25 Aug, 2023, 14:08

It should be accessible 🧐

Victor
25 Aug, 2023, 16:28

should retry next week

Victor
25 Aug, 2023, 16:29

still now, to find out how to upload variables to each function apparently the way to go is to inspect which REST API is using the web and copy it to my scripts, but would have been nicer to be in the appwrite.json etc...

Victor
25 Aug, 2023, 16:29

would be any use for the appwrite team to report such things?

Drake
25 Aug, 2023, 16:42

For function variables, you should add it in your appwrite.json and use the CLI to deploy: https://appwrite.io/docs/command-line-deployment#configurable-options

As for the API, that's documented here: https://appwrite.io/docs/server/functions?sdk=nodejs-default#functionsCreateVariable

Victor
28 Aug, 2023, 08:37

not sure how I missed that... will test asap

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more