Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Conversation

PineappleIOnic
Copy link
Contributor

This PR Contains the Documentation for the upcoming Functions Refactor, these changes explain the new updates to how code should be written for use with appwrite functions.

@PineappleIOnic
Copy link
Contributor Author

Preview

PineappleIOnic and others added 7 commits February 9, 2022 09:44
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Co-authored-by: Christy Jacob <christyjacob4@gmail.com>
Copy link
Contributor

@Meldiron Meldiron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left new comments. Most of them suggestion, you might need to discuss with Christy before doing them.

--functionId=6012cc93d5a7b ^
--command="node index.js" ^
--entrypoint="index.js" ^
--code="/myrepo/myfunction"</code></pre>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work anymore.. I think you MUST be in the repository where you are tarring the file, otherwise build will not find files properly. We should try this with new CLI to make sure.

--code="/myrepo/myfunction"</code></pre>
</div>
</li>
<li>
<h3>CMD</h3>

<div class="ide margin-bottom" data-lang="bash" data-lang-label="CMD">
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite functions createTag ^
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite functions createDeployment ^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add autoDeployment functionality here? It's better to add it and let the developer remove it, than not talking about a feature. Probably applies to all CLI code examples.

<p>The example above shows how you can mount your current working dir into the "appwrite/env-node-15.5:1.0.0" Cloud Functions runtime and execute a custom command to simulate exactly how the Appwrite server will execute the function on the Appwrite server. You can also pass multiple environment variables that your code might require.</p>

<p>When running a Cloud Functions runtime for a coding language that uses a central directory for managing all dependencies, you will need to package all your dependencies in your working directory under the ".appwrite" folder as mentioned in the "Handling Dependencies" step above. This will ensure your function container can access all required packages and execute your function successfully.</p>

<h2><a href="/docs/functions#demosExamples" id="demosExamples">Demos & Examples</a></h2>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we mention this repo in the docs? https://github.com/appwrite/functions-starter
If not, should we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, It'll be good to mention these for people who are not using the CLI

<p>The example above shows how you can mount your current working dir into the "appwrite/env-node-15.5:1.0.0" Cloud Functions runtime and execute a custom command to simulate exactly how the Appwrite server will execute the function on the Appwrite server. You can also pass multiple environment variables that your code might require.</p>

<p>When running a Cloud Functions runtime for a coding language that uses a central directory for managing all dependencies, you will need to package all your dependencies in your working directory under the ".appwrite" folder as mentioned in the "Handling Dependencies" step above. This will ensure your function container can access all required packages and execute your function successfully.</p>

<h2><a href="/docs/functions#demosExamples" id="demosExamples">Demos & Examples</a></h2>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention Appwrite 2.0 CLI? Alongisde manual setup, we could show them appwrite init project, appwrite init function and appwrite deploy function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI 2.0 does sound like a good thing to mention however will we have a dedicated CLI 2.0 page? If we do we shouldn't go too in-depth about it and only show the commands

<p>The example above shows how you can mount your current working dir into the "appwrite/env-node-15.5:1.0.0" Cloud Functions runtime and execute a custom command to simulate exactly how the Appwrite server will execute the function on the Appwrite server. You can also pass multiple environment variables that your code might require.</p>

<p>When running a Cloud Functions runtime for a coding language that uses a central directory for managing all dependencies, you will need to package all your dependencies in your working directory under the ".appwrite" folder as mentioned in the "Handling Dependencies" step above. This will ensure your function container can access all required packages and execute your function successfully.</p>

<h2><a href="/docs/functions#demosExamples" id="demosExamples">Demos & Examples</a></h2>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never mentioned OpenRuntimes. Do we want to? Probably question for @eldadfux

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't, not just yet.

PineappleIOnic and others added 2 commits February 16, 2022 10:38
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
PineappleIOnic and others added 2 commits February 18, 2022 13:46
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
PineappleIOnic and others added 7 commits February 18, 2022 13:47
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
Co-authored-by: Brandon <robertsbt@gmail.com>
@christyjacob4 christyjacob4 changed the base branch from main to 0.13 February 20, 2022 11:20
@christyjacob4 christyjacob4 merged commit 9e9348f into appwrite:0.13 Feb 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants