Documentation Index Fetch the complete documentation index at: https://mintlify.com/Mercaline2024/Ecomdrop-ia-connector-2/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Ecomdrop IA Connector is fully containerized using Docker, making it easy to deploy consistently across different environments. This guide covers building Docker images, using docker-compose, and configuring containers for production.
Docker Architecture
The application uses a multi-container setup:
Application Container : Node.js 20 Alpine running the Shopify app
MySQL Container : MySQL 8.0 with optimized configuration
Network : Custom overlay network (EcomdropNet) for service communication
Building the Docker Image
Dockerfile Overview
The application uses a production-optimized Dockerfile:
FROM node:20-alpine
RUN apk add --no-cache openssl netcat-openbsd
WORKDIR /app
ENV NODE_ENV=production
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev && npm cache clean --force
# Copy application code
COPY . .
# Build application
RUN npm run build
# The container waits for MySQL before starting
CMD [ "/app/docker-entrypoint.sh" ]
The Dockerfile includes a custom entrypoint script that waits for MySQL to be ready before starting the application, preventing connection errors during startup.
Build from Command Line
Navigate to project directory
Build the Docker image
docker build -t shopify-app_shopify_app:latest .
This creates an image tagged as shopify-app_shopify_app:latest.
Verify the image was built
docker images | grep shopify-app
You should see your newly built image listed.
For versioned deployments:
# Build with version tag
docker build -t shopify-app_shopify_app:v1.0.0 .
# Tag with multiple versions
docker tag shopify-app_shopify_app:v1.0.0 shopify-app_shopify_app:latest
Docker Compose Setup
Configuration File
The docker-compose.yml defines the complete application stack:
version : "3.8"
services :
mysql :
image : mysql:8.0
networks :
- EcomdropNet
environment :
MYSQL_ROOT_PASSWORD : ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE : shopify_app
MYSQL_USER : shopify_user
MYSQL_PASSWORD : ${MYSQL_PASSWORD}
volumes :
- mysql_data:/var/lib/mysql
healthcheck :
test : [ "CMD" , "mysqladmin" , "ping" , "-h" , "localhost" ]
interval : 10s
timeout : 5s
retries : 10
shopify_app :
image : shopify-app_shopify_app:latest
networks :
- EcomdropNet
environment :
DATABASE_URL : mysql://shopify_user:${MYSQL_PASSWORD}@mysql:3306/shopify_app
SHOPIFY_API_KEY : ${SHOPIFY_API_KEY}
SHOPIFY_API_SECRET : ${SHOPIFY_API_SECRET}
NODE_ENV : production
depends_on :
- mysql
networks :
EcomdropNet :
external : true
volumes :
mysql_data :
driver : local
Starting Services
Create environment file
Create a .env file with required variables: # Database
MYSQL_ROOT_PASSWORD = secure_root_password
MYSQL_PASSWORD = secure_user_password
# Shopify API
SHOPIFY_API_KEY = your_api_key
SHOPIFY_API_SECRET = your_api_secret
SHOPIFY_APP_URL = https://connector.ecomdrop.io
Create Docker network
docker network create --driver overlay EcomdropNet
This network allows containers to communicate securely.
Start services
The -d flag runs containers in detached mode.
Viewing Logs
Application Logs
MySQL Logs
All Services
# Follow logs in real-time
docker-compose logs -f shopify_app
# Last 100 lines
docker-compose logs --tail 100 shopify_app
Environment Configuration
Required Environment Variables
DATABASE_URL = mysql://shopify_user:password@mysql:3306/shopify_app
MYSQL_ROOT_PASSWORD = secure_root_password
MYSQL_PASSWORD = secure_user_password
Use strong, unique passwords for production deployments. Never commit passwords to version control.
Shopify API Configuration
SHOPIFY_API_KEY = your_shopify_api_key
SHOPIFY_API_SECRET = your_shopify_api_secret
SHOPIFY_APP_URL = https://connector.ecomdrop.io
SCOPES = read_products,write_products,read_orders,read_themes,write_themes
Get these values from your Shopify Partners Dashboard .
Optional Theme Configuration
THEME_2_5_GIT_REPO = your-org/theme-repo
THEME_2_5_GIT_BRANCH = main
THEME_2_5_GIT_PROVIDER = github
THEME_2_5_GIT_TOKEN = your_github_token
Required only if using the theme installation feature.
Application Configuration
NODE_ENV = production
PORT = 3000
TZ = America/Bogota
MySQL Container Configuration
Optimized MySQL Settings
The MySQL container is configured with production-optimized settings:
command :
- mysqld
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
- --max_allowed_packet=256M
- --innodb_buffer_pool_size=768M
- --max_connections=200
These settings are optimized for a typical VPS with 2-4GB RAM. Adjust innodb_buffer_pool_size based on your server’s available memory (typically 50-70% of total RAM).
Health Checks
MySQL includes a health check to ensure the database is ready:
healthcheck :
test : [ "CMD" , "mysqladmin" , "ping" , "-h" , "localhost" ]
interval : 10s
timeout : 5s
retries : 10
start_period : 30s
Container Management
Stopping Services
Stop All Services
Stop and Remove Volumes
Stop Specific Service
Restarting Services
# Restart all services
docker-compose restart
# Restart specific service
docker-compose restart shopify_app
Updating the Application
Rebuild the image
docker build -t shopify-app_shopify_app:latest .
Recreate containers
docker-compose up -d --force-recreate shopify_app
Verify the update
docker-compose logs -f shopify_app
Volume Management
Data Persistence
MySQL data is stored in a named volume:
volumes :
mysql_data :
driver : local
Backup Database Volume
# Create backup
docker run --rm \
-v shopify-app_mysql_data:/data \
-v $( pwd ) :/backup \
alpine tar czf /backup/mysql_backup_ $( date +%Y%m%d ) .tar.gz /data
# Restore backup
docker run --rm \
-v shopify-app_mysql_data:/data \
-v $( pwd ) :/backup \
alpine tar xzf /backup/mysql_backup_20250304.tar.gz -C /
Docker Swarm Deployment
For production deployments with high availability:
Initialize Swarm
# On manager node
docker swarm init
Deploy Stack
docker stack deploy -c docker-compose.yml shopify-app
Monitor Services
Service Status
Service Logs
Service Details
Scaling Services
# Scale application to 3 replicas
docker service scale shopify-app_shopify_app= 3
# Note: MySQL should remain at 1 replica
Do not scale MySQL replicas without proper replication configuration. Use a managed database service for high-availability databases.
Best Practices
Use .dockerignore
Exclude unnecessary files from the build context: node_modules
.git
.env
*.log
build
.cache
Multi-stage builds
For even smaller images, consider multi-stage builds to separate build dependencies from runtime.
Security scanning
# Scan for vulnerabilities
docker scan shopify-app_shopify_app:latest
Resource limits
Set resource limits in docker-compose.yml: deploy :
resources :
limits :
cpus : '1'
memory : 1G
reservations :
memory : 512M
Next Steps
Production Deployment Learn how to deploy to production with SSL and monitoring
Troubleshooting Common issues and solutions for Docker deployments