This commit is contained in:
ideclon 2022-12-22 23:48:04 +00:00
parent 9e8f450cd4
commit 4bad6be54c
Signed by: ideclon
GPG Key ID: 3E186629301AFBFD
1 changed files with 42 additions and 0 deletions

42 Normal file
View File

@ -0,0 +1,42 @@
# Mastodon Algorithm - Server Components
This repo contains server components for [ideclon's]( Mastodon Algorithm project.
**This project relies on [AppWrite]( You must have an AppWrite instance to run this project**
This repo contains two parts:
* `functions`
* `collections` (aka databases)
Once the server components are deployed, you can deploy the frontend.
# Deploy
To deploy this repo, you'll need the [AppWrite CLI](
## Connect to your Appwrite instance
Log into your Appwrite instance's UI and create a new project. Call it whatever you want. Once it's created, navigate to Settings within the new project.
From the root of this repo, run `appwrite client --endpoint [YOUR_APPWRITE_API_ENDPOINT] --projectId [PROJECT_ID]`.
Next, run `appwrite login` to authenticate.
Now, link the repo to the project - `appwrite init project`. Select yes when ask if you want to override the currently associated project. Select "List this directory to an existing Appwrite project", then select the new project you've just created.
## Deploy to AppWrite
Run `appwrite deploy collection` to deploy the database. Press `<a>` to select all, then `<enter>` to proceed.
Once that's done, run `appwrite deploy function` to deploy the backend functions, and proceed as above.
## Generate API key
Navigate to Overview and select "API Key" under "Integrate With Your Server". Give the key a name, "Select All" for scopes, and click "Create". Scroll down to Integrations > API Keys, click the new key you just created, and copy it (under "API Key Secret").
## Set enviroment vars
This currently has to be done manually for each function. There's an [issue]( open at Appwrite to make this possible on a project level.
Navigate to the first function > Settings. Scroll down to Update Function Variables. Set the following vars:
* `APPWRITE_DATABASE_ID`: This is the database ID of the database created above. Get it at Databases > click "Project ID" on the database created above.
* `BASE_URI`: This is the URL of the frontend
* `API_KEY`: The Appwrite API key you created above
You'll need to create these vars for each of the three functions.