zk_html/diary/2019-01-09-sparkleup.html

71 lines
4.0 KiB
HTML
Raw Normal View History

2020-04-25 05:00:08 +00:00
<!doctype html>
<html>
<head>
<title>Zk | 2019-01-09-sparkleup</title>
2023-05-11 05:35:08 +00:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Gentium+Plus&family=Lato&family=Ubuntu+Monodisplay=swap" />
2020-04-25 05:00:08 +00:00
<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>
2020-06-24 07:10:07 +00:00
<p>My solution was a combination of ones I&rsquo;ve seen elsewhere, and I&rsquo;m calling it sparkleup because&hellip;I dunno, it sounded fun. It looks like this:</p>
2023-05-11 05:20:07 +00:00
<div class="codehilite"><pre><span></span><code>sparkleup/
├── projects/
│   └── logs*
└── ssh*
2020-04-25 05:00:08 +00:00
</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>
2020-06-24 07:10:07 +00:00
<p>My ssh key on the server requires a password &mdash; as do all of mine &mdash; 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&rsquo;ll be asked for a password. I&rsquo;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&rsquo;t pick up on it by default, because SSH won&rsquo;t pick up on it by default. Add to that the fact that you can&rsquo;t select an SSH key for git to use and&hellip;bleh.</p>
2020-04-25 05:00:08 +00:00
<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>
2020-06-24 07:10:07 +00:00
<p>That lets me write a job that will, without any interaction from me, commit and push to a SparkleShare project. That&rsquo;s one script per SparkleShare project I need to manage this way, each of which looks like:</p>
2020-04-25 05:00:08 +00:00
<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">&quot;update from sparkleup&quot;</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>
2023-05-11 05:20:07 +00:00
<div class="codehilite"><pre><span></span><code># m h dom mon dow command
0 5 * * * /home/makyo/sparkleup/projects/logs
2020-04-25 05:00:08 +00:00
</code></pre></div>
2020-06-24 07:10:07 +00:00
<p>It&rsquo;s not really the type of thing I can turn into a separate project, but maybe it helps someone out with similar problems!</p>
2020-04-25 05:00:08 +00:00
</article>
<footer>
2023-05-11 05:20:07 +00:00
<p>Page generated on 2023-05-10</p>
2020-04-25 05:00:08 +00:00
</footer>
</main>
2020-06-24 07:10:07 +00:00
<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>
2020-04-25 05:00:08 +00:00
</body>
</html>