Running Jar on LAMP [SOLVED]

How can Metabase jar be run on a LAMP stack? Java has been installed, the jar file downloaded, and Metabase has been run from the terminal. Now what’s needed is to run Metabase continuously (not just when the terminal is open), use the native MySQL/MariaDB, and resolve to the IP.

Hi @mesquest
By setting it up as a service:
It really has nothing to do with LAMP.

Thanks @flamber. Towards the end of the page:

Where is the nginx.conf file located or what is the directory path where it should go?

@mesquest I don't know, since I don't know which platform you're running on, but on most systems it is located in /etc/nginx/nginx.conf

Any help in diagnosing the following error would be appreciated.

Guide followed:

Debian GNU/Linux
Bitnami LAMP (Linux-Apache-Mysql-Php) stack + Metabase jar

$ sudo systemctl daemon-reload
$ sudo systemctl start metabase.service
$ sudo systemctl status metabase.service

● metabase.service - Metabase server
Loaded: loaded (/etc/systemd/system/metabase.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2021-09-12 18:55:18 UTC; 21s ago
Process: 5277 ExecStart=/usr/bin/java -jar /stack/metabase/metabase.jar (code=exited, status=200/CHDIR)
Main PID: 5277 (code=exited, status=200/CHDIR)

systemd[1]: metabase.service: Main process exited, code=exited,
systemd[1]: metabase.service: Failed with result 'exit-code’.
systemd[1]: metabase.service: Service RestartSec=100ms expired,
systemd[1]: metabase.service: Scheduled restart job, restart count,
systemd[1]: Stopped Metabase server.
systemd[1]: metabase.service: Start request repeated too quickly,
systemd[1]: metabase.service: Failed with result 'exit-code’.
systemd[1]: Failed to start Metabase server.

@mesquest Post your metabase.service file - seems like it does not like your working directory:

Metabase.service file (path to metabase jar in bold):

Description=Metabase server

ExecStart=/usr/bin/java -jar /stack/metabase/metabase.jar


@mesquest What is the ownership of the directory metabase:metabase ? Does metabase have access to /stack ?

This is odd, it exists but can't be seen?:
$ ls -l /stack/metabase/
ls: cannot access '/stack/metabase/': No such file or directory

@mesquest I don't know which user you are trying to ls with, but sounds like permissions issue.

This command earlier in the guide should have taken care of permissions:
$ sudo chown -R metabase:metabase ~/stack/metabase/

The only difference with what is in the metabase.service file is the "~" but including that in the file causes further errors. So I'm stumped for the moment.

@mesquest ~ means the home directory of the current user. And I can see that you are not logged in as root, since the initial console character is $ (non-root) instead of # (root)

I don't think there are any problems with our article, but perhaps that you are trying to fit it into a special Bitnami setup, which already comes with a lot of it's own configurations.

Permissions to the jar file are good:
:~/stack/metabase$ ls -l metabase.jar
-rw-r--r-- 1 metabase metabase 270334645 Sep 6 17:38 metabase.jar

$ sudo systemctl status metabase.service
outputs the following line:
Loaded: loaded (/etc/systemd/system/metabase.service; disabled; vendor preset: enabled)
Does the "disabled" moniker mean that the metabase.service file is disabled?

That doesn't tell me if metabase can access the directory. It doesn't matter if the file is accessible, if the upper parts isn't.

But there's a huge difference between /stack/metabase/ and ~/stack/metabase/
That's basically like saying C:\stack is the same as %UserProfile%\stack on Windows.

Because it failed to start, so to avoid a recursion loop, then services gets disabled.

May I recommend setting up a clean Debian/Ubuntu and follow the guide. Then you get up and running.

Thanks @flamber, you were right, Bitnami uses what appears to be the "/stack/" directory for "/opt/bitnami/". Substituting the true filepath "/opt/bitnami/" wherever "/stack/" was used did the trick!

As an aside for anyone having similar problems, unless you're a wiz with the command line don't trust it to show hidden filepaths, use something like FileZilla to get a better idea of what is really going on.

My next challenge will be to make sure metabase is using the LAMP stack's MySql database. But that's the subject of another post if needed.