2

I have tried to create an Ubuntu Upstart Service to Metabase, but I'm having trouble addressing the following points:

1) Set up database environment variables (port, ip and password):

MB_DB_TYPE=mysql
MB_DB_DBNAME=metabase
MB_DB_PORT=3306
MB_DB_USER=root
MB_DB_PASS=root
MB_DB_HOST=99.99.999.99

2) Restart service if it fails

3) Start on the boot

4) Execute metabase .jar program

`java -jar metabase.jar`
fernandosjp
  • 2,658
  • 1
  • 25
  • 29
calebeaires
  • 1,972
  • 1
  • 22
  • 34

2 Answers2

5

There is a 3-step guide to make sure your Metabase is running as a service in Ubuntu using systemd (https://en.wikipedia.org/wiki/Systemd).

1) Create file metabase.service inside following folder /usr/lib/systemd/system/ (you might need to create the system folder)

[Unit]
Description=Metabase server

[Service]
User=<deploy user>
Restart=on-failure
Environment=MB_DB_TYPE=postgres
Environment=MB_DB_DBNAME=metabase
Environment=MB_DB_PORT=5432
Environment=MB_DB_USER=<db_user>
Environment=MB_DB_PASS=<db_password>
Environment=MB_DB_HOST=<host>
ExecStart=/usr/bin/java -jar /path/to/metabase.jar

[Install]
WantedBy=multi-user.target

2) Enable Metabase service

sudo systemctl enable metabase.service

3) Start service (your Metabase service will be available in port 3000)

sudo systemctl start metabase.service

To check if service is running try: sudo systemctl status metabase.service

fernandosjp
  • 2,658
  • 1
  • 25
  • 29
  • It would be great to get feedback for the downvote :) – fernandosjp Aug 11 '17 at 15:18
  • I have followed same configuration as given above to make it work with oracle database provided oracle driver jar in plugin directory – Dharmjeet Kumar Jun 28 '18 at 23:19
  • it didn't work for me. However, the config of the official doc worked: https://www.metabase.com/docs/latest/operations-guide/running-metabase-on-debian. It also explain how to set up the Nginx proxy. – Geoffrey D Jan 28 '20 at 22:33
1

I recently wrote a tutorial about how to setup metabase on Ubuntu, for a more detailed description of the process I would recommend giving it a look. Given the information that you have provided, I will try my best to help you.

Step One: Service Config Files

There are two ways to set up a java application as a service; however, I will explore the one mentioned in metabase's documentation. For their recommended method you will need to setup two config files:

  1. /etc/init.d/metabase
  2. /etc/default/metabase

You can set up these files based off of the metabase documentation provided. Note: I needed to make some changes to init.d so that the config variables were imported before the service executed java -jar, you can find more details in my blog above if you are interested.

Step Two: Setup Proxy

After that, you will need to set up a proxy so that the server knows how to redirect traffic to port 3000 so that metabase can be activated. (Again, directions on how to do this can be found in my blog.)

Step Three: Setup Metabase as a Service

chmod +x /etc/init.d/metabase
touch /var/log/metabase
chown metabase_user:<group> /var/log/metabase.log
update-rc.d metabase defaults

Note it is important for metabase to have access to write to the log file, or you will try to deploy blind.

Additional Things I would check:

  1. Ensure that the port that you are using on 99.99.999.99:3306 is allowing the connection you are trying to do (http, https, or ssh).
  2. Ensure that www-data/metabase_user has access to execute the metabase.jar file. If not the service will not be able to start metabase when you sudo service metabase start

I hope this helps, and if you would like more details about any step please checkout out: https://codymyers93.wordpress.com/2018/05/07/metabase-on-ubuntu-with-flask-integration/

Feel free to message me with any questions.

Cody Myers
  • 191
  • 5