Self-hosted Selene backend and GUI

Hi. I am trying to deploy Mycroft Selene self-hosted for a research project. I know there have been some posts asking how to do this but they all point to alternatives. What I am trying to do is actually deploy the official Selene Backend + GUI.
So far I have managed to build, install, configure and run everything, but am having problems when accessing the GUI, mostly because it is configured for Mycroft offiicial URLs and the Github readme doesn’t mention how to (or that you need to) change them. I imagine I need to change all the environment.ts files of all projects in Selene-UI angular source before building, but I would like a confirmation or some hint if I need to change anything else - for instance, I don’t know which of the URLs in those .ts files are suppossed to be replaced with my GUI website URLS or the Backend API ones.
If anyone has gone through this it would be great to get some advice - or consider it a lost cause.
As a side note: Prebuilt packages, or even better, Docker images, would be great (I know there are some but they are for Mycroft’s own CI/CD)

I am also looking to self-host.

Any chance you got this working in the end?

Yes, in the end I managed to get it running, but had to do a lot of heavy work, debugging, trial and error, that could be avoided if things were clearer in the readmes (and, as I mentioned before, if they supplied proper Docker images).
I will not get into much detail, but this is a list of things I had to do:

  • Made my own 4 Docker images for the backend modules, loosely based on the Dockerfile in Github + the instructions in the Readme. Using Docker containers I can use Docker Compose to better manage them, and use container hostname as endpoint address instead of IP.
  • Ran Postgres and Redis as Docker containers, configured them as per the Readme in Github.
  • Made a Nginx-based Docker container serving the Selene UI websites all in the same place, as a single server (which means renaming their index.html so they are all in the same place)
  • Then used Nginx as proxy to redirect each request to the appropriate endpoint. This is what took me longest. Essentially it’s redirecting the path of each api call to the right place. Example: /api/cities to the account backend, or /skills to the marketplace web index.html (renamed to market.html). I imagine this would all be easier if you had sub-domains, just like Mycroft, but I currently don’t have domain and am working on IP only. This meant going to the code and finding all API paths.

Files I needed to change:

  • /selene-backend/*/uwsgi.ini - In these I had to change “socket” to “http”. I guess it could work with socket if I configured something better, but this worked for me.
  • /selene-backend/shared/selene/api/ - Change the Mycroft domain to your domain or IP
  • /selene-backend/projects//src/environments/environment.ts - There are a lot of these. Change the Mycroft domain to your domain or IP.

Other changes and gotchas not explained in Readme:

  • Selene Backend Environment variables SSO_BASE_URL and OAUTH_BASE_URL are suppossed to point to the SSO Selene Backend.
  • Add environment variable “DB_SSLMODE prefer” to Selene backends or they will not connect to the DB via SSL.
  • The SALT must be 16 character alphanumeric.
  • When running the DB bootstrap script, you must first add your own and to /opt/mycroft/devops/agreements
  • Had to use the script, modified to only use the part where it initializes the wake words, otherwise you cannot register devices.

I am omitting a lot of details and rationales for the changes, but that is the gist of it. I hope it is helpful.

1 Like