Firefox Send on Shared Hosting

      2 Comments on Firefox Send on Shared Hosting

To setup Firefox Send on shared hosting you will need a Shared hosting that supports NodeJS.

SSH support is very much recommended but not necessary for non-production service.

Following the following steps:

1. Prepare dist/

You probably shall have issue running npm run build since you can't npm link webpack which requires sudo which is impossible under shared hosting environment.

On you local machine, grab /app/dist/ in the official Docker image: docker run registry.gitlab.com/timvisee/send:latest

then do a docker cp <container-id>:/app/dist ./ .

Zip the directory: tar zcvf dist.tar.gz dist.

2. Prepare hosting

SSH into the instance or use the Web SSH: if your host does not have SSH support, continue but your instance won't be able to handle production workload.

Clone the latest code to public_html(for DirectAdmin: adjust as needed) git clone https://github.com/timvisee/send.git , or upload with zip file and unzip.

Setup hosting as usual NodeJS website, probably with NodeJS Selector. Use NodeJS >=16. Setup SSL certs, etc.Use production if you have SSH access and can setup Redis; If not use development with caveats listed at github.com/timvisee/send/issues/66 .

Setup environment variables per github.com/timvisee/send/blob/master/docs/docker.md .

Entrypoint is server/bin/prod.js.

3. (Optional but very much recommended) Setup Redis

If you have SSH access, follow www.cnbeining.com/2022/03/redis-object-cache-on-shared-hosting-directadmin-cpanel-plesk-etc-without-native-support/ but tell Redis to listen on 6379:

# create a unix domain socket to listen on
unixsocket /tmp/redis.sock
# set permissions for the socket
unixsocketperm 775
# No password
# requirepass passwordtouse
# Do not listen on IP
port 6379
daemonize yes
stop-writes-on-bgsave-error no
rdbcompression yes
# maximum memory allowed for redis - 50MB for small site, 128MB+ for high traffic
maxmemory 50M
# how redis will evice old objects - least recently used
maxmemory-policy allkeys-lru

If you don't have Redis it may be possible to transport Redis binary to the server to bypass building step but I have not tried that yet.

4. Fake install

Either:

4.1 With SSH

Follow command proposed by NodeJS Selector to enter Virtual Environment.

Run npm install.

4.2 Without SSH

Use NodeJS Selector to conduct npm install.

5. Combine dist/ and code

Upload the dist.tar.gz created in Step 1 to the same folder of the code. Unzip.

IMPORTANT: server and dist should be under the same folder after this step.

6. Start Server

Start server and everything should be working.

Potential Issues

UI not working. Tons of underfined in requests

You did not run npm build. Can you setup webpack? If so setup and build; If not follow Step 5.

403 Error

Did you start the server?

500 Error

  • Did you setup Redis? If not see Step 1.
  • Is everything accessible? Double check environment variables.
  • Failed npm build: See Step 5 to do a combination to bypass this step.

2 thoughts on “Firefox Send on Shared Hosting

Leave a Reply

Your email address will not be published. Required fields are marked *