Giter Site home page Giter Site logo

jwillikers / unifi-controller Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 2.0 24 KB

A Kubernetes configuration file for running the UniFi Controller with Podman

License: Other

podman docker unifi-controller containers systemd kubernetes kubernetes-configuration okd

unifi-controller's Introduction

UniFi Controller

A Kubernetes configuration file for running the UniFi Controller with Podman.

Synopsis

Run the UniFi controller in a rootless container via Podman, configure it as a systemd service, and automate image updates. This project uses the docker-unifi-controller image provided by LinuxServer.io and uses a Kubernetes configuration file similar to the provided docker-compose.

Getting Started

The instructions here have been tested on Ubuntu 18.04.

  1. Follow the Podman installation instructions to install Podman.

  2. Clone this project’s Git repository.

    ➜ git clone https://github.com/jwillikers/unifi-controller.git ~/Projects/unifi-controller
  3. Use podman-play-kube(1) to create the unifi-controller pod. The instructions here use rootless Podman containers running under the current user for increased security.

    ➜ podman play kube ~/Projects/unifi-controller/unifi-controller.yml
    ℹ️

    The container will store persistent data in a Podman volume with the same name as the Persistent Volume Claim.

  4. Access the controller’s web console at https://127.0.0.1:8443/.

    fish
    ➜ open http://127.0.0.1:8443
    Other shells
    ➜ xdg-open http://127.0.0.1:8443

Automate

Podman makes it extremely easy to set up your pods as systemd services. It also offers deeper integration with systemd services within the containers themselves. Follow the instructions here to configure the unifi-controller pod to be managed as a service by systemd and automatically started when your user logs in.

  1. Create the systemd directory for user units.

    ➜ mkdir -p ~/.config/systemd/user/
  2. Change to this directory.

    cd ~/.config/systemd/user/
  3. To view your current pods, use the following command.

    ➜ podman pod ps
    POD ID        NAME              STATUS   CREATED         INFRA ID      # OF CONTAINERS
    a8a533215a75  unifi-controller  Running  47 minutes ago  ccf291de56ac  2
  4. Generate the systemd service unit files for the unifi-controller pod with podman-generate-systemd(1).

    Here I generate the actual files using the --files option and use the --name option to name them using the pod name instead of the hash. The --new option creates a new container when the service starts and destroys the container when it stops. This option allows Podman to automatically apply updates to the container.

    ➜ podman generate systemd --files --name --new unifi-controller
    /home/jordan/.config/systemd/user/pod-unifi-controller.service
    /home/jordan/.config/systemd/user/container-unifi-controller_unifi-controller_1.service
  5. Enable the pod’s systemd service unit.

    ➜ systemctl --user enable --now pod-unifi-controller.service
    Created symlink /home/jordan/.config/systemd/user/multi-user.target.wants/pod-unifi-controller.service → /home/jordan/.config/systemd/user/pod-unifi-controller.service.
    Created symlink /home/jordan/.config/systemd/user/default.target.wants/pod-unifi-controller.service → /home/jordan/.config/systemd/user/pod-unifi-controller.service.
  6. Enable automatic updates of the container image.

    Podman ships with both system and user auto-update timers for systemd. Here I enable the user timer to activate the auto-update service. The timer is runs daily.

    ➜ systemctl --user enable --now podman-auto-update.timer
    Created symlink /home/jordan/.config/systemd/user/timers.target.wants/podman-auto-update.timer → /usr/lib/systemd/user/podman-auto-update.timer.

Contributing

Contributions in the form of issues, feedback, and even pull requests are welcome. Make sure to adhere to the project’s Code of Conduct.

Open Source Software

This project is built on the hard work of countless open source contributors. Several of these projects are enumerated below.

Code of Conduct

The project’s Code of Conduct is available in the Code of Conduct file.

License

This repository is licensed under the GPLv3, available in the license file.

© 2021 Jordan Williams

Authors

unifi-controller's People

Contributors

jwillikers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nos1609 bbeaudoin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.