Skip to main content

System Requirements

Before installing Bar Galileo, ensure your system meets these requirements:

Python

Version 3.11 or higher

MySQL/MariaDB

Version 5.7+ or MariaDB 10.3+

Memory

Minimum 2GB RAM

Installation Methods

1. Clone the Repository

Get the Bar Galileo source code:
git clone https://github.com/Christian3h/bar-galileo.git
cd bar-galileo

2. Create Virtual Environment

Isolate your Python dependencies:
python3 -m venv .venv
source .venv/bin/activate
Your terminal prompt should now show (.venv) indicating the virtual environment is active.

3. Install System Dependencies

Install MySQL client libraries required by the mysqlclient package:
sudo apt-get update
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config

4. Install Python Dependencies

Install all required packages from requirements.txt:
pip install --upgrade pip
pip install -r requirements.txt
This may take several minutes. Key packages include:
  • Django 5.2.4 - Web framework
  • Django Channels 4.3.1 - WebSocket support
  • mysqlclient 2.2.7 - MySQL database adapter
  • reportlab 4.2.5 - PDF generation
  • openpyxl 3.1.5 - Excel export
  • sentence-transformers 3.3.1 - AI embeddings for RAG chat

Database Configuration

MySQL Setup

1

Install MySQL Server

sudo apt-get install mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql
2

Secure MySQL Installation

sudo mysql_secure_installation
Follow prompts to:
  • Set root password
  • Remove anonymous users
  • Disable remote root login
  • Remove test database
3

Create Database and User

Log into MySQL:
sudo mysql -u root -p
Create the database with proper character encoding:
CREATE DATABASE bar_galileo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Create a dedicated user:
CREATE USER 'bar_galileo_user'@'localhost' IDENTIFIED BY 'your_secure_password';
Grant privileges:
GRANT ALL PRIVILEGES ON bar_galileo.* TO 'bar_galileo_user'@'localhost';
FLUSH PRIVILEGES;
Verify and exit:
SHOW DATABASES;
EXIT;
Use a strong password! Consider using a password generator for production environments.
4

Test Database Connection

mysql -u bar_galileo_user -p bar_galileo
If successful, you’ll see the MySQL prompt. Type EXIT; to quit.

Environment Configuration

Create Environment File

Bar Galileo uses environment variables for sensitive configuration. Create a .env file:
cd bar_galileo
touch bar_galileo/.env

Required Environment Variables

Add the following to bar_galileo/bar_galileo/.env:
# Django Secret Key - REQUIRED
secret_key=your-random-secret-key-here

# Database Configuration
DB_NAME=bar_galileo
DB_USER=bar_galileo_user
DB_PASSWORD=your_secure_password
DB_HOST=localhost
DB_PORT=3306

# Development/Production Mode
DEBUG=True

# Allowed Hosts (comma-separated)
ALLOWED_HOSTS=localhost,127.0.0.1

# Email Configuration (for password reset, notifications)
[email protected]
emailPassword=your-app-specific-password
# Run this command to generate a secure secret key:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
Never commit the .env file to version control! Add it to .gitignore to keep secrets safe.

Configuration Details

Here’s how settings.py loads these variables:
bar_galileo/bar_galileo/settings.py
from dotenv import load_dotenv
from pathlib import Path
import os

# Load environment variables from .env file
load_dotenv(dotenv_path=Path(__file__).resolve().parent / '.env')

# Database configuration
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.getenv('DB_NAME', 'bar_galileo'),
        'USER': os.getenv('DB_USER', 'bar_galileo_user'),
        'PASSWORD': os.getenv('DB_PASSWORD'),
        'HOST': os.getenv('DB_HOST', 'localhost'),
        'PORT': os.getenv('DB_PORT', '3306'),
        'OPTIONS': {
            'charset': 'utf8mb4',
            'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
        },
    }
}

Database Migrations

Run migrations to create all database tables:
cd bar_galileo
python manage.py migrate
You should see output like:
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, accounts, products, tables, ...
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying products.0001_initial... OK
  ...
Migrations create tables for all Bar Galileo modules: products, tables, orders, inventory, expenses, payroll, reports, notifications, and backups.

Create Admin User

