Database Setup Guide¶
Quick Start¶
If you just want to get the database running:
- Install Docker on your system
- Run the setup command:
1
ethopy-setup-djdocker
- Enter a password when prompted
- Verify the setup:
1
ethopy-db-connection
That's it! The database is ready to use.
Detailed Guide¶
Prerequisites¶
- Docker installed and running on your system
- Python 3.8 or higher
- EthoPy package installed
Understanding the Components¶
The database setup consists of: - A MySQL database running in Docker - DataJoint configuration for EthoPy
Setup Process¶
1. Docker Container Setup¶
1 |
|
Options:
- --mysql-path
: Custom path to store MySQL data (default: ~/.ethopy/mysql-docker)
- --container-name
: Custom name for the container (default: ethopy_sql_db)
This command: - Creates a Docker container with MySQL - Sets up initial configuration - Ensures the database is accessible
2. Database Connection Check¶
1 |
|
3. Schema Creation¶
1 |
|
Troubleshooting¶
Container Won't Start¶
- Check Docker status:
1
docker ps -a
- Check Docker logs:
1
docker logs ethopy_sql_db
Connection Issues¶
- Verify port 3306 is available:
1
netstat -an | grep 3306
- Check your local configuration file (~/.ethopy/local_conf.json)
Advanced Configuration¶
Custom Database Host¶
Edit your local_conf.json:
1 2 3 4 5 6 7 8 |
|
Multiple Environments¶
You can run multiple database instances by using different container names:
1 2 |
|
Security Considerations¶
- Use strong passwords
- Don't expose the database port publicly
- Regular backups of ~/.ethopy/mysql-docker/data_*
Technical Reference¶
Command Details¶
setup_dj_docker¶
Sets up the Docker container with MySQL configured for EthoPy.
1 |
|
check_db_connection¶
Verifies database connectivity.
1 |
|
Architecture¶
The setup follows a three-tier approach: 1. Container Management (Docker) 2. Database Configuration (MySQL) 3. Schema Management (DataJoint)
Each tier is independent and can be modified without affecting the others.