Skip to content

Commit

Permalink
attempting github action
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanwahab committed Oct 19, 2024
1 parent 18b5af0 commit 3f417c4
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 13 deletions.
66 changes: 53 additions & 13 deletions scripts/_bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#docker
#bun
#caddy
#portainer
#immich


# divide - install.sh + bootstrap.sh -blah;adlgapsdok
# merge scripts - make them good -> infra -> levels + shipfast jam stack shit

Expand Down Expand Up @@ -168,21 +175,21 @@
# passowrd nviida

#Update Docker's daemon.json to set the default runtime to nvidia
if [ -f /etc/docker/daemon.json ]; then
sudo jq '. + {"runtimes": {"nvidia": {"path": "nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}' /etc/docker/daemon.json | sudo tee /etc/docker/daemon.json.tmp
sudo mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
else
echo '{"runtimes": {"nvidia": {"path": "nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}' | sudo tee /etc/docker/daemon.json
fi
# if [ -f /etc/docker/daemon.json ]; then
# sudo jq '. + {"runtimes": {"nvidia": {"path": "nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}' /etc/docker/daemon.json | sudo tee /etc/docker/daemon.json.tmp
# sudo mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
# else
# echo '{"runtimes": {"nvidia": {"path": "nvidia-container-runtime", "runtimeArgs": []}}, "default-runtime": "nvidia"}' | sudo tee /etc/docker/daemon.json
# fi


# Add data-root configuration to Docker's daemon.json
if [ -f /etc/docker/daemon.json ]; then
sudo jq '. + {"data-root": "/mnt/docker"}' /etc/docker/daemon.json | sudo tee /etc/docker/daemon.json.tmp
sudo mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
else
echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
fi
# # Add data-root configuration to Docker's daemon.json
# if [ -f /etc/docker/daemon.json ]; then
# sudo jq '. + {"data-root": "/mnt/docker"}' /etc/docker/daemon.json | sudo tee /etc/docker/daemon.json.tmp
# sudo mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
# else
# echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
# fi


# Restart Docker to apply changes
Expand Down Expand Up @@ -399,3 +406,36 @@ fi
# --device /dev/video0 \
# --device /dev/video1 \
# dustynv/jupyterlab:r36.2.0



# Function to install and run Portainer
install_portainer() {
# Update package list and install dependencies
sudo apt-get update
sudo apt-get install -y docker.io

# Pull the latest Portainer image
sudo docker pull portainer/portainer-ce:latest

# Create a Docker volume for Portainer data
sudo docker volume create portainer_data

# Run Portainer container
sudo docker run -d \
--name=portainer \
--restart=always \
-p 8000:8000 \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest

echo "Portainer installation and setup completed."
}



# Call the functions to install Portainer and configure Caddy
install_portainer

14 changes: 14 additions & 0 deletions scripts/infra/caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ hashirama.blog {
reverse_proxy localhost:8080
}

route /portainer/* {

reverse_proxy localhost:9443

}

route /portainer/* {
reverse_proxy localhost:9000
}

route /immich/* {
reverse_proxy localhost:2283
}

header Access-Control-Allow-Origin *
header Access-Control-Allow-Methods "GET, POST, OPTIONS"
header Access-Control-Allow-Headers "Content-Type"
Expand Down

0 comments on commit 3f417c4

Please sign in to comment.