Create a superuser account to access the admin interface:
python manage.py createsuperuser
Enter the required information:
Username: admin
Email: [email protected]
Password: ********
Password (again): ********
Superuser created successfully.

Static Files Collection

For production deployments, collect static files:
python manage.py collectstatic
This gathers CSS, JavaScript, and images into the staticfiles/ directory.
In development mode with DEBUG=True, Django serves static files automatically.

Running the Server

Development Server

For basic development:
python manage.py runserver
Access at: http://localhost:8000 For full functionality including WebSockets:
# From project root (bar-galileo/)
./run_server.sh
This runs Uvicorn with ASGI support:
run_server.sh
#!/bin/bash
cd bar_galileo

../.venv/bin/python -m uvicorn bar_galileo.asgi:application \
    --host 0.0.0.0 \
    --port 8000 \
    --reload-include="*.py" \
    --reload-include="*.html" \
    --reload-include="*.css" \
    --reload-include="*.js"
The run_server.sh script:
  • Enables WebSocket support for real-time notifications
  • Binds to 0.0.0.0 for network access
  • Auto-reloads on file changes (Python, HTML, CSS, JS)
  • Shows local IP for mobile device testing

Production Deployment

Security Settings

For production, update your .env:
DEBUG=False
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
secret_key=your-production-secret-key
When DEBUG=False, Django automatically enables:
  • SSL redirect (SECURE_SSL_REDIRECT=True)
  • Secure cookies (SESSION_COOKIE_SECURE=True)
  • HSTS headers
  • CSRF protection
From settings.py:
bar_galileo/bar_galileo/settings.py
if not DEBUG:
    SECURE_SSL_REDIRECT = True
    SESSION_COOKIE_SECURE = True
    CSRF_COOKIE_SECURE = True
    SECURE_HSTS_SECONDS = 31536000  # 1 year
    SECURE_HSTS_INCLUDE_SUBDOMAINS = True
    SECURE_HSTS_PRELOAD = True

Using Daphne (ASGI Server)

pip install daphne

Using systemd Service

Create a systemd service file:
/etc/systemd/system/bargalileo.service
[Unit]
Description=Bar Galileo Django Application
After=network.target mysql.service

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/bar-galileo/bar_galileo
Environment="PATH=/var/www/bar-galileo/.venv/bin"
ExecStart=/var/www/bar-galileo/.venv/bin/daphne -b 127.0.0.1 -p 8000 bar_galileo.asgi:application
Restart=always

[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable bargalileo
sudo systemctl start bargalileo
sudo systemctl status bargalileo

Verification

Verify your installation:
1

Check Server

Visit http://localhost:8000 - you should see the Bar Galileo login page.
2

Admin Login

Log in with your superuser credentials.
3

Check Database

mysql -u bar_galileo_user -p bar_galileo -e "SHOW TABLES;"
You should see tables for all modules.
4

Test WebSockets

If using run_server.sh or Daphne, real-time notifications should work.

Troubleshooting

Install MySQL client libraries:
# Ubuntu/Debian
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential

# Then reinstall mysqlclient
pip install mysqlclient
Check your database credentials in .env:
  • Verify DB_USER and DB_PASSWORD match what you created
  • Test MySQL connection: mysql -u bar_galileo_user -p
Ensure MySQL is running:
sudo systemctl status mysql
sudo systemctl start mysql
Collect static files:
python manage.py collectstatic --noinput
Check STATIC_ROOT in settings.py is writable.
  • Use run_server.sh or Daphne instead of runserver
  • Check that Channels is installed: pip show channels
  • Verify ASGI configuration in asgi.py

Next Steps

Quickstart

Follow the quickstart guide to create your first product

Configuration

Configure OAuth, email, backups, and more

API Reference

Explore Bar Galileo’s REST API

User Management

Set up roles, permissions, and staff accounts

Need Help?

If you encounter issues not covered here:
  1. Check the Django logs for detailed error messages
  2. Review the GitHub repository for documentation
  3. Contact the Bar Galileo team at [email protected]
Bar Galileo is actively maintained by the team at Bar Galileo in Sogamoso, Boyacá, Colombia.

Build docs developers (and LLMs) love