Skip to content

Alpine Linux OpenRC Service #12294

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

Open
recanman opened this issue Feb 25, 2024 · 6 comments · Fixed by #12870
Open

Alpine Linux OpenRC Service #12294

recanman opened this issue Feb 25, 2024 · 6 comments · Fixed by #12870
Labels
cli Area: CLI s3 Bugs that confuse, annoy, or are purely cosmetic s4 Internal bugs (e.g. test flakes), extreme edge cases, and bug risks

Comments

@recanman
Copy link
Contributor

System: Alpine Linux v3.19
Installation Method: Install script

When running the install script, I am informed at the end that I can start the service with systemctl (systemd).

That does not work, as Alpine Linux uses OpenRC. Also, the service does not get created in the first place. It seems that only a systemd service file is present in this repository.

The command to start the service would be rc-service coder start.

@cdr-bot cdr-bot bot added the bug label Feb 25, 2024
@matifali matifali added the s4 Internal bugs (e.g. test flakes), extreme edge cases, and bug risks label Feb 26, 2024
@recanman
Copy link
Contributor Author

recanman commented Mar 3, 2024

I took an attempt to write one, but EnvironmentFile does not have an equivalent in OpenRC.

@VTFLAB
Copy link

VTFLAB commented Apr 4, 2024

I hope my example can be of help to you.

/etc/init.d/coder

#!/sbin/openrc-run

description="Coder - Self-hosted developer workspaces on your infra"
document="https://coder.com/docs/coder-oss"

depend() {
    need net
    after net-online
    use dns logger
}

checkpath --directory --owner coder:coder --mode 0700 /var/cache/coder

start_pre() {
    if [ ! -f /etc/coder.d/coder.env ]; then
        eerror "/etc/coder.d/coder.env file does not exist"
        return 1
    fi
    # Read and export environment variables ignoring comment lines and blank lines
    while IFS= read -r line; do
        # Skip blank or comment lines
        if [ -z "$line" ] || [[ "$line" =~ ^# ]]; then
            continue
        fi
        export "$line"
    done < /etc/coder.d/coder.env
}

command="/usr/bin/coder"
command_args="server"
command_user="coder:coder"
command_background="yes"
pidfile="/run/coder.pid"

restart="always"
restart_delay="5"

stop_timeout="90"

@bpmct
Copy link
Member

bpmct commented Apr 4, 2024

Hi folks I'm not sure if we will be able to officially support this without some help. PRs welcome!

Can you open up an issue if you are still running into issues or reach out on Discord? https://discord.gg/coder

@bpmct bpmct closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
@recanman
Copy link
Contributor Author

recanman commented Apr 4, 2024

Sure, I'll test out what @VTFLAB gave and make a PR.

@matifali matifali reopened this Apr 5, 2024
@coder-labeler coder-labeler bot added the docs Area: coder.com/docs label Apr 5, 2024
@matifali matifali closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
@matifali matifali removed the docs Area: coder.com/docs label Apr 5, 2024
kylecarbs added a commit that referenced this issue May 3, 2024
* fix: install openrc service on alpine (#12294)

* fmt

---------

Co-authored-by: Kyle Carberry <kyle@coder.com>
spikecurtis added a commit that referenced this issue May 6, 2024
@matifali matifali reopened this May 6, 2024
@coder-labeler coder-labeler bot added cli Area: CLI s3 Bugs that confuse, annoy, or are purely cosmetic labels May 6, 2024
@recanman
Copy link
Contributor Author

recanman commented May 9, 2024

Why was this issue reopened?

@spikecurtis
Copy link
Contributor

Because we reverted the PRs; they broke our CI builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Area: CLI s3 Bugs that confuse, annoy, or are purely cosmetic s4 Internal bugs (e.g. test flakes), extreme edge cases, and bug risks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants