Last active
May 27, 2025 20:49
-
-
Save imerfanahmed/3d6bfb0286b0702cc67c9fe1f8441c93 to your computer and use it in GitHub Desktop.
Custom GTM Server Setup using docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
gtm-server: | |
image: gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable | |
ports: | |
- "8080:8080" | |
environment: | |
#Your base64 string | |
- CONTAINER_CONFIG=aWQ9R1asdfRasdfNLUtadsfTWEasdfs4WjNKJmVudj0xJmF1dGg9OWsdfUtdTlfOC16RnpoVF9ZZ2RvYTBfUQ== | |
#put your subdomain here | |
- PREVIEW_SERVER_URL=https://preview.example.com | |
- RUN_AS_PREVIEW_SERVER=true | |
restart: always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Docs | |
1. Create a virtual host using your subdomain and configure it to point to port 8080. | |
2. Make sure to apply SSL certificates using Certbot. | |
3. Configure the Docker Compose file according to the provided instructions. | |
4. Congratulations! Your GTM server is now up and running. | |
5. Verify the setup by visiting: `https://preview.example.com/healthz`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name preview.example.com; | |
# Redirect HTTP to HTTPS (optional, recommended) | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name preview.example.com; | |
# SSL certificates (adjust paths accordingly) | |
location / { | |
proxy_pass http://127.0.0.1:8080; # your GTM server running locally on 8080 | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
# Optional WebSocket support (if needed) | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment