feat: automate Mailcow installation on ARM64 and add DNS configuration instructions
This commit is contained in:
parent
b0ba82f7ea
commit
31dfa6057c
2 changed files with 100 additions and 3 deletions
|
|
@ -118,14 +118,39 @@ export class AwsCdkStack extends cdk.Stack {
|
|||
'EOF',
|
||||
'cd /home/ubuntu/wireguard && docker compose up -d',
|
||||
|
||||
// 4.3 Setup permissions for all user folders
|
||||
// 4.3 Set up Mailcow (Email Server)
|
||||
'cat <<\'EOF\' > /home/ubuntu/email_server/install_mailcow.sh',
|
||||
'#!/bin/bash',
|
||||
'set -e',
|
||||
'cd /home/ubuntu/email_server',
|
||||
'git clone https://github.com/mailcow/mailcow-dockerized.git mailcow',
|
||||
'cd mailcow',
|
||||
'# Run generate_config.sh non-interactively for mail.tiproemail.com, timezone UTC',
|
||||
'export MAILCOW_HOSTNAME="mail.tiproemail.com"',
|
||||
'export MAILCOW_TZ="Asia/Kolkata"',
|
||||
'# Pipe answers to generate_config.sh: Hostname (mail.tiproemail.com), Timezone (Asia/Kolkata), Stable Branch (1)',
|
||||
'echo -e "mail.tiproemail.com\nAsia/Kolkata\n1" | ./generate_config.sh',
|
||||
'',
|
||||
'# Apply Memory Optimizations for t4g.medium (4GB RAM)',
|
||||
'# Disable ClamAV (Saves ~1.5 GB RAM)',
|
||||
'sed -i "s/SKIP_CLAMAV=n/SKIP_CLAMAV=y/g" mailcow.conf',
|
||||
'# Disable Solr (Saves ~1 GB RAM)',
|
||||
'sed -i "s/SKIP_SOLR=n/SKIP_SOLR=y/g" mailcow.conf',
|
||||
'',
|
||||
'# Start Mailcow',
|
||||
'docker compose up -d',
|
||||
'EOF',
|
||||
'chmod +x /home/ubuntu/email_server/install_mailcow.sh',
|
||||
'/home/ubuntu/email_server/install_mailcow.sh',
|
||||
|
||||
// 4.4 Setup permissions for all user folders
|
||||
'chown -R ubuntu:ubuntu /home/ubuntu/basic_requirements',
|
||||
'chown -R ubuntu:ubuntu /home/ubuntu/wireguard',
|
||||
'chown -R ubuntu:ubuntu /home/ubuntu/email_server',
|
||||
'chown -R ubuntu:ubuntu /home/ubuntu/build_tools',
|
||||
|
||||
// 4.4 Install CloudWatch Agent
|
||||
'wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb',
|
||||
// 4.5 Install CloudWatch Agent (ARM64 package for Graviton instance)
|
||||
'wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb',
|
||||
'dpkg -i -E ./amazon-cloudwatch-agent.deb',
|
||||
'mkdir -p /opt/aws/amazon-cloudwatch-agent/etc',
|
||||
'cat <<\'EOF\' > /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json',
|
||||
|
|
|
|||
72
dns_setup_instructions.md
Normal file
72
dns_setup_instructions.md
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Hostinger DNS Setup Instructions for Mailcow
|
||||
|
||||
Follow these steps one by one to configure your DNS records in Hostinger for your mail server.
|
||||
|
||||
---
|
||||
|
||||
### Step 1: Add the Subdomain (A Record)
|
||||
This points your mail subdomain to your EC2 instance's Elastic IP address.
|
||||
|
||||
1. Go to your **Hostinger Control Panel** > **DNS Zone Editor**.
|
||||
2. Create a new record with the following details:
|
||||
- **Type:** `A`
|
||||
- **Name (Host):** `mail`
|
||||
- **Points to (IP Address):** `13.205.93.190`
|
||||
- **TTL:** `14400` (or default)
|
||||
3. Click **Add Record**.
|
||||
|
||||
---
|
||||
|
||||
### Step 2: Route Emails (MX Record)
|
||||
This specifies that incoming emails sent to `@yourdomain.com` should be routed to Mailcow.
|
||||
|
||||
1. Check your existing DNS records in Hostinger and delete any default/old **MX** records first.
|
||||
2. Add a new record:
|
||||
- **Type:** `MX`
|
||||
- **Name (Host):** `@`
|
||||
- **Points to (Mail Server):** `mail.yourdomain.com` *(Replace "yourdomain.com" with your actual domain, e.g., "tiproemail.com")*
|
||||
- **Priority:** `10`
|
||||
- **TTL:** `14400` (or default)
|
||||
3. Click **Add Record**.
|
||||
|
||||
---
|
||||
|
||||
### Step 3: Authorize EC2 to Send Mail (SPF Record)
|
||||
This tells receiving mail servers that your EC2 instance IP is allowed to send emails on your behalf.
|
||||
|
||||
1. Add a new record:
|
||||
- **Type:** `TXT`
|
||||
- **Name (Host):** `@`
|
||||
- **TXT Value:** `v=spf1 ip4:13.205.93.190 -all`
|
||||
- **TTL:** `14400` (or default)
|
||||
2. Click **Add Record**.
|
||||
|
||||
---
|
||||
|
||||
### Step 4: Setup DMARC Policy (Protection against spoofing)
|
||||
This policy dictates how receiving servers should handle emails that fail SPF/DKIM checks.
|
||||
|
||||
1. Add a new record:
|
||||
- **Type:** `TXT`
|
||||
- **Name (Host):** `_dmarc`
|
||||
- **TXT Value:** `v=DMARC1; p=quarantine; pct=100; adkim=r; aspf=r`
|
||||
- **TTL:** `14400` (or default)
|
||||
2. Click **Add Record**.
|
||||
|
||||
---
|
||||
|
||||
### Step 5: Setup DKIM Record (DomainKeys Identified Mail)
|
||||
This adds a digital signature to outgoing emails to verify they were sent by you.
|
||||
|
||||
1. Deploy your EC2 instance and wait for Mailcow to start up.
|
||||
2. Log into the Mailcow web interface at: `https://mail.yourdomain.com` (Default login: Username: `admin` / Password: `moohoo` — **Change this password immediately!**).
|
||||
3. Navigate to **Configuration** > **ARC/DKIM**.
|
||||
4. In the "Domain" field, enter your domain name (e.g. `yourdomain.com`).
|
||||
5. Choose a selector (default is `dkim`).
|
||||
6. Click **Add** (or **Generate**). Mailcow will display a long public key string.
|
||||
7. Go back to your **Hostinger DNS Zone Editor** and add a new record:
|
||||
- **Type:** `TXT`
|
||||
- **Name (Host):** `dkim._domainkey` *(If you used a different selector than 'dkim', replace the prefix with 'selector._domainkey')*
|
||||
- **TXT Value:** *(Paste the entire public key string provided by Mailcow)*
|
||||
- **TTL:** `14400` (or default)
|
||||
8. Click **Add Record**.
|
||||
Loading…
Reference in a new issue