Skip to content

Initial setup

ange-richard edited this page Feb 18, 2022 · 1 revision

Summary

In this guide we'll assume you're using Linux, you'll probably have small adjustments to make if you're on Windows.

  1. Install and configure MongoDB
  2. Clone and configure the Git project
  3. Launch the Jekyll website
  • This is optional if you don't need to see the website
  1. Launch and configure Metabase
  • This is optional if you don't need to see the website (the graphics needs Metabase)

1. MongoDB

For this project, we chose to use the MongoDB database.

Test if it's already is installed

# Launch the Mongo shell
mongo

Install MongoDB

Follow this tutorial for more explanations or follow the instructions below for a quick start.

# Install MongoDB
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt update
sudo apt install mongodb-org
# Start MongoDB service
sudo systemctl start mongod.service
# Check if MongoDB is running
sudo systemctl status mongod
# Launch MongoDB on system startup
sudo systemctl enable mongod

Tools

You can download tools to view data via a visual interface, for example Compass, the MongoDB official GUI.

2. Git project

Download project

# Install git
sudo apt install git
# Create the basic project structure
mkdir ~/genderednews/
cd ~/genderednews/
# Clone the project in a version folder
git clone https://gricad-gitlab.univ-grenoble-alpes.fr/getalp/genderednews/ .
# Create a basic .env file
cp .env.example .env
# Edit the .env file as needed
nano .env

Run project

# Install pip3 and venv
sudo apt install python3-pip
sudo apt install python3-venv
# Activate the virtual environment
cd ~/genderednews/
python3 -m venv env
source env/bin/activate
# Install the requirements
pip3 install -r requirements.txt
# Setup the project
pip3 install -e .
# Run the main program
python3 main.py

3. Jekyll (frontend is optional)

We chose to use a minimal Jekyll template to create the project's website.

# Install Ruby and dependencies
sudo apt install ruby-full
sudo apt install build-essential patch ruby-dev zlib1g-dev liblzma-dev libsqlite3-dev nodejs
sudo apt install ruby-bundler
# Run Jekyll
cd ~/genderednews/website/
sudo bundle install
# Launch the website locally
sudo bundle exec jekyll serve --watch
# Check the website in your browser
firefox 'localhost:4000'
# Generate the site for production
sudo bundle exec jekyll build

4. Metabase (frontend is optional)

To install Metabase you can follow the instructions below or this tutorial if you prefer: Running the Metabase Jar File.

Download

You can put Metabase anywhere you want, here we'll put it in the Git repository (remember to not commit this folder!).

# Install Java 11 JRE
sudo apt install openjdk-11-jre
# Download Metabase executable
mkdir ~/genderednews/metabase
cd ~/genderednews/metabase
wget 'https://downloads.metabase.com/v0.38.1/metabase.jar'

Launch

# Launch Metabase
java -jar ~/genderednews/metabase/metabase.jar
# Get the home page content to check if it's working
curl localhost:3000

Setup

Add users and a database, create some graphs and a dashboard. Don't forget to turn on Public sharing in the admin panel.

firefox 'localhost:3000/setup'

Once the installation and the configuration done, you can read: Getting Started with Metabase and the [User Guide (https://www.metabase.com/docs/latest/users-guide/start.html).