Self-Hosting selfh.st/icons With Git-Sync
Learn how to self-host the beautiful selfh.st/icons collection and keep it synchronized with the upstream repository using git-sync
selfh.st/icons is a beautiful collection of open-source icons designed specifically for modern dashboards, websites, and applications. With over 1000+ icons available in SVG, PNG, and WebP formats, it provides a consistent and minimalist design language that can enhance your user interfaces.
What is selfh.st/icons?
The project offers a comprehensive set of icons that are:
- Designed with a consistent style and pixel-perfect precision
- Available in SVG / PNG / WebP formats for maximum scalability
- Open-source and free to use
- Perfect for dashboards, admin panels, and modern web applications
- Regularly updated with new icons
You can browse and use these icons directly from selfh.st/icons, but what if you want to self-host them for better control, reliability, and customization?
Self-hosting selfh.st/icons
The icons collection is available on GitHub at github.com/selfhst/icons. To self-host, you can:
- Clone the repository
git clone https://github.com/selfhst/icons.git
- Serve the static files using your preferred web server (Nginx, Apache, etc.)
However, the challenge comes when you want to keep your self-hosted instance up-to-date with the upstream repository. As new icons are added or existing ones are improved, you'd want these updates in your self-hosted version.
Automating updates with git-sync
This is where git-sync comes in handy. It's a simple yet powerful tool that helps you keep your repository in sync with an upstream repository automatically.
Recently, I released a new version which allows users to sync public repositories from other GitHub projects as well which is another perfect use-case for allowing users to self-host their selfh.st/icons repository.
For any questions specifically around the project, feel free to reach out to me directly.
Setting up git-sync
- First, install git-sync:
You can install the latest binary from the releases page or use the pre-build Docker image.
- Setup configuration file:
Once you have git-sync installed, you can create a configuration file to define the sync behavior. Here's an example configuration for keeping selfh.st/icons in sync with your self-hosted instance:
raw_git_urls: ['https://github.com/selfhst/icons']
backup_dir: /path/to/backup
clone_type: full
Save this file as config.yaml under ~/.config/git-sync/ directory.
- Run git-sync:
Run the following command to start the sync process:
git-sync
This will clone the repository (if not already cloned) and keep it in sync with the cloud repository.
This is a one-time sync process, but if you want to keep it in sync with the cloud repository, you can setup a cron job to run the git-sync command at a regular interval or use the --cron flag to run it periodically and keep the service running in the background (more preferred way if you are running it via Docker).
More details about setting up git-sync can be found in the git-sync documentation.
Benefits of using git-sync
- Automated Updates: No manual intervention needed to stay up-to-date
- Configurable Sync Interval: Choose how frequently you want to check for updates
- Custom Commands: Run additional commands after syncing (e.g., rebuild your site)
- Lightweight: Minimal resource usage while running in the background
Conclusion
Self-hosting selfh.st/icons gives you complete control over your icon collection while git-sync ensures you're always in sync with the latest updates. This setup is perfect for:
- Organizations wanting to ensure icon availability
- Projects requiring offline access to icons
- Teams looking to customize or extend the icon collection
- Applications with high availability requirements
By combining selfh.st/icons with git-sync, you get the best of both worlds: a beautiful, comprehensive icon collection and automated synchronization to keep everything up-to-date.
Comments