Giter Club home page Giter Club logo

metabase-docker-compose's Introduction

metabase-docker-compose

Easily deploy Metabase using Docker container with this simple setup. It targets port 80, allowing you to access the Metabase instance directly through your IP address in a browser.

Prerequisites

  • Docker and Docker Compose installed on your system.

Set Up

  1. Create a directory called Metabase
mkdir metabase
cd metabase
  1. Create a ´docker-compose.yml´ file with the following content:
version: '3'
services:
  metabase:
    image: metabase/metabase:latest
    ports:
      - 80:3000
    environment:
      MB_DB_TYPE: postgres
      MB_DB_DBNAME: metabase
      MB_DB_PORT: 5432
      MB_DB_USER: metabase
      MB_DB_PASS: metabase
      MB_DB_HOST: postgres
  postgres:
    image: postgres:latest
    environment:
      POSTGRES_USER: metabase
      POSTGRES_DB: metabase
      POSTGRES_PASSWORD: metabase
    volumes:
      - ./pg:/var/lib/postgresql/data
  1. Pull the required Docker image
docker-compose pull
  1. Start the Metabase and PostgreSQL containers:
docker-compose up

Update Metabase

From time to time, Metabase releases new versions with feature improvements, bug fixes, or security patches. It's a good practice to keep your Metabase instance up-to-date. Here are the steps to update Metabase:

  1. Stop Nginx Service (if running):

    Before making any changes, especially if you have set up HTTPS as shown above, ensure the Nginx service is stopped.

    sudo systemctl stop nginx 
  2. Stop Current Docker Services:

    Ensure your Metabase and PostgreSQL services are stopped before updating.

    docker-compose down
  3. Pull the Latest Metabase Image:

    This step fetches the latest version of the Metabase Docker image.

    docker pull metabase/metabase:latest
  4. Start Nginx Service:

    If you're using Nginx for SSL termination, start it back up.

    sudo systemctl start nginx
  5. Restart Docker Services:

    Now, with the updated Metabase image, start the services again.

    docker-compose up

(OPTIONAL) Create HTTPS Certificate

⚠️ Warning: You need to update your docker-compose.yml. Change the port mapping from 80:3000 to 3000:3000.

  1. Stop the Docker Compose services:
docker-compose down
  1. Update the package list and install Certbot:
sudo apt-get update
sudo apt install -y certbot python3-certbot-apache
  1. Generate SSL certificates using Certbot:
sudo certbot certonly --standalone -d example.com --preferred-challenges http --agree-tos -m [email protected] --keep-until-expiring
  1. Copy the generated certificates to your project directory:
sudo cp -r /etc/letsencrypt/live/example.com ./certs
sudo chown -R $USER:$USER ./certificates
  1. Install Nginx:
sudo apt update
sudo apt install nginx
  1. Create a new Nginx configuration file:
sudo touch /etc/nginx/sites-available/example.com
  1. Add the following configuration to the file, replacing example.com with your domain and YOUR_APP_IP:3000 with the IP and port of your application:
server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
       proxy_pass http://YOUR_APP_IP:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
  1. Create a symbolic link to the sites-enabled directory:
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
  1. Test the Nginx configuration:
sudo nginx -t
  1. Restart Nginx:
sudo systemctl restart nginx
  1. Start the Docker Compose services:
docker-compose up

metabase-docker-compose's People

Contributors

robertocommit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.