Installing Chrony, AdGuard Home, and VSCode

adguard
This guide will walk you through setting up **Chrony** (for time synchronization), **AdGuard Home** (for network-wide ad blocking), and **VS Code Server** (for remote code editing) using **Portainer**. Portainer simplifies the management of Docker containers and stacks.
 
— 
Prerequisites
1. **A server or machine running Docker**: This could be a Raspberry Pi, a NAS, or any Linux-based system.
2. **Portainer installed**: If you haven’t installed Portainer yet, follow the official [Portainer installation guide](https://docs.portainer.io/start/install).
3. **Basic knowledge of Docker and YAML**: Familiarity with Docker concepts and YAML syntax will be helpful.
 
 
Step 1: Access Portainer
1. Open your web browser and navigate to your Portainer instance (e.g., `http://<your-server-ip>:9000`).
2. Log in with your credentials.
 
 
Step 2: Create a New Stack
1. In the Portainer dashboard, go to **Stacks** in the left-hand menu.
2. Click **Add Stack**.
3. Give your stack a name (e.g., `tools-stack`).
 
 
Step 3: Define the Stack in YAML
In the **Web editor** section, paste the following YAML configuration. This stack will deploy **Chrony**, **AdGuard Home**, and **VS Code Server**.
 
version: '3.9'
services:
ntp:
build: .
image: simonrupf/chronyd:latest
container_name: NTP
restart: unless-stopped
network_mode: host
ports:
- 123:123/udp
environment:
- NTP_SERVERS=0.za.pool.ntp.org
- LOG_LEVEL=0
- TZ=Africa/Johannesburg
 
  adguard:

    image: adguard/adguardhome:latest

    container_name: adguard

    ports:

      - "53:53/tcp"  # DNS over TCP

      - "53:53/udp"  # DNS over UDP

      - "80:80/tcp"  # Web interface

      - "3000:3000/tcp"  # AdGuard Home admin interface

    volumes:

      - /path/to/your/adguard/workdir:/opt/adguardhome/work

      - /path/to/your/adguard/confdir:/opt/adguardhome/conf

    restart: unless-stopped
 
  vscode:
    image: codercom/code-server:latest
    container_name: vscode
    environment:
      – PASSWORD=yourpassword  # Set a secure password for VS Code access
    ports:
      – “8080:8080”  # VS Code web interface
    volumes:
      – /path/to/your/vscode/config:/home/coder/.config
      – /path/to/your/projects:/home/coder/project  # Replace with your project directory
    restart: unless-stopped
 
 
Step 4: Customize the Configuration
1. **Replace `/path/to/your/adguard/workdir` and `/path/to/your/adguard/confdir`**: These are where AdGuard Home will store its working and configuration files. Replace them with valid paths on your host machine (e.g., `/home/user/adguard/work` and `/home/user/adguard/conf`).
2. **Replace `/path/to/your/vscode/config`**: This is where VS Code Server will store its configuration files. Replace it with a valid path on your host machine (e.g., `/home/user/vscode/config`).
3. **Replace `/path/to/your/projects`**: This is where your code projects will be stored. Replace it with a valid path on your host machine (e.g., `/home/user/projects`).
4. **Set a secure password**: Replace `yourpassword` in the `PASSWORD` environment variable for VS Code Server with a strong password.
 
 
Step 5: Deploy the Stack
1. Scroll down and click **Deploy the stack**.
2. Portainer will pull the Docker images and start the containers. This may take a few minutes.
 
 
Step 6: Access the Services
1. **Chrony**:
   – Chrony will run in the background and synchronize your system time. No additional configuration is required unless you want to customize the NTP servers.
2. **AdGuard Home**:
   – Open your browser and navigate to `http://<your-server-ip>:3000`.
   – Follow the on-screen instructions to complete the AdGuard Home setup.
   – Configure your router or devices to use the AdGuard Home DNS server (`<your-server-ip>:53`).
3. **VS Code Server**:
   – Open your browser and navigate to `http://<your-server-ip>:8080`.
   – Log in using the password you set in the `PASSWORD` environment variable.
 
 
Step 7: Configure AdGuard Home
1. In the AdGuard Home web interface, configure your DNS settings and blocklists.
2. Set up DHCP (if needed) by enabling it in the AdGuard Home settings.
 
 
Step 8: Verify the Setup
1. **Chrony**:
   – Check the logs in Portainer to ensure Chrony is running and synchronizing time correctly.
2. **AdGuard Home**:
   – Test DNS resolution and ad blocking by visiting a website with ads.
3. **VS Code Server**:
   – Open a project and verify that you can edit and save files.
 
 
Optional: Secure Your Setup
1. **AdGuard Home**:
   – Enable HTTPS for the web interface by configuring SSL certificates in the AdGuard Home settings.
2. **VS Code Server**:
   – Use a reverse proxy (e.g., Nginx) with HTTPS to secure the VS Code web interface.
   – Consider restricting access to the VS Code port (8080) using a firewall.
 
 
Troubleshooting
– **Chrony not synchronizing time**: Check the logs in Portainer for errors. Ensure the `SYS_TIME` capability is enabled.
– **AdGuard Home not blocking ads**: Verify the DNS settings and ensure devices are using the AdGuard Home DNS server.
– **VS Code Server not loading**: Check the logs in Portainer for errors. Ensure the configuration and project paths are correct.
 
 
Congratulations! You’ve successfully set up **Chrony**, **AdGuard Home**, and **VS Code Server** using Portainer. Enjoy synchronized time, ad-free browsing, and remote code editing!

Similar Posts

Leave a Reply