Resolve Gitpod quirks
There are a bunch of quirks regarding Gitpod deployment and since my knowledge of our backend is very small, there are a bunch of things that should be resolved but I do not know how to deal with them.
Terminology
Before I explain everything, I need to explain some basic terminology regarding Gitpod:
-
workspace
- a container where we deploy funkwhale. It has an immutable ID (accessible throughGITPOD_WORKSPACE_ID
env var) and assigned cluster host that may change (GITPOD_WORKSPACE_CLUSTER_HOST
env var) -
prebuild
- an image that is being built after a commit is pushed to a branch. During the process of a prebuild, the workspace id and cluster host are random and do not resemble the workspace id and cluster host of a new workspace created from the finished prebuild.
Gitpod's flows
Creating new workspace
- Someone pushed to
develop
branch - A prebuild is beginning
-
init
commands from the.gitpod.yml
's tasks are executed - Prebuild is done
- Someone creates new branch and creates a new workspace on this branch with GitLab's UI button
- Cluster host and worksapce id are chosen
- A container from prebuild of
develop
is created - User is redirected to
workspace-id.cluster-host.gitpod.io
- Workspace starts
- User starts coding
Opening old workspace
- User closes workpace
- User opens workspace
- Workspace id stays the same, cluster host may change (happens on very rare ocassions)
- Stages 7-9 occur
Quirks
Importing songs
Since we do the song importing in init
of a task from .gitpod.yml
, the FUNKWHALE_HOSTNAME
at the time is equal to localhost:8000
. We cannot predict the workspace id, nor the cluster host, since it is being executed in the prebuild stage. (stage 2)
For basic testing, it works fine without many problems, but when I want to see the profile, it asks for @gitpod@workspace-id.cluster-host.gitpod.io
actor. Since, the actor in database is @gitpod@localhost:8000
, it throws an error. We need to somehow update the Domain
model when we start the gitpod workspace (stage 8). At this stage, we already know the workspace id and cluster host so it shouldn't be a problem. It is important to remember that at this stage, the cluster ID might've changed.
Other implications of the actor id mismatch between frontend and backend is that frontend thinks that the songs and library do not belong to the gitpod
user.
Very few data to test things
Currently there is almost nothing but some tracks imported in a fresh gitpod workspace. That would be great if during the prebuild, we seeded the database with all kind of info: other users, notifications, requests, reports, channels... Basically everything that funkwhale is capable of and that may fail sometimes. It would make fixing bugs quicker as there already would be notifications in place and user wouldn't need to think what to do to trigger some notification.
A command to reset the database would also come in handy in such case. If I've dismissed all the notifications during my testing my bugfix, one command and have all the notifications back.
Uploads are not working at all
This might be due to the lack of a celery worker. We may just run it in docker container or another gitpod task.
Federation is disabled
This may be related to the issue mentioned above.