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

Provide a Brew tap #55

Closed
orj opened this issue Jun 29, 2020 · 7 comments · Fixed by #56
Closed

Provide a Brew tap #55

orj opened this issue Jun 29, 2020 · 7 comments · Fixed by #56

Comments

@orj
Copy link

orj commented Jun 29, 2020

It would be super useful for alpaca to have a brew tap so it can be easily installed and updated without go installed.

@samuong
Copy link
Owner

samuong commented Jun 30, 2020

I just created https://github.com/samuong/homebrew-alpaca, and you should now be able to do:

brew tap samuong/alpaca
brew install samuong/alpaca/alpaca

Let me know what you think?

@samuong
Copy link
Owner

samuong commented Jun 30, 2020

Also I've added a launchd job definition, so that you can do brew services start alpaca.

However I'm not sure how to set StandardErrorPath and StandardOutPath to a value in the user's home directory (looks like launchd doesn't support globs like ~ or environment variables like $HOME), so I've just set both of these to /dev/null. This isn't ideal, so if you've got any tips on how to get this to work, it'd be much appreciated :)

This is all tested on Catalina 10.15.5.

@camscale
Copy link

My launchd config for alpaca that uses env vars:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.samoung.alpaca</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PAC_URL</key>
        <string>http://example.com/proxy.pac</string>
    </dict>
    <key>ProgramArguments</key>
    <array>
     <string>sh</string>
     <string>-c</string>
     <string>exec $HOME/src/go/bin/alpaca -C $PAC_URL >>$HOME/Library/Logs/alpaca.log 2>&1</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>SoftResourceLimits</key>
    <dict>
      <key>NumberOfFiles</key>
      <integer>2048</integer>
    </dict>
  </dict>
</plist>

@camh-
Copy link
Collaborator

camh- commented Jun 30, 2020

This does not have any sort of log rotation so it is not ideal. Not sure how that is meant to be managed on Macs.

@samuong
Copy link
Owner

samuong commented Jun 30, 2020

Nice, thanks Cam! I'll do the sh -c thing in the formula, and the file limit is a good idea too.

As for log rotation, I'm not sure either. If we're not rotating logs, maybe > is better than >>?

@camh-
Copy link
Collaborator

camh- commented Jun 30, 2020

The problem with > is that if it is crash-looping, you lose the logs each time it restarts and they may contain the info you need to stop it crash-looping. Maybe launchd stops running it after some number of crashes?

Also, is the plist installed per-user or system-wide? For alpaca it would want to be per-user, so $HOME should work. But if it is system-wide, $HOME probably wont be set. But logs should also go to the system log dir anyway.

@samuong
Copy link
Owner

samuong commented Jun 30, 2020

Fair point re crash looping. Given the issues, I might just leave it as /dev/null, but if anyone wants to improve this, pull requests are welcome :)

samuong added a commit that referenced this issue Jun 30, 2020
Also, I've moved the "Download Binary" method down one section, because I think
that Homebrew and Go both provide a better (automated) way to keep the binary
up-to-date.

Also, I've added http:// to http_proxy and https_proxy. This seems to be
needed by yarn.

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

Successfully merging a pull request may close this issue.

4 participants