Skip to content

Commit 7825154

Browse files
committed
Deploy on 2025-01-12 14:13:19 +0100
0 parents  commit 7825154

File tree

26 files changed

+6128
-0
lines changed

26 files changed

+6128
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="x-ua-compatible" content="ie=edge">
6+
<meta name="viewport"
7+
content="width=device-width, initial-scale=1, shrink-to-fit=no">
8+
<!-- Use the title from a page's frontmatter if it has one -->
9+
<title>Validate Your YAML Files</title>
10+
11+
<link href="/style.css" rel="stylesheet" />
12+
<link href="/stylesheets/code.css" rel="stylesheet" />
13+
</head>
14+
<body>
15+
<div class=" w-full max-w-4xl mx-auto">
16+
<div x-data="{ open: false }" class="flex flex-col max-w-screen-xl p-5 mx-auto md:items-center md:justify-center md:flex-row md:px-6 lg:px-8">
17+
<div class="flex flex-row items-center justify-between lg:justify-start">
18+
<a href="/index.html" class="text-3xl font-bold tracking-tighter text-green-600 transition duration-500 ease-in-out transform tracking-relaxed lg:pr-8">
19+
Hackberry
20+
</a>
21+
<button class="rounded-lg md:hidden focus:outline-none focus:shadow-outline" @click="open = !open">
22+
<svg fill="currentColor" viewBox="0 0 20 20" class="w-8 h-8">
23+
<path x-show="!open" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM9 15a1 1 0 011-1h6a1 1 0 110 2h-6a1 1 0 01-1-1z" clip-rule="evenodd"></path>
24+
<path x-show="open" fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" style="display: none"></path>
25+
</svg>
26+
</button>
27+
</div>
28+
</div>
29+
</div>
30+
31+
32+
<div class=" w-full px-5 py-24 mx-auto lg:px-32">
33+
<div class="flex flex-col w-full mx-auto mb-2 prose text-left prose-md">
34+
<div class="mb-5 border-b border-gray-200">
35+
<div class="flex flex-wrap items-baseline -mt-2">
36+
<h5>By Nebojsa Stricevic</h5>
37+
</div>
38+
</div>
39+
40+
<h1>Validate Your YAML Files</h1>
41+
42+
<p>A few months ago, a client project we&rsquo;re working on started using
43+
<a href="https://github.com/Moove-it/sidekiq-scheduler">sidekiq-scheduler</a> for handling
44+
scheduled jobs. The tool works well and we started migrating more and more Cron
45+
jobs to Sidekiq.</p>
46+
47+
<p>A few days ago, after deploying a new set of jobs, we scheduled a few of them to
48+
test if everything works in production. But, we realized that no jobs were being
49+
logged in the Sidekiq log file. Since Sidekiq is managed by systemd, we
50+
inspected the status of the service with <code>systemctl</code> and <code>journalctl</code> and found
51+
out that <code>sidekiq.yml</code> file is not a valid YAML file. That prevented Sidekiq
52+
from booting.</p>
53+
54+
<p>This raised 2 important questions:</p>
55+
56+
<ul>
57+
<li>How can we prevent deploying an invalid <code>sidekiq.yml</code> file to the server?</li>
58+
<li>How can we receive a notification when the Sidekiq service fails to start?</li>
59+
</ul>
60+
61+
<p>As the first line of defence, we decided to implement a simple script to check
62+
if <code>sidekiq.yml</code> is a valid YAML file and to run the script as part of our
63+
Continuous Integration pipeline.</p>
64+
65+
<p>After a few minutes, we had a working version of the script:</p>
66+
67+
<div class="not-prose my-5"><div class="highlight"><pre class="highlight ruby"><code><span class="c1">#!/usr/bin/env ruby</span>
68+
69+
<span class="nb">require</span> <span class="s2">"yaml"</span>
70+
71+
<span class="n">sidekiq_yml</span> <span class="o">=</span> <span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s2">"config/sidekiq.yml"</span><span class="p">)</span>
72+
73+
<span class="k">begin</span>
74+
<span class="no">YAML</span><span class="p">.</span><span class="nf">load</span><span class="p">(</span><span class="n">sidekiq_yml</span><span class="p">)</span>
75+
<span class="nb">puts</span> <span class="s2">"sidekiq.yml is valid"</span>
76+
<span class="k">rescue</span> <span class="o">=&gt;</span> <span class="n">ex</span>
77+
<span class="nb">puts</span> <span class="s2">"sidekiq.yml is not valid"</span>
78+
<span class="nb">puts</span> <span class="s2">"Error: </span><span class="si">#{</span><span class="n">ex</span><span class="p">.</span><span class="nf">message</span><span class="si">}</span><span class="s2">"</span>
79+
<span class="nb">exit</span> <span class="mi">1</span>
80+
<span class="k">end</span>
81+
</code></pre></div></div>
82+
83+
<p>The script works fine, but the name of the YAML file is hard-coded and is a bit
84+
verbose. The second version is a Ruby one-liner that&rsquo;s executed from a console:</p>
85+
86+
<div class="not-prose my-5"><div class="highlight"><pre class="highlight ruby"><code><span class="n">ruby</span> <span class="o">-</span><span class="n">e</span> <span class="s2">"require 'yaml'; YAML.load(</span><span class="se">\$</span><span class="s2">stdin.read);"</span> <span class="o">&lt;</span> <span class="n">sidekiq</span><span class="p">.</span><span class="nf">yml</span>
87+
</code></pre></div></div>
88+
89+
<p>This simple one-liner doesn&rsquo;t solve all problems. It&rsquo;s still possible to deploy
90+
a file that contains a configuration that&rsquo;s not valid for a library or a
91+
service. In some cases, the library might validate the configuration. In others
92+
you might want to do that yourself. We&rsquo;re still working on a good solution for
93+
that problem. For now, the smoke test one-liner within a CI pipeline will do the
94+
trick.</p>
95+
96+
<p>What&rsquo;s your solution for validating YAML files and other configuration?</p>
97+
98+
<p>Thanks to <a href="mailto:[email protected]">Vladimir Saric</a> for reviewing the
99+
blog post.</p>
100+
101+
</div>
102+
</div>
103+
104+
<footer class="bg-white" aria-labelledby="footer-heading">
105+
<h2 id="footer-heading" class="sr-only">Footer</h2>
106+
107+
<div class="px-4 py-12 mx-auto bg-gray-50 max-w-7xl sm:px-6 lg:px-16">
108+
<div class="flex flex-wrap items-baseline lg:justify-center">
109+
<span class="mt-2 text-sm font-light text-gray-500">
110+
Copyright © 2016 - 2025
111+
Hackberry
112+
</span>
113+
</div>
114+
</div>
115+
</footer>
116+
117+
</body>
118+
</html>

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
www.hackberry.dev

