Skip to content

Instantly share code, notes, and snippets.

@sdoering
Created December 6, 2019 09:15
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdoering/b1244c8fd31227fbe2ab4627f4209373 to your computer and use it in GitHub Desktop.
Save sdoering/b1244c8fd31227fbe2ab4627f4209373 to your computer and use it in GitHub Desktop.

Uberspace

Uberspace is webhosting for nerds and everybody. Currently uberspace is aroudn 12 people who do what they do to make technology more approachable.

It is a great place to learn and test and also run small projects (or not so small ones) in production.

It is shared hosting - that makes some things a little bit difficult - but if you run into problems they are a great help.

Nuxt

Nuxt is a VueJS framework. It makes SSR (server side rendering) and other niceties easy in Vue.

To use it on uberspace you need to run a nodejs server as a service (deamon):

supervisord

supervisord enables services to run as deamon. This is necessary to have the nodejs server running to generate the server side rendering of your webpages.

To configure it, create an .ini-file in /home/YOUR-USER-NAME/etc/services.d/NAME-OF-YOUR-DEAMON.ini with the following content:

[program:NAME-OF-YOUR-DEAMON]
command=npm start --prefix %(ENV_HOME)s/DIRECTORY-OF-NUXT-APP/
autostart=true
autorestart=true
startretries=3
  1. The name of your deamon
  2. The command to run (in this case you tell npm to start the server and with prefix you tell it to use your nuxt apps location as a prefix so that all files are found by nodejs
  3. should it autostart true/false
  4. should it autorestart true/false
  5. How often do you want the deamon to try when starting results in failure?

web backend

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

You need to decide on a port that currently isn't used (follow the instructions from the web backend documentation). You'll need this port in the next part:

nuxt server

You need to configure the server property in nuxt.config.js:

server: {
    port: 8181, // use the port from the web backend
    host: '0.0.0.0' // default: localhost
  }

build and run

now you just need to cd into your app's directory and run npm run build to build your application.

Then run the following supervisord commands to create the service you already configured:

$ supervisorctl reread
$ supervisorctl update
$ supervisorctl status

Wait a few seconds (it took something like 30 seconds for me) an test to open your application in the browser.

@phillipmohr
Copy link

Hi, thanks for the manual. Is this still up to date? I get a 502 Bad Gateway Error by nginx.

I left the server host inside the nuxt.config.js at '0.0.0.0', not sure if that's correct

@svnldwg
Copy link

svnldwg commented Feb 13, 2021

Hi, thanks for the manual. Is this still up to date? I get a 502 Bad Gateway Error by nginx.

I left the server host inside the nuxt.config.js at '0.0.0.0', not sure if that's correct

I just tried it and it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment