~liz/den-tv

events actually end at the very end of the day they end
remove redundant data URL

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~liz/den-tv
read/write
git@git.sr.ht:~liz/den-tv

You can also use your local clone with git send-email.

#den-tv

Runs a display that runs 24/7 in the middle of our kitchen providing us with useful information

#Design

den-tail is the (Actix) backend, which retrieves all the data den-head is the (Yew) frontend, which renders the HTML den-message is the (JSON) interchange format to send data from the tail to the head

#Requirements

Built with Rust 1.74. Uses cargo-make for development tasks

There's a default.nix if you're a NixOS sicko

#Development

Run the development server with cargo make serve.

This will run den-tail on port 8080, and proxy /, /trunk/ and /static to the Trunk on port 8090

#Deployment

cargo make tar will run cargo build --release for den-tail, trunk build --release for den-head, Then package static/ and the resulting binaries up into a tarball.

Because all the configuration is build-time, this tarball should be treated as a secret.

I deploy mine with Ansible playbook:

- name: set up docker hosts
  hosts:
  - den-tv
  remote_user: ellie
  tasks:
  - name: den tv directory
    file:
      state: directory
      path: '/opt/den-tv'
    register: 'dir'
    become: true
  - name: den-user
    ansible.builtin.user:
      name: dentv
      home: '{{ dir.path }}'
    register: user
    become: true
  - ansible.builtin.unarchive:
      copy: true
      src: '../den-tv/den-tv.tar.gz'
      owner: '{{ user.name }}'
      dest: '{{ dir.path }}'
    become: true
    register: archive
  - name: systemd unit file
    template:
      src: den-tv.service.tmpl
      dest: "/etc/systemd/system/den-tv.service"
      owner: root
    become: true
    register: unit
    # only because we compile on nixos
  - name: install patchelf
    ansible.builtin.apt:
      name: patchelf
    become: true
  - name: run patchelf
    when: archive.changed
    shell:
      cmd: patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 /opt/den-tv/den-tail
    become: true
  - name: start service
    ansible.builtin.systemd_service:
      name: den-tv
      daemon-reload: "{{ unit.changed }}"
      enabled: true
      state: restarted
    become: true
[Unit]
Description="den TV service"

[Service]
WorkingDirectory={{ dir.path }}
ExecStart={{ dir.path }}/den-tail
User={{ user.name }}
Environment=RUST_LOG=den_tail=debug

[Install]
WantedBy=multi-user.target