alas-contacts/index.html

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="x-ua-compatible" content="ie=edge">
6+
<meta name="viewport"
7+
content="width=device-width, initial-scale=1, shrink-to-fit=no">
8+
<!-- Use the title from a page's frontmatter if it has one -->
9+
<title>Contacts</title>
10+
11+
<link href="/style.css" rel="stylesheet" />
12+
<link href="/stylesheets/code.css" rel="stylesheet" />
13+
</head>
14+
<body>
15+
<div class=" w-full max-w-4xl mx-auto">
16+
<div x-data="{ open: false }" class="flex flex-col max-w-screen-xl p-5 mx-auto md:items-center md:justify-center md:flex-row md:px-6 lg:px-8">
17+
<div class="flex flex-row items-center justify-between lg:justify-start">
18+
<a href="/index.html" class="text-3xl font-bold tracking-tighter text-green-600 transition duration-500 ease-in-out transform tracking-relaxed lg:pr-8">
19+
Alas by Hackberry
20+
</a>
21+
<button class="rounded-lg md:hidden focus:outline-none focus:shadow-outline" @click="open = !open">
22+
<svg fill="currentColor" viewBox="0 0 20 20" class="w-8 h-8">
23+
<path x-show="!open" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM9 15a1 1 0 011-1h6a1 1 0 110 2h-6a1 1 0 01-1-1z" clip-rule="evenodd"></path>
24+
<path x-show="open" fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" style="display: none"></path>
25+
</svg>
26+
</button>
27+
</div>
28+
</div>
29+
</div>
30+
31+
32+
<div class="flex overflow-hidden bg-white rounded-lg">
33+
<div class="flex flex-col w-64">
34+
<div class="flex flex-col flex-grow pt-5 overflow-y-auto bg-white border-r border-gray-50">
35+
<div class="flex flex-col flex-grow px-4 mt-5">
36+
<nav class="flex-1 space-y-1 bg-white">
37+
<ul>
38+
<li>
39+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-get-started">
40+
<span class="ml-4">Get Started</span>
41+
</a>
42+
</li>
43+
44+
45+
<li>
46+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-format">
47+
<span class="ml-4">Alas Format</span>
48+
</a>
49+
</li>
50+
51+
52+
<li>
53+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-contacts">
54+
<span class="ml-4">Contacts</span>
55+
</a>
56+
</li>
57+
58+
59+
<li>
60+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-editor">
61+
<span class="ml-4">Editing Plan</span>
62+
</a>
63+
</li>
64+
65+
66+
<li>
67+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-exit-status">
68+
<span class="ml-4">Exit Status</span>
69+
</a>
70+
</li>
71+
72+
73+
<li>
74+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-insert-days">
75+
<span class="ml-4">--insert-days</span>
76+
</a>
77+
</li>
78+
79+
80+
<li>
81+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-insert-task">
82+
<span class="ml-4">--insert-task</span>
83+
</a>
84+
</li>
85+
86+
87+
<li>
88+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-list-contacts">
89+
<span class="ml-4">--list-contacts</span>
90+
</a>
91+
</li>
92+
93+
94+
<li>
95+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-remove-empty-days">
96+
<span class="ml-4">--remove-empty-days</span>
97+
</a>
98+
</li>
99+
100+
101+
<li>
102+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-report">
103+
<span class="ml-4">--report</span>
104+
</a>
105+
</li>
106+
107+
108+
<li>
109+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-schedule-contacts">
110+
<span class="ml-4">--schedule-contacts</span>
111+
</a>
112+
</li>
113+
114+
115+
<li>
116+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-schedule-tasks">
117+
<span class="ml-4">--schedule-tasks</span>
118+
</a>
119+
</li>
120+
121+
122+
<li>
123+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-skip-backup">
124+
<span class="ml-4">--skip-backup</span>
125+
</a>
126+
</li>
127+
128+
129+
<li>
130+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-stats">
131+
<span class="ml-4">--stats</span>
132+
</a>
133+
</li>
134+
135+
136+
<li>
137+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-version">
138+
<span class="ml-4">--version</span>
139+
</a>
140+
</li>
141+
142+
143+
<li>
144+
<a class="inline-flex items-center w-full px-4 py-2 mt-1 text-base text-gray-900 transition duration-500 ease-in-out transform rounded-lg focus:shadow-outline hover:bg-gray-50" href="/alas-tips">
145+
<span class="ml-4">Tips</span>
146+
</a>
147+
</li>
148+
149+
</ul>
150+
</nav>
151+
</div>
152+
</div>
153+
</div>
154+
155+
156+
<div class="flex flex-col flex-1 w-0 overflow-hidden">
157+
<section>
158+
<div class=" flex flex-col items-center px-5 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
159+
<div class="flex flex-col w-full max-w-3xl mx-auto prose text-left prose-blue">
160+
<div class="w-full mx-auto -mx-32">
161+
<h2>Contacts</h2>
162+
163+
<p>Alas can help you keep in touch with your contacts - family, friends and
164+
other people you know. Alas tracks when you last heard from a person and
165+
schedules a new task to contact the person if you didn&rsquo;t hear from them in
166+
a while. Alas can also schedule a reminder for a birthday.</p>
167+
168+
<p>Each contact is stored in a separate Markdown file. All contact files should
169+
be in a single directory, separate from other Markdown files. For example:</p>
170+
<div class="highlight"><pre class="highlight plaintext"><code>├── contacts
171+
│   ├── john-doe.md
172+
│   ├── mary-doe.md
173+
│   ├── jack-black.md
174+
│   ├── ...
175+
├── diary.md
176+
├── plan.md
177+
└── scheduled.md
178+
</code></pre></div>
179+
<p>Each contact file has the same structure - the contact name, details and the
180+
log of communication.</p>
181+
<div class="highlight"><pre class="highlight markdown"><code><span class="gh"># John Doe</span>
182+
<span class="p">
183+
-</span> Birthday: 04-27
184+
<span class="p">-</span> Category: B
185+
186+
<span class="gu">## 2022-02-15</span>
187+
188+
Talked over the phone about stuff.
189+
190+
<span class="gu">## 2022-01-28</span>
191+
192+
Grabbed a beer and talked about stuff.
193+
</code></pre></div>
194+
<p>The first line is the title that holds the contact name.</p>
195+
196+
<p>Then, there&rsquo;s a list of details. Each detail has the same structure:</p>
197+
<div class="highlight"><pre class="highlight markdown"><code><span class="p">-</span> Detail name: Detail value
198+
</code></pre></div>
199+
<p>A contact can have as many details as you need. However, 2 details are special:
200+
<code>Birthday</code> and <code>Category</code>.</p>
201+
202+
<p>If a contact has a <code>Birthday</code> detail and the value matches today&rsquo;s date, Alas
203+
will schedule a reminder to congratulate the person&rsquo;s birthday.</p>
204+
205+
<p>A contact <code>Category</code> can have one of these 4 values: A, B, C and D. The
206+
idea was taken from Derek Siver&rsquo;s <a href="https://sive.rs/hundreds">article</a> where
207+
categories are defined as:</p>
208+
209+
<ul>
210+
<li>A list: Very important people. Contact every three weeks.</li>
211+
<li>B list: Important people. Contact every two months.</li>
212+
<li>C list: Most people. Contact every six months.</li>
213+
<li>D list: Other people. Contact once a year, to make sure you still have
214+
their correct info.</li>
215+
</ul>
216+
217+
</div>
218+
</div>
219+
</div>
220+
</section>
221+
</div>
222+
</div>
223+
224+
<footer class="bg-white" aria-labelledby="footer-heading">
225+
<h2 id="footer-heading" class="sr-only">Footer</h2>
226+
227+
<div class="px-4 py-12 mx-auto bg-gray-50 max-w-7xl sm:px-6 lg:px-16">
228+
<div class="flex flex-wrap items-baseline lg:justify-center">
229+
<span class="mt-2 text-sm font-light text-gray-500">
230+
Copyright © 2016 - 2025
231+
Hackberry
232+
</span>
233+
</div>
234+
</div>
235+
</footer>
236+
237+
</body>
238+
</html>

0 commit comments

Comments
 (0)