mirror of
https://github.com/myronblair/ProxMailcow
synced 2026-06-30 17:50:40 -05:00
Simplify cloud-init to SSH-only; add separate install scripts for NPM and Mailcow
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#cloud-config
|
||||
# Mailcow VM - Ubuntu 24.04
|
||||
# VM 201 | IP: 10.48.200.82
|
||||
# Hostname: mail.web.orbishosting.com
|
||||
# Minimal cloud-init: SSH access only. Run mailcow/install.sh after first login.
|
||||
|
||||
ssh_pwauth: true
|
||||
|
||||
@@ -9,81 +8,25 @@ users:
|
||||
- name: ubuntu
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
shell: /bin/bash
|
||||
lock_passwd: false
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBkYziIaOaq3RvncBi92m7jy96UxC8dm2VNeWDP2dyhs proxmailcow-admin
|
||||
|
||||
chpasswd:
|
||||
list: |
|
||||
ubuntu:mailstack2024!
|
||||
expire: false
|
||||
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
|
||||
packages:
|
||||
- qemu-guest-agent
|
||||
- curl
|
||||
- ca-certificates
|
||||
- git
|
||||
- htop
|
||||
- net-tools
|
||||
- nftables
|
||||
- qemu-guest-agent
|
||||
|
||||
runcmd:
|
||||
# Enable and start qemu-guest-agent
|
||||
- systemctl enable qemu-guest-agent
|
||||
- systemctl start qemu-guest-agent
|
||||
|
||||
# Set hostname (Mailcow requires this to match MAILCOW_HOSTNAME)
|
||||
- systemctl enable qemu-guest-agent --now
|
||||
- hostnamectl set-hostname mail.web.orbishosting.com
|
||||
- echo "127.0.0.1 mail.web.orbishosting.com mail" >> /etc/hosts
|
||||
|
||||
# Install Docker
|
||||
- curl -fsSL https://get.docker.com | sh
|
||||
- systemctl enable docker
|
||||
- usermod -aG docker ubuntu
|
||||
|
||||
# Install Mailcow
|
||||
- git clone https://github.com/mailcow/mailcow-dockerized /opt/mailcow-dockerized
|
||||
|
||||
# Generate Mailcow config non-interactively
|
||||
- |
|
||||
cd /opt/mailcow-dockerized
|
||||
MAILCOW_HOSTNAME=mail.web.orbishosting.com \
|
||||
MAILCOW_TZ=America/New_York \
|
||||
./generate_config.sh
|
||||
|
||||
# Configure Mailcow to run behind NPM reverse proxy
|
||||
# HTTP on 8080 (proxied by NPM), HTTPS bound only to localhost
|
||||
- |
|
||||
sed -i 's/^HTTP_PORT=.*/HTTP_PORT=8080/' /opt/mailcow-dockerized/mailcow.conf
|
||||
sed -i 's/^HTTP_BIND=.*/HTTP_BIND=0.0.0.0/' /opt/mailcow-dockerized/mailcow.conf
|
||||
sed -i 's/^HTTPS_PORT=.*/HTTPS_PORT=8443/' /opt/mailcow-dockerized/mailcow.conf
|
||||
sed -i 's/^HTTPS_BIND=.*/HTTPS_BIND=127.0.0.1/' /opt/mailcow-dockerized/mailcow.conf
|
||||
|
||||
# Pull images and start Mailcow
|
||||
- cd /opt/mailcow-dockerized && docker compose pull
|
||||
- cd /opt/mailcow-dockerized && docker compose up -d
|
||||
|
||||
# Add Mailcow startup service
|
||||
- |
|
||||
cat > /etc/systemd/system/mailcow.service << 'SERVICE'
|
||||
[Unit]
|
||||
Description=Mailcow Email Server
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/opt/mailcow-dockerized
|
||||
ExecStart=/usr/bin/docker compose up -d
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
SERVICE
|
||||
|
||||
- systemctl enable mailcow.service
|
||||
|
||||
final_message: |
|
||||
Mailcow VM is ready.
|
||||
Web UI accessible internally at: http://10.48.200.82:8080
|
||||
Default admin: admin / moohoo
|
||||
CHANGE THE PASSWORD IMMEDIATELY after DNS and NPM proxy are configured.
|
||||
- echo "127.0.1.1 mail.web.orbishosting.com mail" >> /etc/hosts
|
||||
|
||||
Reference in New Issue
Block a user