Skip to content

MirekNguyen/self-hosted

Repository files navigation

Self hosted

self-hosted

I host numerous Docker services on my Raspberry Pi 4, this setup simplifies inter-container communication and enables flexible management. With custom Bash scripts and configurations, I can enable and disable containers on restart and control service states according to my needs. Please feel free to visit my website at mirekng.com to learn more about me and my projects.

Getting Started

Prerequisites

You will need linux server and docker

Installation

  1. Clone the repository: git clone https://github.com/mireknguyen/mirekng-homepage.git
  2. Navigate to the project directory: cd mirekng-homepage
  3. Run the automation script to set up Docker services.
./docker-services-up

Usage

  • To start the Docker services, run:
cd <project-folder> && ./docker-services-up
  • To stop the services, run:
cd <project-folder> && ./docker-services-down

Systemd

  1. Create a systemd file
touch /etc/systemd/system/self-hosted.service
  1. Add this (use your installation directory)
[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=true
WorkingDirectory=/home/user/self-hosted/
ExecStart=/home/user/self-hosted/docker-services-up
ExecStop=/home/user/self-hosted/docker-services-down

[Install]
WantedBy=multi-user.target

Run individual yml service

sudo docker-compose --env-file="./.env" --project-directory="./docker-services" -f "./docker-services/service.yml" up -d --remove-orphans

Docker run

sudo docker-compose --env-file="./.env" --project-directory="./docker-services" -f "./docker-services/service.yml" up -d --remove-orphans

About

Self hosted services as an alternative to paid cloud solutions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages