Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd support #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add systemd support #20

wants to merge 3 commits into from

Conversation

morbidick
Copy link
Contributor

i added the option to use systemd instead of supervisord. To handle both handlers with the listen directive i had to set ansible min version to >=2.2, i took the opportunity to migrate the sudo statements to become and fix the warnings.

@astorije
Copy link
Owner

astorije commented Dec 1, 2017

Hey @morbidick, sorry I never replied to you!

We actually have DEBs for The Lounge, built using https://github.com/thelounge/deb-lounge and stored with every (non pre-release) versions, for example here: https://github.com/thelounge/lounge/releases/tag/v2.6.0 (see the bottom: lounge.deb).

Would you be willing to switch your change to use that instead?

There will be a couple issues for sure (like not being able to use pre-releases at the moment), but I do think on the long run this repo should not install Supervisor / the npm package anymore. Your PR would be a good start :)

@astorije
Copy link
Owner

astorije commented Dec 1, 2017

Also, note that a few changes on The Lounge make this transition easier: it can now start without users, we can use .lounge_home (soon to be thelounge_home) to set up the config location, etc.

@morbidick
Copy link
Contributor Author

thx, for the feedback, i wrote this when i had to redeploy my personal server. I'll probably do a rewrite the next time (maybe even this year ;) ).

@Duckle29
Copy link

Duckle29 commented Jun 7, 2019

If you are going to rewrite it, and still only want to support debian based distros, then this is what I currently use in my vps-deployment playbook:

- name: Install thelounge
  hosts: vps
  become: true
  tags:
    - thelounge
  
  tasks:
    - name: Install nodejs
      include_role:
        name: geerlingguy.nodejs
      vars:
        nodejs_version: "11.x"
        nodejs_install_npm_user: root

    - name: Get the latest release info
      uri:
        url: https://api.github.com/repos/thelounge/thelounge/releases/latest
        return_content: true
      register: lounge_json_response
      failed_when: lounge_json_response.json.assets.0.content_type != "application/x-debian-package"

    - name: Get the latest thelounge .deb
      get_url: 
        url: '{{ lounge_json_response.json.assets.0.browser_download_url }}'
        dest: /root/
      register: lounge_deb_file
    
    - name: Install thelounge
      apt:
        deb: '{{ lounge_deb_file.dest }}'

    - name: Remove .deb file
      file:
        state: absent
        path: '{{ lounge_deb_file.dest }}'

    - name: Stop thelounge before changing config
      service:
        name: thelounge
        state: stopped

    - name: Set up config
      template:
        src: templates/thelounge-config.js.j2
        dest: /etc/thelounge/config.js

    - name: Start and enable thelounge
      service:
        enabled: yes
        name: thelounge
        state: started

This is quick and dirty. It works, but it doesn't do any user configuration, it doesn't really have any customization, it's not idempotent if a new release comes out, it only works on Debian based distros

Once I've got my VPS moved/deployed, I might play around with making this into a separate role. However as with all "TODOs" that might end up at the bottom of the piles, so feel free to use what you can :)

I'd also really want to support multiple distros, which I think I'll do through yarn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants