Install on Ubuntu without Docker

Hey there,

I’ve been trying to install Vikunja following the guides “Install Backend” and “Install Frontend” from Install Backend | Vikunja, on a VPS running Ubuntu 18, mysql and apache2.

I don’t use docker and I installed the BE in /opt/vikunja. Has anyone done the same and could share a step-by-step guide on how you made it work? Thank you.

In case it helps, I’m now at a situation where:

  1. the BE doesn’t seem to be running. sudo service vikunja status generates
    vikunja.service - Vikunja Loaded: loaded (/etc/systemd/system/vikunja.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Thu 2021-07-01 01:55:13 CEST; 1s ago Process: 7580 ExecStart=/usr/bin/vikunja (code=exited, status=203/EXEC) Main PID: 7580 (code=exited, status=203/EXEC)

  2. The frontend loads on subdomain.mydomain.tld. However, I can only login or reset a password. I don’t see how to create a new account. Is there a problem on the FE, or is it because the BE isn’t running successfully?

If I try to edit the “Vikunja URL” field, I get a red error Could not find or use Vikunja installation at "api:3456".

  1. I use mysql, and added it into the config.yml file. However, when I log in mysql, I don’t see any DB or user related to VIkunja. I therefore created the vikunja user. Am I supposed to create the DB myself or let Vikunja do it? The install guides don’t talk about that.

What happens if you execute the binary directly (bypassing the service)? Any errors?

Exactly, the frontend can’t reach the api.

Yes, you are supposed to create the db yourself and make sure the db user you put into Vikunja has all the required rights to access it. That’s probably the issue why Vikunja wont start.

Thanks for your quick reply. Here’s what I did then:

  • Duplicate the executable file inside the extracted archive, so that /opt/vikunja/vikunja exists
    cp vikunja-v0.17.1-linux-386 vikunja

  • Create the user ad DB
    mysql -u root -p
    CREATE USER 'vikunja'@'localhost' IDENTIFIED BY 'mypassword';
    CREATE DATABASE vikunja;
    GRANT ALL PRIVILEGES ON vikunja.* TO 'vikunja'@'localhost';
    FLUSH PRIVILEGES

The service is then running, and some 20 tables have appeared in the database vikunja, all good! A few questions I have:

  • What user should run vikunja?
  • Is it normal that the service doesn’t appear when running service --status-all

I briefly saw a button “Register” on the front end. However, now it is gone again, and I get Could not find or use Vikunja installation at "api:3456". if I click on the Change URL button.

Launching “https://subdomain.mydomain.tld/api/v1/info” redirects to /login . It has an “Info” banner above the login fields, but with no content.

How can I continue debugging?

It should be a user who has access to the files directory (relative to the location of the binary or as configured in the config file). Other than that, you can use whatever you want. I wouldn’t recommend the root user though.

Did you enable the service?

Thanks! It’s still running as root, I’ll change this if I manage to see Vikunja in the browser.

Yes, the service us enabled and running. I figured out that service --status-all only calls status for sysvinit jobs, so it’s normal.

I have set the log to “DEBUG” but still can’t see any log. The log file(s) don’t get created. Here’s are last lines from calling sudo service vikunja status :

Jul 03 18:43:12 vps31 vikunja[5380]: 2021-07-03T18:43:12.150268198+02:00: INFO        ▶ [EVENTS] 074 Starting handler, topic=task.created, subscriber_name=task.created.task.counter.incre
Jul 03 18:43:12 vps31 vikunja[5380]: 2021-07-03T18:43:12.150295618+02:00: INFO        ▶ [EVENTS] 075 Starting handler, subscriber_name=task.assignee.created.task.assigned.notification.se
Jul 03 18:44:00 vps31 vikunja[5380]: 2021-07-03T18:44:00.01078948+02:00: DEBUG        ▶ models/getTasksWithRemindersInTheNextMinute 076 [Task Reminder Cron] Looking for reminders between
Jul 03 18:44:00 vps31 vikunja[5380]: 2021-07-03T18:44:00.019779515+02:00: DEBUG        ▶ models/getTasksWithRemindersInTheNextMinute 078 [Task Reminder Cron] Found 0 reminders

I still cannot make the front end talk to the back end, the Chrome console shows 404 errors when trying to reach the backend. https:/subdomain.domain.tld/api/v1/info redirects to the login page, which misses the Register button. Do you have a runbook or a list of commands to try? I’ve disabled ufw, tried many variants of the Apache site conf and Vikunja config.yml and am still lost.

Here are some samples of errors from the Chrome console:

app.92e95fe9.js : Uncaught (in promise) TypeError: Cannot read property 'imprint_url' of undefined
app.92e95fe9.js : Error during service worker registration: TypeError: Failed to register a ServiceWorker for scope ('https://subdomain.domain.tld/') with script ('subdomain.domain.tld/sw.js'): An unknown error occurred when fetching the script.
chunk-vendors.dc994606.js:64 : POST https://subdomain.domain.tld/api/v1/login net::ERR_CONNECTION_REFUSED

Here is a sample of my terminal:

jb@vps31:~$ curl https://localhost:3456/api/v1/info
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
jb@vps31:~$ curl http://localhost:3456/api/v1/info
{"version":"v0.17.1","frontend_url":"https://subdomain.domain.tld","motd":"","link_sharing_enabled":true,"max_file_size":"20MB","registration_enabled":true,"available_migrators":null,"task_attachments_enabled":true,"enabled_background_providers":["upload"],"totp_enabled":true,"legal":{"imprint_url":"","privacy_policy_url":""},"caldav_enabled":true,"auth":{"local":{"enabled":true},"openid_connect":{"enabled":false,"redirect_url":"\u003cfrontend url\u003e","providers":null}},"email_reminders_enabled":true}

Calling /vi/info with curl appears in the vikunja service status as:
Jul 03 20:19:23 vps31 vikunja[17187]: 2021-07-03T20:19:23.654465069+02:00: WEB ▶ my.pub.lic.ip GET 200 /api/v1/info 508.957µs - curl/7.58.0 (I managed to have it logged, after replacing stdout with file in config.yml.)

I can see the output of /v1/info in the brower too, but only if I type http://subdomain.domain.tld:3456/api/v1/info . It doesn’t work with https or without the :3456

If it can help, they are on the same server. The FE has a SSL sertificate from Let’s Encrypt, seemingly like try.vikunja.io.

– EDIT:

I’ve set up a new site with a new Apache conf file, that is only active on Port 80. And tadam, it connected to the back-end!

It’s not a permanent solution though. I also notice a “Network error” every second or so.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://subdomain.domain.tld:3456/api/v1/notifications?page=1. (Reason: CORS request did not succeed).

If you did not explicitly configure logging output to file, it will log everything to stdout which means you should be able to access it through systemctl or journalctl.
The output you got from the service status command confirms that.

Which guide did you follow when configuring serving the frontend files? This one or this one?

If you followed the first one you’ll need to set the url to something like http://subdomain.domain.tld:3456 (notice the http, not https) which would talk directly to Vikunja without any prox or tls termination in between. If you want tls termination and/or want to expose the Vikunja api and frontend on the same single port only, use the second guide from above.

Your curl commands seem to indicate the api is reachable from the outside so that should work.

Thnks @kolaente , I really appreciate your support! The log files are now created.

About the FE files I had followed your first link, and following your message, I swapped to your second link so that the FE is on a HTTPS site.

On that vikunja.conf sample, I replace *80 by the HTTPS website, and the http:\\localhost... links by https:\\localhost.... Is that correct?

I tried this without success. I get a few ERR_SSL_PROTOCOL_ERROR and

chunk-vendors.dc994606.js:64 Mixed Content: The page at 'https://subdomain.domain.tld/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://subdomain.domain.tld/api/v1/info'. This request has been blocked; the content must be served over HTTPS.

Should the frontendurl parameter in config.yml also be with https? Can I leave the URL there start with \\ to be protocol agnostic?

My FE can connect to try.vikunja.io with no problem, but not to my BE. Your FE at try doesn’t connect to my BE. You may have seen my trials on your logs.

No, that’s the local proxy configuration on your server. This means it will proxy all requests to /api in that vhost config to the api service running on your server. The api service itself does not do any tls termination so you will need to talk to it over http.
The apache proxy in front of the api + frontend is meant to do the https.

Can you reach the api at http://subdomain.domain.tld/api/v1/info from your browser?

You need to put in a protocol. I’d reccomend just using https if your installation is accessible through https.

Thanks for the help! I revisited my Apache .conf files that had a redirect for non-HTTPS requests and must have been messing with the reverse proxy.

I’ve been able to enjoy Vikunja for a few days now (and may submit bugs reports related to the Gantt view date pickers :slight_smile: ). We can consider that topic closed.

1 Like