π Deployment Guide
This guide covers the setup and deployment process for WATA, from prerequisites to running the application.
Prerequisitesβ
Before deploying WATA, ensure you have:
- Saxo Bank account with API access
- Dedicated Ubuntu server (VPS or local machine)
- Docker and Docker Compose installed
- Python 3.12+
- Ansible (for automated deployment)
- Telegram bot for notifications
- (Optional) TradingView account for webhook signals
Deployment Stepsβ
1. Configure Inventoryβ
- Copy the example Ansible inventory file:
cp deploy/tools/ansible/inventory/inventory_example.ini deploy/tools/ansible/inventory/inventory.ini
- Edit
inventory.ini
with your server details:- Server hostname or IP
- SSH user and authentication method
- Other Ansible configuration as needed
2. Build Application Packageβ
- Build the deployment package:
This creates a distributable package with all necessary components.
./package.sh
3. Deploy to Your Serverβ
- Run the deployment script:
cd deploy/tools
./deploy_app_to_your_server.sh - The script uses Ansible to:
- Install required dependencies
- Set up Docker and Docker Compose
- Configure the application directory structure
- Deploy the application files
- Set up convenient aliases for management
4. Configure Application Settingsβ
After deployment, you need to set up the configuration:
-
Configure RabbitMQ Password
# Navigate to the deploy directory
cd /app/deploy
# Copy the example .env file
cp .env.example .env
# Edit the .env file to set your custom RabbitMQ password
nano .envThis sets the password used by RabbitMQ and automatically updates your config.json file through the setup service.
-
Set Up Configuration File
cp /app/etc/config_example.json /app/etc/config.json
nano /app/etc/config.jsonUpdate the configuration with your:
- Saxo Bank API credentials
- Telegram bot information
- Trading rules and preferences
- Other settings as needed
For detailed configuration options, see the Configuration Guide.
5. Manage the Applicationβ
Use these aliases to manage WATA on your server:
watastart
: Start the applicationwatastop
: Stop the applicationwatalogs
: View application logswatastatus
: Check application statuswatasaxoauth
: Launch the secure authorization code submission processwatawebtoken
: View your webhook authentication tokenwatawebtoken --new
: Generate a new webhook token
Docker Compose Architectureβ
WATA uses Docker Compose with an enhanced configuration:
Environment Variablesβ
- The
.env
file in the/app/deploy
directory manages sensitive configuration - Primary use is setting the RabbitMQ password, which is synchronized with your config.json
Service Dependenciesβ
- A special
setup
service runs before other services to ensure proper configuration - This service updates the RabbitMQ password in config.json to match your .env file
- All other services depend on both the setup service and RabbitMQ
Container Structureβ
The application runs in several containers:
- rabbitmq: Message broker for inter-service communication
- web_server: Receives webhook signals
- trader: Handles Saxo Bank operations
- scheduler: Manages periodic tasks
- telegram: Handles notifications
Troubleshootingβ
- Container not starting: Check logs with
watalogs
to identify issues - Authentication problems: Verify Saxo credentials in config.json
- Connection issues: Ensure your server has proper internet access
- Configuration problems: Compare with example configuration for missing fields