I have created a windows service that attempts to start metabase. But the attempt times out. Has anyone got this installed as a windows service and started it successfully?
I was able to get this working by using NSSM (https://nssm.cc/) and running the metabase jar file from there.
Setup the PATH to be that of java.exe, provide the arguments (-jar metabase.jar) and make sure your startup location is the folder you have the jar file.
To access it from other machines, make sure you have the required port (by default 3000) excluded.
It works as expected for me.
I was able to get this working using another wrapper tool similar to NSSM. I had tried NSSM, but did not have much luck.
could you write up how you did it? Also, nssm.cc has an invalid ssl cert for me.
I don’t know why the site is now throwing cert errors, try http://nssm.cc. It is a popular way to convert exe’s into windows services. You can download it from their site or search google and find an alternate location.
Here is my little write-up on how to install metabase as a service under windows.
Running metabase using java is great, but what if you want to run it all the time. On windows you have the options of adding it to start up, but even then you will have to login to the machine to start metabase. So to convert it to something like a service, the best option is to run it as a windows service.
You can use any of the tools you want, my preferred tool is NSSM (Non-Sucking Service Manager) an Open Source tool to convert an exe into a service.
Steps for setting up Metabase Service
Download it from http://nssm.cc/download
Make sure you pick the right 32 or 64 bit version based on your windows installation.
Install it to your machine
Using command prompt, navigate to the folder you have NSSM installed and run nssm install
A UI will show up
In the path, point to the path of JAVA (note, this is not your jar path)
- In start up directory, point it to the directly that you have the metabase jar file
In arguments provide the following
Give the service an appropriate name like ‘Metabase-Service’ and click Install Service.
That’s it. You have installed the service.
To make the service run automatically
Goto services (run services.msc) -> Select ‘Metabase-Service’ and make it Automatic
To allow other machines to acces metabase service
Run Windows Firewall and add port 3000 to the excluded list.
I’ve followed the steps closely but can’t get this to work. I’m getting the error…
"Windows could not start the Metbase-Service service on Local Computer.
The service did not return an error. This could be an internal Windows error or an internal service error.
If the problem persists, contact your system administrator."
Anyone else have problems running this setup? Or have any ideas on how to resolve this
make sure to put a hyphen before the argument.
I was able to get Metabase running as a service using NSSM, but it is running as if it is a fresh install. How can I run it while still retaining the existing settings/dashboards etc?
Edit: Never mind, I had neglected to assign the start up directory, so it was using the default startup directory, i.e. where java.exe is located. And there’s obviously no database file there. Changed that to where the metabase.jar is located and it works great now.
I am trying to run metabase as a windows service on windows server 2019, but it does not seem to work.
I used NSSM, set all the right directories, ran the service, but when I go to the browser to access Metabase, it does not load the page.
I have turned off the firewall, so network should not be the issue.
Any help would be great.
Thanks in advance.
@KBing I would recommend that you post how you have configured NSSM - perhaps screenshots.
Can you even get Metabase to run, when not trying to start it as a service?
Yes, if i run metabase through the cmd window as normal it runs with no issues.
@KBing I’m guessing there are errors in the Event logs on Windows, which could help figuring out what the problem is. I don’t have Windows, so cannot help you much more.
You may need to tweak the "Log On" tab a little bit.
I found this guide: https://golb.hplar.ch/2020/05/windows-service.html
WinSW configuration was easy.
now the service is active and I will test it in the next days.
I needed to add java.exe to the Firewall rules as well.
How can I create a windows service using a config file to connect to my DB (MySQL) ?
I saw in doc :
If you’re running Metabase as a service, you’ll put these environment variables in a separate configuration file.
mention the need to create a separate file for the config file. How can I acheive it using nssm ?
@Exe The Metabase documentation is for SystemD, which is a Linux service.
Use the "Environment" tab to define environment variables - see more in the official documentation for NSSM: https://nssm.cc/usage
7 posts were split to a new topic: Problems running as Windows service
Worked perfectly for me. Thanks!!