71 lines
4.0 KiB
HTML
71 lines
4.0 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Zk | 2019-01-09-sparkleup</title>
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Gentium+Plus&family=Lato&family=Ubuntu+Monodisplay=swap" />
|
|
<link rel="stylesheet" type="text/css" href="/style.css" />
|
|
<meta name="viewport" content="width=device-width" />
|
|
<meta charset="utf-8" />
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<header>
|
|
<h1>Zk | 2019-01-09-sparkleup</h1>
|
|
</header>
|
|
<article class="content">
|
|
<hr />
|
|
<p>type: post
|
|
date: 2019-01-09
|
|
slug: sparkleup
|
|
title: Headless SparkleShare with sparkleup</p>
|
|
<hr />
|
|
<p><em>Update: this is now a <a href="https://github.com/makyo/sparkleup">project you can use</a>!</em></p>
|
|
<p>I found myself wanting a headless version of SparkleShare, and was stymied by <a href="https://github.com/hbons/SparkleShare/issues/1683">the lack thereof</a>. I wanted to keep some IRC and MUCK logs in a SparkleShare project, but I run my clients for those in a <code>tmux</code> session on a server. However, that server lives elsewhere, and has no X, so, alas, the usual SparkleShare clients were right out.</p>
|
|
<p>My solution was a combination of ones I’ve seen elsewhere, and I’m calling it sparkleup because…I dunno, it sounded fun. It looks like this:</p>
|
|
<div class="codehilite"><pre><span></span><code>sparkleup/
|
|
├── projects/
|
|
│ └── logs*
|
|
└── ssh*
|
|
</code></pre></div>
|
|
|
|
<p><code>logs.sh</code> is a simple script to be run by cron, but before I get to that, a minor diversion into git land.</p>
|
|
<p>My ssh key on the server requires a password — as do all of mine — which makes interacting with SparkleShare programatically difficult. After all, if I just do <code>dazzle link</code> with my normal key, then every time I try to commit to the project, I’ll be asked for a password. I’m not scripting that.</p>
|
|
<p>The solution was to generate a new SSH key with no password and <code>dazzle link</code> that. However, since that key lives in <code>~/.ssh/sparkle</code>, git won’t pick up on it by default, because SSH won’t pick up on it by default. Add to that the fact that you can’t select an SSH key for git to use and…bleh.</p>
|
|
<p>So the solution was two layered. First, I created a new <code>ssh</code> for git to use. <code>sparkleup/ssh</code> is a script to be passed to git with the <code>GIT_SSH</code> environment variable. It looks like:</p>
|
|
<div class="codehilite"><pre><span></span><code><span class="ch">#!/bin/bash</span>
|
|
|
|
ssh -i ~/.ssh/sparkle <span class="nv">$@</span>
|
|
</code></pre></div>
|
|
|
|
<p>That lets me write a job that will, without any interaction from me, commit and push to a SparkleShare project. That’s one script per SparkleShare project I need to manage this way, each of which looks like:</p>
|
|
<div class="codehilite"><pre><span></span><code><span class="ch">#!/bin/bash</span>
|
|
|
|
<span class="nb">export</span> <span class="nv">GIT_SSH</span><span class="o">=</span>/home/makyo/sparkleup/ssh
|
|
<span class="nb">cd</span> /home/makyo/logs
|
|
<span class="nb">pwd</span>
|
|
git add .
|
|
git commit -am <span class="s2">"update from sparkleup"</span>
|
|
git push origin master
|
|
</code></pre></div>
|
|
|
|
<p>Then I add a crontab line to run that daily (or however frequently I need to update the project):</p>
|
|
<div class="codehilite"><pre><span></span><code># m h dom mon dow command
|
|
0 5 * * * /home/makyo/sparkleup/projects/logs
|
|
</code></pre></div>
|
|
|
|
<p>It’s not really the type of thing I can turn into a separate project, but maybe it helps someone out with similar problems!</p>
|
|
</article>
|
|
<footer>
|
|
<p>Page generated on 2023-05-10</p>
|
|
</footer>
|
|
</main>
|
|
<script type="text/javascript">
|
|
document.querySelectorAll('.tag').forEach(tag => {
|
|
let text = tag.innerText;
|
|
tag.innerText = '';
|
|
tag.innerHTML = `<a href="/tags.html#${text}">${text}</a>`;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|