Deploy Firefox Send on OpenShift

It's sad that Mozilla shut down its Send service permanently. But what's more sad is that the mozilla/send repository on Github has been archived, and will no longer be maintained and supported. This leaves the responsibility of maintaining it on the community if someone decides to put in the effort.

The repo as it stands right now is usable, and can be forked as I have done, and deployed on your own server. And today I will share how I successfully deployed it on OpenShift 4.5.

Issues

Main issue I faced with the original repo was that the server expects a non-authenticated Redis app, this can be achieved with a custom Redis deployment on OpenShift, but not if you choose the easy route of deploying from the catalog which will force you to type a password or it will generate one for you. Because of that, I had to edit two files in the repo, config.js and redis.js. My changes also added the ability to use a custom Redis port.

Now let's look at the server/config.js to identify what environment variables we will need. For my use case, I will not be use AWS S3 buckets, but you're free to use them, instead I will use FILE_DIR to specify where I want my uploaded files to be stored, I will use BASE_URL to specify the website's URL, NODE_ENV set to production, REDIS_HOST and REDIS_PASSWORD and finally FXA_REQUIRED set to false as I am not using Firefox Accounts Server. I will leave the rest as default for now, but I may change them if my requirements change.

Setup

  1. First, we need to create a new project, let's name it firefox-send You can do that using the CLI by typing oc new-project firefox-send or on the Web Console, as shown below.

    OpenShift Web Console, how to create a new project

  2. Now switch to the Developer view on the Web Console, and click +Add to add a new application, and then click on From Catalog and select Redis.

  3. You can leave all the fields to their default value and click the Create button. This will create our Redis deployment, and secret where the Redis password is stored. We will use this later.

    Redis Template Form

  4. Now click on +Add and now choose From Dockerfile.

  5. Next up we will fill out the necessary information to create our application.

  1. OpenShift will run a build using S2I, meanwhile let's add storage to our container.

Steps to add storage

Add Storage: fill out the form

Success

Self-hosted Firefox Send main page

And with that, our app is ready to be used.

Conclusion

I've had to go back and forth to understand which environment variables are needed to build the image, and which are needed for runtime, and how the Front-End is tied with the Back-End, it was a good code reading exercise, and that eventually forced me to make my own changes to the repo. I encourage you to do the same.

There are actively maintained alternatives to Send that you can explore, and perhaps we can collectively continue to work on Send, and allow it to grow beyond what the Firefox team originally envisioned.

If you have a comment, or wish to say hello, drop me a line at hello@bilalkhoukhi.com