This script installs a self-hosted Google Tag Manager Server-Side container using Docker, Nginx, and Certbot, allowing full control over your tagging environment with custom domains.
- ✅ Prompts for project name, container config, and domains
- ✅ Dynamically assigns available ports (starting from 8080+)
- ✅ Creates isolated folder at
/opt/<project_name> - ✅ Optionally installs dependencies (nginx, certbot, docker-compose)
- ✅ Sets up Docker containers for preview + production
- ✅ Configures Nginx reverse proxy with healthcheck
- ✅ Offers automatic SSL certificate generation via Let's Encrypt
- ✅ New: Updates existing installations to the latest version
- Ubuntu 20.04+ with root access
- Docker & Docker Compose (optional: script can install)
- 2 subdomains pointed to your server IP:
gtm-preview.example.comgtm.example.com
To install a new GTM server instance:
sudo bash installer.shFollow the prompts:
- Project Name: e.g.,
gtm-contaideal - Config: Paste your base64 Container Config
- Domains: Enter preview and production domains
To update an existing project (e.g., gtm-contaideal) to the latest version (4.0.0):
sudo bash installer.sh --updateWhen prompted, enter the project name you want to update:
Enter the project name to update (e.g. gtm-contaideal): gtm-contaideal
The script will:
- Pull the latest
4.0.0Docker image. - Gracefully restart the containers for that specific project.
To set up SSL after DNS propagation:
sudo bash installer.sh --sslEnter the project name when prompted.