- Docker Desktop installed
- Docker Compose Command line tool installed
- Clone the repository and navigate to this directory:
cd docker_postgres_db
- Create
.env
file with your database credentials:
POSTGRES_USER=trading_user
POSTGRES_PASSWORD=your_secure_password
POSTGRES_DB=trading_db
- Start the database:
docker-compose up -d
- Verify the setup:
# Check if container is running
docker ps
# Connect to database
docker exec -it solana_trading_db psql -U trading_user -d trading_db
# Inside psql, verify schema and tables:
\dn # List schemas
\dt sol_algo.* # List tables in sol_algo schema
The database includes the sol_algo
schema with the following tables:
-- Partitioned Tables
sol_algo.pumpfun_trades_partitioned
sol_algo.pumpfun_latest_tokens_partitioned
-- Regular Tables
sol_algo.pumpfun_graduate_detection
sol_algo.pumpswap_migrated_pool
sol_algo.pumpfun_launch_txn
sol_algo.pumpswap_bought_history
sol_algo.pumpfun_bought_history
docker-compose up -d
docker-compose down
docker-compose down
rm -rf data/*
docker-compose up -d
docker logs solana_trading_db
docker exec -it solana_trading_db psql -U trading_user -d trading_db
If you encounter permission issues:
# Fix permissions on init scripts
chmod 755 postgres/init-scripts/*
Check the logs:
docker logs solana_trading_db
Try rebuilding:
docker-compose down
docker-compose build --no-cache
docker-compose up -d
docker exec -t solana_trading_db pg_dumpall -c -U trading_user > dump_$(date +%Y-%m-%d_%H_%M_%S).sql
cat your_dump.sql | docker exec -i solana_trading_db psql -U trading_user -d trading_db
- Never commit
.env
file with real credentials - Change default passwords in production
- Restrict network access in production environments
- Regularly backup your data
Feel free to submit issues and enhancement requests!