Setting Up Alta Labs Control Docker Environment on macOS (without Macvlan)

I faced several challenges while setting up the Alta Labs Control Docker environment on macOS. This guide is designed to help others set it up efficiently, covering steps for creating networks, running containers, updating configurations, changing IPs, creating backups, and restoring the setup.


Contents

Part 1: Setting Up the Environment

  • Creating a Docker network.
  • Running and verifying the Alta Labs Control container.

Part 2: Applying Updates Inside the Container

  • Updating software immediately after initial setup.

Part 3: Changing the Container IP and Updating the Setup

  • Changing to a new IP range after Route10 is operational.
  • Updating Nginx configuration.
  • Verifying and troubleshooting the new setup.

Part 4: Backing Up the Environment

  • Saving container states and network configurations.

Part 5: Restoring from Snapshots

  • Recreating networks and containers from backups.

Additional Notes
Tips for regular updates, backups, and monitoring.


Important Notes:

  • When creating the network for the first time, you must use the 192.168.x.x subnet, as the Route10 system relies on these IPs for initial setup.
  • Once the initial setup is complete and Route10 is up and running, you can change the IP to any range that suits your network (e.g., 10.x.x.x).
  • Before changing the IP, update the configurations in Alta Route10 first. This avoids potential IP conflicts and ensures continued access to the Alta Control Interface.
  • Regular backups are critical to safeguard against server outages or activation issues (e.g., manage.alta.inc).

Part 1: Setting Up the Environment

Step 1: Create a Custom Docker Network

  1. Open your terminal and create a custom bridge network:
docker network create \\
  --driver=bridge \\
  --subnet=192.168.1.0/24 \\
  custom_bridge
  1. Verify the network:
docker network inspect custom_bridge

Step 2: Run the Container

  1. Start the Alta Labs Control container with a static IP:
docker run -it \\
  --privileged \\
  --network custom_bridge \\
  --ip 192.168.1.11 \\
  -p 80:80 \\
  -p 443:443 \\
  --name control \\
  <image_name>

Step 3: Verify the Setup

  1. Check the container’s IP:
docker exec -it control ip a
  1. Test connectivity and services:
ping 192.168.1.11
curl <http://192.168.1.11>

Part 2: Applying Updates Inside the Container

Important:
This step should be performed immediately after the initial container setup (Part 1), as the Route10 system requires a properly configured and updated environment for recognition.

Step 1: Update Software

  1. Access the container:
docker exec -it control bash
  1. Update software packages:
sudo apt update && sudo apt upgrade -y
  1. Verify installed versions as required by Alta Labs Control.

Part 3: Changing the Container IP and Updating the Setup

Once the initial setup is complete and Route10 is up and running, you can change the container’s IP to a range that suits your network needs. Most users may not want to use the 192.x.x.x range permanently.

Important:
Before proceeding, it is strongly recommended to update the IP configuration in Alta Route10 first. This ensures the container’s new IP does not conflict with existing devices. Failure to update Route10’s IP settings first may result in IP conflicts, causing loss of access to the Alta Control Interface.


Part 3.1: Changing the Container IP to a New Subnet

Step 1: Create a New Network

  1. Create a new bridge network with the desired subnet (e.g., 10.0.0.0/24):
docker network create \\
  --driver=bridge \\
  --subnet=10.0.0.0/24 \\
  custom_bridge_10
  1. Verify:
docker network inspect custom_bridge_10

Step 2: Move the Container to the New Network

  1. Disconnect the container from the current network:
docker network disconnect custom_bridge control
  1. Connect the container to the new network with a specific IP:
docker network connect --ip 10.0.0.165 custom_bridge_10 control
  1. Verify:
docker network inspect custom_bridge_10
docker exec -it control ip a

Step 3: Test the New Configuration

  1. Ping the new IP:
ping 10.0.0.165
  1. Test accessibility of services:
curl <http://10.0.0.165>

Part 3.2: Updating Nginx Configuration

Step 1: Edit the Configuration File

  1. Open the Nginx configuration file:
sudo nano /etc/nginx/sites-available/default
  1. Ensure the proxy_pass or other relevant directives are updated:
location / {
    proxy_pass <http://127.0.0.1:<backend-port>>;
}

Step 2: Restart Nginx

  1. Restart the Nginx service:
sudo systemctl restart nginx

Part 3.3: Verifying and Troubleshooting

  1. Check the container’s network configuration:
ip a
  1. Confirm the bridge configuration:
brctl show
  1. Monitor logs for issues:
tail -f /var/log/nginx/access.log
  1. Debug network traffic:
tcpdump -i eth0 host 10.0.0.165

Part 4: Backing Up the Environment

Step 1: Save the Container

  1. Commit the current container state:
docker commit control control_snapshot:latest
  1. Save the container snapshot:
docker save -o ~/Desktop/control_snapshot.tar control_snapshot:latest

Step 2: Backup the Network Configuration

  1. Save the network settings:
docker network inspect custom_bridge > ~/Desktop/custom_bridge_backup.json

Perform these backups regularly to ensure quick restoration in case of failure.


Part 5: Restoring from Snapshots

Step 1: Restore the Network

  1. Recreate the custom bridge:
docker network create \\
  --driver=bridge \\
  --subnet=192.168.1.0/24 \\
  custom_bridge
  1. Verify against the backup JSON:
cat ~/Desktop/custom_bridge_backup.json

Step 2: Restore the Container

  1. Load the container snapshot:
docker load -i ~/Desktop/control_snapshot.tar
  1. Run the restored container:
docker run -it \\
  --privileged \\
  --network custom_bridge \\
  --ip 192.168.1.11 \\
  -p 80:80 \\
  -p 443:443 \\
  --name control \\
  control_snapshot:latest

Additional Notes

  • Regular Updates: Keep the container software updated:
sudo apt update && sudo apt upgrade -y
  • Backup Best Practices:
    • Save the container periodically:
docker commit control control_snapshot:latest
docker save -o ~/Desktop/control_snapshot.tar control_snapshot:latest
  • Backup the network:
docker network inspect custom_bridge > ~/Desktop/custom_bridge_backup.json
  • Monitoring and Troubleshooting:
    • Monitor Nginx logs:
tail -f /var/log/nginx/access.log
  • Debug traffic:
tcpdump -i eth0 host 192.168.1.1
3 Likes

This is an incredible guide. Thanks so much for documenting your process so thoroughly and sharing it with everyone here!

I realized, there was opportunity to Improvise so updated content accordingly