Go to file
ideclon 6703496adc
add link to frontend
2022-12-23 00:11:45 +00:00
functions status links local to your homeserver 2022-12-20 02:40:54 +00:00
README.md add link to frontend 2022-12-23 00:11:45 +00:00
appwrite.json add database 2022-12-22 23:47:59 +00:00

README.md

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_FUNCTION_ENDPOINT: http://172.17.0.1:8080/v1
  • 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.