This document outlines the recommended workflow for developing and deploying code using VS Code within the Argentquest Development Suite architecture. The stack uses three environment files (.env, .env.dev, .env.prod) for flexible development and deployment scenarios.
For local development, you will work directly on your machine, and changes will be instantly reflected in the app-dev container thanks to hot-reloading and Docker volume mounts.
Before starting development, ensure your environment files are properly configured:
-
Main Configuration (
.env): Used for local development apps- Database connections use Docker network names (
postgres:5432,mongodb:27017) - Configured for Docker internal communication
- Database connections use Docker network names (
-
Development Container (
.env.dev): Used byapp-devcontainer- Debug logging, hot reload enabled
- Single worker for easier debugging
- Relaxed security settings
-
Production Container (
.env.prod): Used byapp-prodcontainer- Multiple workers, performance optimized
- Strict security and logging settings
-
Open your terminal or command prompt.
-
Navigate to the root directory of your
argentquest-suiteproject. -
Ensure your
.envfile is configured (copy from.env.templateif needed):cp .env.template .env # Edit .env with your API keys and settings -
Start the Docker containers for your development environment:
docker-compose up -d
This command starts all 22 services including dual FastAPI containers (
app-devandapp-prod). -
Validate your setup:
./validate-database-setup.sh
- Open the
argentquest-suiteproject folder in VS Code. - Navigate to the
appdirectory (e.g.,app/main.py,app/services/database_service.py). - Make your desired code changes.
As you save your changes, the app-dev container, configured with uvicorn --reload, will automatically detect these changes and restart, applying them instantly.
Development URLs:
- Development API: http://api-dev.pocmaster.argentquest.com
- Production API: http://api.pocmaster.argentquest.com
- API Documentation: http://api-dev.pocmaster.argentquest.com/docs
- Database Management:
- pgAdmin: http://localhost:5050 (admin@example.com / admin)
- System Monitor: http://localhost:3000
For database connections during development:
From your local development code (using .env file):
- PostgreSQL:
postgresql://pocuser:pocpass@postgres:5432/poc_db - MongoDB:
mongodb://mongoadmin:mongopass123@mongodb:27017/poc_mongo_db
From external database tools:
- PostgreSQL:
localhost:5432(poc_db, pocuser/pocpass) - MongoDB:
localhost:27017(poc_mongo_db, mongoadmin/mongopass123)
Both databases come pre-loaded with comprehensive test data including users, stories, world-building elements, and AI conversation history.
Once your changes are tested and stable in the development environment, you will prepare them for deployment to the production environment via Git.
- Open the Source Control view in VS Code (Ctrl+Shift+G or Cmd+Shift+G).
- Stage your changes by clicking the
+icon next to the files you've modified, or by clickingStage All Changes. - Enter a descriptive commit message in the message box (e.g., "feat: Add new user authentication endpoint").
- Click the
Commitbutton.
- Ensure you are on the
mainormasterbranch (or the designated production branch). - Click the
Pushbutton in the Source Control view, or use theSynchronize Changesbutton to pull and then push.
This will push your committed changes to the remote GitHub repository.
Deployment to the production instance is a manual process that involves connecting to your production server and updating the running Docker containers.
- Use an SSH client (like PuTTY on Windows or the built-in Terminal on macOS/Linux) to connect to your production server.
Replace
ssh your_username@your_production_server_ip
your_usernameandyour_production_server_ipwith your actual credentials.
- Once connected to the production server, navigate to the root directory of your
argentquest-suiteproject. - Pull the latest code changes from your GitHub repository:
(Replace
git pull origin main
mainwithmasterif that is your production branch name). - Rebuild and restart the
app-prodcontainer (and any other affected services) to apply the new code:This command will rebuild only thedocker-compose up -d --build app-prod
app-prodservice and restart it, ensuring your changes are live. If other services also need to be rebuilt due to changes in their Dockerfiles or contexts, you can list them or rundocker-compose up -d --buildwithout specifying a service name to rebuild all services.
To enhance your development experience with VS Code:
- Docker: Provides an explorer to manage Docker images, containers, and registries directly from VS Code.
- Python: (Microsoft) Rich support for Python development, including IntelliSense, linting, debugging, and more.
- Remote - SSH: Allows you to open any folder on a remote machine using SSH and take advantage of VS Code's full feature set.
The stack includes a browser-based VS Code Server for remote development:
- URL: http://code.pocmaster.argentquest.com
- Password:
dev123(configurable in.env) - Features: Full VS Code experience in your browser
- Usage: Ideal for server-based development or when you can't install VS Code locally
Benefits:
- Access your development environment from any device
- No local VS Code installation required
- Direct access to running containers and logs
- Integrated terminal with Docker access
- Integrated Terminal: Access your host machine's terminal directly within VS Code.
- Debugging: Set breakpoints and step through your Python code running in the
app-devcontainer. - Linting & Formatting: Configure linters (e.g., Black, Flake8) and formatters (e.g., Black) to maintain code quality and consistency.
The stack provides three distinct environments:
-
Local Development (
.env):- Use for standalone Python applications
- Docker network connections to shared databases
- Full access to all services
-
Development Container (
app-dev):- Hot-reload enabled for rapid development
- Debug logging for detailed troubleshooting
- Single worker for easier debugging
-
Production Container (
app-prod):- Production-like testing environment
- Multiple workers for performance testing
- Strict logging and security
# Test development container
curl http://api-dev.pocmaster.argentquest.com/health
# Test production container
curl http://api.pocmaster.argentquest.com/health
# Compare response times and behaviorAccess database directly for debugging:
# PostgreSQL via Docker
docker exec -it aq-devsuite-postgres psql -U pocuser -d poc_db
# MongoDB via Docker
docker exec -it aq-devsuite-mongodb mongosh -u mongoadmin -p mongopass123 --authenticationDatabase admin
# View container logs
docker-compose logs -f app-dev
docker-compose logs -f app-prodIssue: Container not using updated environment variables Solution:
# Restart containers to reload environment files
docker-compose restart app-dev app-prodIssue: Database connection refused Solution:
- Ensure containers use Docker network names (
postgres,mongodb) - External tools should use
localhostconnections - Verify credentials match environment files
Issue: Changes not reflected in app-dev Solution:
# Check volume mount and restart
docker-compose logs app-dev
docker-compose restart app-devRun comprehensive validation:
./validate-database-setup.sh
python health-check.py