Skip to content

Instantly share code, notes, and snippets.

@gruberdev
Last active April 15, 2025 13:27
Show Gist options
  • Save gruberdev/6618a3ad5010ceb335b4d728cc23fe10 to your computer and use it in GitHub Desktop.
Save gruberdev/6618a3ad5010ceb335b4d728cc23fe10 to your computer and use it in GitHub Desktop.

Revisions

  1. gruberdev revised this gist Apr 15, 2025. 1 changed file with 9 additions and 8 deletions.
    17 changes: 9 additions & 8 deletions init.sh
    Original file line number Diff line number Diff line change
    @@ -6,12 +6,13 @@ echo "Installing git, docker.io, and make..."
    sudo apt-get install -y git docker.io make
    echo "Starting and enabling Docker service..."
    sudo systemctl start docker
    sudo systemctl enable docker

    echo "Adding current user ($USER) to the docker group..."
    sudo usermod -aG docker $USER
    newgrp docker

    git clone https://github.com/gruberdev/local-gitops.git
    cd local-gitops
    sudo systemctl enable docker && \
    echo "Adding current user ($USER) to the docker group..." && \
    sudo usermod -aG docker $USER && \
    newgrp docker && \
    git clone https://github.com/gruberdev/local-gitops.git && \
    cd local-gitops && \
    make
    task tools
    task dns
    task
  2. gruberdev revised this gist Apr 15, 2025. 1 changed file with 4 additions and 28 deletions.
    32 changes: 4 additions & 28 deletions init.sh
    Original file line number Diff line number Diff line change
    @@ -1,41 +1,17 @@
    #!/bin/bash

    # Exit immediately if a command exits with a non-zero status.
    set -e

    # --- Update Package List ---
    # Refresh the list of available packages from the repositories.
    echo "Updating apt package list..."
    sudo apt-get update -y

    # --- Install Required Packages ---
    # Install Git (version control), Docker (containerization), and Make (build automation).
    echo "Installing git, docker.io, and make..."
    sudo apt-get install -y git docker.io make

    # --- Initialize and Enable Docker ---
    # Ensure the Docker service is running and set it to start automatically on boot.
    echo "Starting and enabling Docker service..."
    sudo systemctl start docker
    sudo systemctl enable docker

    # --- Add User to Docker Group ---
    # Add the current user ($USER) to the 'docker' group.
    # This allows running docker commands without needing sudo.
    # IMPORTANT: You need to log out and log back in for this change to take effect!
    echo "Adding current user ($USER) to the docker group..."
    sudo usermod -aG docker $USER
    newgrp docker

    # --- Completion Message ---
    echo "-----------------------------------------------------"
    echo "Initialization complete!"
    echo "Packages installed: git, docker.io, make."
    echo "Docker service started and enabled."
    echo "User $USER added to the docker group."
    echo "IMPORTANT: Please log out and log back in for group changes to take effect."
    echo "-----------------------------------------------------"

    # You can verify docker works without sudo after logging back in by running:
    # docker run hello-world

    exit 0
    git clone https://github.com/gruberdev/local-gitops.git
    cd local-gitops
    make
  3. gruberdev created this gist Apr 15, 2025.
    41 changes: 41 additions & 0 deletions init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/bin/bash

    # Exit immediately if a command exits with a non-zero status.
    set -e

    # --- Update Package List ---
    # Refresh the list of available packages from the repositories.
    echo "Updating apt package list..."
    sudo apt-get update -y

    # --- Install Required Packages ---
    # Install Git (version control), Docker (containerization), and Make (build automation).
    echo "Installing git, docker.io, and make..."
    sudo apt-get install -y git docker.io make

    # --- Initialize and Enable Docker ---
    # Ensure the Docker service is running and set it to start automatically on boot.
    echo "Starting and enabling Docker service..."
    sudo systemctl start docker
    sudo systemctl enable docker

    # --- Add User to Docker Group ---
    # Add the current user ($USER) to the 'docker' group.
    # This allows running docker commands without needing sudo.
    # IMPORTANT: You need to log out and log back in for this change to take effect!
    echo "Adding current user ($USER) to the docker group..."
    sudo usermod -aG docker $USER

    # --- Completion Message ---
    echo "-----------------------------------------------------"
    echo "Initialization complete!"
    echo "Packages installed: git, docker.io, make."
    echo "Docker service started and enabled."
    echo "User $USER added to the docker group."
    echo "IMPORTANT: Please log out and log back in for group changes to take effect."
    echo "-----------------------------------------------------"

    # You can verify docker works without sudo after logging back in by running:
    # docker run hello-world

    exit 0