Back

[SOLVED] How to move all the functions from local to server? How to persist execute access?

  • 0
  • Web
  • Databases
  • General
  • Self Hosted
  • Functions
shofol
19 Feb, 2023, 03:50

I have two questions actually.

  1. When I am changing something on appwrite functions and deploying, each time the Execute Access is getting reset. How to stop that and persist the choice I have chosen once?
  2. I have created couple of functions and each function has a list of environment variables. Now, what's the way to move these functions from my local to my server's appwrite instance? Do I have to init all of these functions on my server again? Also, how can I copy the local database, user, etc. to server as it is.
TL;DR
Summary: The user is seeking guidance on how to move functions, collections, and databases from their local environment to a server using Appwrite. They also have questions about persisting execute access and copying environment variables. The user would like a step-by-step procedure and documentation for beginners. Solution: 1. Install the Appwrite CLI on the server and set the endpoint to the server. 2. Update the appwrite.json file with the necessary configurations for the new server. 3. Use the CLI commands `appwrite deploy collection` and `appwrite deploy function` to deploy collections and functions to the server. 4. To persist execute access
Drake
19 Feb, 2023, 04:40
  1. Did you add the execute permissions to the appwrite.json?
  2. You can develop locally and use the CLI to deploy to the server. You can also use the CLI to deploy the collections to your server.
shofol
20 Feb, 2023, 12:57
  1. No. I have changed through console.
  2. Is there any documentation on that?
shofol
20 Feb, 2023, 14:30

@Steven I need a documentation to move my collection, functions and database from local to server. Do you a documentation on that? As a beginner I expect this from the official documentation.

Drake
20 Feb, 2023, 14:33
  1. You'll need to add it to the appwrite.json instead.
  2. We have docs for the CLI: https://appwrite.io/docs/command-line-deployment
Drake
20 Feb, 2023, 14:34

And here are docs on how to change the instance you're connected to: https://appwrite.io/docs/command-line-ci#configuration

shofol
20 Feb, 2023, 14:44
  1. You should add that in the documentation.
  2. What will CI mode do? appwrite client
    \ --endpoint https://[HOSTNAME_OR_IP]/v1 \ - Is this the server endpoint? --projectId [YOUR_PROJECT_ID] \ - Server Project ID? --key YOUR_API_KEY - Server API key? After this what should I do? The documentation you referred are only discussing different config options you have but not a continuous process. Can you describe me the full process of migrating one collection from my local to my server?
Drake
20 Feb, 2023, 15:06
  1. https://appwrite.io/docs/command-line-deployment#avoidingConflicts
  2. Whoops that link shouldn't be to ci mode (@VincentGe, looks like the link for the configuration header is incorrect). @shofol you can change your endpoint to point to the new server and then deploy everything in your appwrite.json
VincentGe
20 Feb, 2023, 15:39

oh yeah we moved it. Let me open a PR

shofol
20 Feb, 2023, 18:39

@Steven - About this - "you can change your endpoint to point to the new server and then deploy everything in your appwrite.json" - Where should I change it? In the server?

Please help me with a proper step by step procedure as I am totally beginner to Appwrite, Docker, etc. So, 1. I will install Appwrite CLI to server and set the endpoint to that server. 2. Then how will I upload my local functions and collections to that server? I am confused in this part. From local what is the procedure to deploy to my server? Where should I change to tell the CLI to deploy the collections and functions to server not my local machine. Please, clarify this step. I am not understanding by reading the official documentation. The documentation assumes we have good knowledge of backend terminologies.

Drake
20 Feb, 2023, 18:43

#2 here is how you would change what instance you're connecting to

Drake
20 Feb, 2023, 18:45

You don't need to install the CLI on the server.

Have you carefully read through all the CLI docs?

shofol
20 Feb, 2023, 19:12

Yes, I have read it but as I said I am new so the documentations seems hard for me. Let's say I am not understanding what CI mode is. Let's say here it's saying - You can enable CI mode for the Appwrite CLI by setting the project ID, endpoint, and API Key: Now it's not clear which project id, endpoint or api key should I use here.

Is doing the CI mode enough? And, if I start the CI mode which appwrite.json will it use?

Drake
20 Feb, 2023, 19:14

sorry, ignore CI mode.

You've got your appwrite.json locally and you've connected to your local instance. Now, you can run this: https://appwrite.io/docs/command-line#configuration to point to your other server instead of your local server and then run the usual appwrite deploy collection and appwrite deploy function. Instead of deploying to your locally server, it will deploy to your other server because of the configuration change

shofol
20 Feb, 2023, 19:18

Now it's clear. Thank you very much @Steven. I will try and let you know. I think you should have some example projects/ tutorials in the documentation for the beginners like me. It would be easier for us to find a solution easily there rather than posting similar issues again and again here.

Drake
20 Feb, 2023, 19:20

[SOLVED] How to move all the functions from local to server? How to persist execute access?

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