diff --git a/other/demo/demo.cast b/other/demo/demo.cast new file mode 100644 index 0000000..be822d1 --- /dev/null +++ b/other/demo/demo.cast @@ -0,0 +1,94 @@ +{"version": 2, "width": 158, "height": 28, "timestamp": 1717443152, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}} +[0.003457, "o", "\u001b[?1049h\u001b[22;0;0t\u001b[?1h\u001b=\u001b[H\u001b[2J\u001b[?12l\u001b[?25h\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006l\u001b[?1005l\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?2004l\u001b[1;1H\u001b[1;28r\u001b[>c\u001b[>q\u001b[4;1H"] +[0.003872, "o", "\u001b[?25l\u001b[1;80H\u001b[32m│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[39m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[1;79H\u001b[1K\u001b[Hexport PS1=\"\\033[1;92mpeer 1: \\033[0m\"\u001b[2;79H\u001b[1K\rcd peer_1\u001b[3;79H\u001b[1K\rclear\u001b[4;79H\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\u001b[1;81Hexport PS1=\"\\033[1;92mpeer 2: \\033[0m\"\u001b[K\u001b[2;81Hcd peer_2\u001b[K\u001b[3;81Hclear\u001b[K\u001b[4;81H\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\u001b[30m\u001b[42m\r\n[demo_sess0:bash* \"marcin-laptop-mx\" 12:32 03-Jun-24\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[4;1H"] +[0.003908, "o", "\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?2004l\u001b[1;1H\u001b[1;28r\u001b[4;1H"] +[0.004091, "o", "\u001b[?25l\u001b[1;80H\u001b[32m│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[39m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[1;79H\u001b[1K\u001b[Hexport PS1=\"\\033[1;92mpeer 1: \\033[0m\"\u001b[2;79H\u001b[1K\rcd peer_1\u001b[3;79H\u001b[1K\rclear\u001b[4;79H\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\u001b[1;81Hexport PS1=\"\\033[1;92mpeer 2: \\033[0m\"\u001b[K\u001b[2;81Hcd peer_2\u001b[K\u001b[3;81Hclear\u001b[K\u001b[4;81H\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\u001b[30m\u001b[42m\r\n[demo_sess0:bash* \"marcin-laptop-mx\" 12:32 03-Jun-24\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[4;1H"] +[0.007334, "o", "\u001b[?7727h"] +[0.186101, "o", "(base) \u001b[35m\u001b[1mmarcin\u001b(B\u001b[m@\u001b[36m\u001b[1mmarcin-laptop-mx\u001b(B\u001b[m:\u001b[32m\u001b[1m~/Documents/gday/demo\r\n$\u001b(B\u001b[m \u001b[?2004h"] +[0.186272, "o", "\u001b[4;40H\"\u001b[39X\r\n\u001b[92m\u001b[1mpeer 1: \u001b(B\u001b[mcd peer_13[1;92mpeer 1: \\033[0m\" \r\n\u001b[?2004l\u001b[92m\u001b[1mpeer 1: \u001b(B\u001b[mclear\r\n"] +[0.187171, "o", "\u001b[1;27r\u001b[2;79H\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\u001b[1d\u001b[1K\u001b[1;28r\u001b[1;1H"] +[0.187282, "o", "\u001b[92m\u001b[1mpeer 1: \u001b[?2004h\u001b(B\u001b[m"] +[0.187471, "o", "\u001b[4;81H(base) \u001b[35m\u001b[1mmarcin\u001b(B\u001b[m@\u001b[36m\u001b[1mmarcin-laptop-mx\u001b(B\u001b[m:\u001b[32m\u001b[1m~/Documents/gday/demo\u001b[1;9H\u001b(B\u001b[m\u001b[5;81H\u001b[32m\u001b[1m$\u001b(B\u001b[m \u001b[1;9H"] +[0.187527, "o", "\u001b[5;83Hexport PS1=\"\\033[1;92mpeer 2: \\033[0m\"\u001b[1;9H"] +[0.187565, "o", "\u001b[6;81H\u001b[92m\u001b[1mpeer 2: \u001b[1;9H\u001b(B\u001b[m"] +[0.187608, "o", "\u001b[6;89Hcd peer_2\u001b[1;9H"] +[0.187651, "o", "\u001b[7;81H\u001b[92m\u001b[1mpeer 2: \u001b[1;9H\u001b(B\u001b[m\u001b[7;89Hclear\u001b[1;9H"] +[0.188342, "o", "\u001b[1;27r\u001b[2;81H\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\u001b[1d\u001b[K\u001b[1;28r\u001b[1;9H"] +[0.188418, "o", "\u001b[72C\u001b[92m\u001b[1mpeer 2: \u001b[9G\u001b(B\u001b[m"] +[0.190535, "o", "\u001b[72C\u001b[92m\u001b[1mpeer 2: \u001b(B\u001b[m\u001b[K\u001b[H\u001b[92m\u001b[1mpeer 1: \u001b(B\u001b[m\u001b[71X"] +[0.674003, "o", "g"] +[0.85815, "o", "d"] +[0.944386, "o", "a"] +[1.111559, "o", "y"] +[1.207735, "o", " "] +[1.329879, "o", "s"] +[1.423399, "o", "e"] +[1.5715, "o", "n"] +[1.653048, "o", "d"] +[1.739105, "o", " "] +[1.965748, "o", "m"] +[2.087753, "o", "s"] +[2.181981, "o", "g"] +[2.318552, "o", "."] +[2.452878, "o", "t"] +[2.622832, "o", "x"] +[2.710562, "o", "t"] +[2.780506, "o", " "] +[2.900505, "o", "i"] +[2.947626, "o", "m"] +[3.053141, "o", "a"] +[3.13578, "o", "g"] +[3.211482, "o", "e"] +[3.354374, "o", "."] +[3.587126, "o", "j"] +[3.68871, "o", "p"] +[3.815933, "o", "g"] +[3.937013, "o", "\r\n\u001b[?2004l"] +[3.947995, "o", "\u001b[?25l\u001b[1;80H\u001b[32m│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[39m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[30m\u001b[42m\r\n[demo_sess0:gday* \"marcin-laptop-mx\" 12:32 03-Jun-24\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[2;1H"] +[4.012401, "o", "\u001b[1m2\u001b(B\u001b[m \u001b[1mfiles to send:\r\n\u001b(B\u001b[mmsg.txt (12 B)\r\nimage.jpg (11 B)\u001b[6;1H\u001b[1mTotal size: \u001b(B\u001b[m \u001b[1m23 B\r\n\u001b(B\u001b[mWould you like to send these? (y/n): "] +[4.605983, "o", "y"] +[4.795332, "o", "\r\n"] +[5.445093, "o", "\u001b[?25l\u001b[1;80H│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[32m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1;89H\u001b[?2004h"] +[5.798947, "o", "\u001b[8;1HTell your mate to run \"gday receive \u001b[1m1.4FBD.ED15.2\u001b(B\u001b[m\"\u001b[1;89H"] +[5.799806, "o", "\u001b[?25l\u001b[9D│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[32m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[30m\u001b[42m\r\n[demo_sess0:bash* \"marcin-laptop-mx\" 12:32 03-Jun-24\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1;89H"] +[6.086862, "o", "g"] +[6.431002, "o", "d"] +[6.503788, "o", "a"] +[6.601593, "o", "y"] +[6.710416, "o", " "] +[6.79049, "o", "r"] +[6.895468, "o", "e"] +[7.096879, "o", "c"] +[7.269312, "o", "e"] +[7.385552, "o", "i"] +[7.460456, "o", "v"] +[7.538639, "o", "e"] +[7.783294, "o", " "] +[8.067315, "o", "1"] +[8.175665, "o", "."] +[8.866609, "o", "4"] +[9.146886, "o", "f"] +[9.851508, "o", "b"] +[10.017667, "o", "d"] +[10.183992, "o", "."] +[10.581023, "o", "e"] +[11.112281, "o", "d"] +[11.864154, "o", "1"] +[11.928078, "o", "5"] +[12.369622, "o", "."] +[12.742728, "o", "2"] +[12.930025, "o", "\u001b[2;81H\u001b[?2004l"] +[13.582588, "o", "\u001b[9;1HWaiting for your mate to respond to your file offer.\u001b[2;81H\u001b[1mYour mate wants to send you\u001b(B\u001b[m \u001b[1m2\u001b(B\u001b[m \u001b[1mfiles:\u001b[3;81H\u001b(B\u001b[mmsg.txt (12 B)\u001b[4;81Himage.jpg (11 B)\u001b[6;81HSize of all offered files: \u001b[1m23 B\u001b[7;81H\u001b(B\u001b[mSize of files that have a new/changed path or size or were interrupted: \u001b[1m23 B\u001b[8;81HOptions:\u001b[9;81H1. Download only files with new path or size. Resume any interrupted downloads\u001b[10;81H.\u001b[11;81H2. Fully download all files.\u001b[12;81H3. Cancel.\u001b[13;81H\u001b(B\u001b[mNote: gday won't overwrite existing files (it suffixes any new files with the \u001b[14;81Hsame name).\u001b[15;81H\u001b[1mChoose an option (1, 2, or 3):\u001b(B\u001b[m "] +[13.58288, "o", "\u001b[?25l\u001b[1;80H│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[32m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[30m\u001b[42m\r\n[demo_sess0:gday* \"marcin-laptop-mx\" 12:32 03-Jun-24\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[15;112H"] +[15.315006, "o", "1"] +[15.799784, "o", "\u001b[16;81H"] +[15.799952, "o", "\u001b[10;1HYour mate accepted 2/2 files\u001b[16;81Hreceiving msg.txt [░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0 B/23 B | 0 B/s | eta: 0s\u001b[11;1Hsending msg.txt [░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0 B/23 B | 0 B/s | eta: 0s\u001b[16;158H"] +[15.800023, "o", "\u001b[11;1Hsending msg.txt [\u001b[62X█████████████░░░░░░░░░░░░░] 12 B/23 B | 143.24 KiB/s | eta: 0s\u001b[16;158H\u001b[11;1Hsending image.jpg [\u001b[60X████████████░░░░░░░░░░░░] 12 B/23 B | 125.27 KiB/s | eta: 0s\u001b[16;158H"] +[15.800063, "o", "\u001b[11;1Hsending image.jpg [\u001b[60X████████████████████████] 23 B/23 B | 147.09 KiB/s | eta: 0s\u001b[16;158H"] +[15.800103, "o", "\u001b[77Dreceiving msg.txt [\u001b[K████████████░░░░░░░░░░░░] 12 B/23 B | 53.24 KiB/s | eta: 0s\u001b[11;1HDone sending! [\u001b[64X████████████████████████████] 23 B/23 B | 121.08 KiB/s | eta: 0s\u001b[16;158H"] +[15.800157, "o", "\u001b[77Dreceiving image.jpg [\u001b[K███████████░░░░░░░░░░░] 12 B/23 B | 49.87 KiB/s | eta: 0s\u001b[16;81Hreceiving image.jpg [\u001b[K██████████████████████] 23 B/23 B | 58.20 KiB/s | eta: 0s"] +[15.800192, "o", "\u001b[16;81HDone downloading! [\u001b[K████████████████████████] 23 B/23 B | 62.49 KiB/s | eta: 0s"] +[15.800413, "o", "\u001b[12;1H\u001b[92m\u001b[1mpeer 1: \u001b[16;158H\u001b(B\u001b[m"] +[15.800539, "o", "\u001b[?2004h"] +[15.800574, "o", "\u001b[17;81H\u001b[92m\u001b[1mpeer 2: \u001b(B\u001b[m"] +[18.673528, "o", "\u001b[?25l\u001b[1;80H│\u001b[2;80H│\u001b[3;80H│\u001b[4;80H│\u001b[5;80H│\u001b[6;80H│\u001b[7;80H│\u001b[8;80H│\u001b[9;80H│\u001b[10;80H│\u001b[11;80H│\u001b[12;80H│\u001b[13;80H│\u001b[14;80H│\u001b[15;80H\u001b[32m│\u001b[16;80H│\u001b[17;80H│\u001b[18;80H│\u001b[19;80H│\u001b[20;80H│\u001b[21;80H│\u001b[22;80H│\u001b[23;80H│\u001b[24;80H│\u001b[25;80H│\u001b[26;80H│\u001b[27;80H│\u001b(B\u001b[m\u001b[30m\u001b[42m\r\n[demo_sess0:bash* \"marcin-laptop-mx\" 12:32 03-Jun-24\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[17;89H"] diff --git a/other/demo/demo.sh b/other/demo/demo.sh new file mode 100755 index 0000000..4b8360e --- /dev/null +++ b/other/demo/demo.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Custom script for starting a tmux 2-pane +# asciinema recording. +# Intended for recording gday demos. + +# Requires: asciinema, tmux, +# and 2 subdirectories called 'peer_1', 'peer_2' + +# Add gday to path using cargo install. + +# Use ctrl+b to switch between panes. + +# Start a new session detached +tmux new-session -d -s demo_session +tmux split-window -h + +# Set both panes to a custom prompt +tmux send-keys -t demo_session:0.0 'export PS1="\033[1;92mpeer 1: \033[0m"' C-m +tmux send-keys -t demo_session:0.0 'cd peer_1' C-m +tmux send-keys -t demo_session:0.0 'clear' C-m + +tmux send-keys -t demo_session:0.1 'export PS1="\033[1;92mpeer 2: \033[0m"' C-m +tmux send-keys -t demo_session:0.1 'cd peer_2' C-m +tmux send-keys -t demo_session:0.1 'clear' C-m + +# Select the left pane +tmux select-pane -t demo_session:0.0 + +# Start recording +asciinema rec -c "tmux attach -t demo_session" --overwrite demo.cast diff --git a/other/demo/peer_1/image.jpg b/other/demo/peer_1/image.jpg new file mode 100644 index 0000000..466c153 --- /dev/null +++ b/other/demo/peer_1/image.jpg @@ -0,0 +1 @@ +Hello there \ No newline at end of file diff --git a/other/demo/peer_1/msg.txt b/other/demo/peer_1/msg.txt new file mode 100644 index 0000000..cd773cd --- /dev/null +++ b/other/demo/peer_1/msg.txt @@ -0,0 +1 @@ +Hello there! \ No newline at end of file diff --git a/other/demo/peer_2/image.jpg b/other/demo/peer_2/image.jpg new file mode 100644 index 0000000..466c153 --- /dev/null +++ b/other/demo/peer_2/image.jpg @@ -0,0 +1 @@ +Hello there \ No newline at end of file diff --git a/other/demo/peer_2/msg.txt b/other/demo/peer_2/msg.txt new file mode 100644 index 0000000..cd773cd --- /dev/null +++ b/other/demo/peer_2/msg.txt @@ -0,0 +1 @@ +Hello there! \ No newline at end of file diff --git a/other/images/dependency_graph.svg b/other/images/dependency_graph.svg new file mode 100644 index 0000000..e86f53d --- /dev/null +++ b/other/images/dependency_graph.svg @@ -0,0 +1,4 @@ + + + +
gday_contact_exchange_protocol

protocol for peers to exchange socket addresses via a server
gday

command line tool for sending files to a peer
gday_encryption

encrypts an IO stream
gday_file_offer_protocol

protocol for peers to offer to send each other files
gday_hole_punch

tries to establish a peer-to-peer connection
gday_server

lets two peers share their socket addresses with each other
Gday dependency graph
\ No newline at end of file diff --git a/other/pre-push b/other/pre-push new file mode 100755 index 0000000..b442c0e --- /dev/null +++ b/other/pre-push @@ -0,0 +1,34 @@ +#!/bin/sh + +# This is a git hook that checks the code using cargo +# before allowing a git push. + +# Put this script in .git/hooks/pre-push +# for it to work as a git hook. + +# cargo test +if ! cargo test; then + echo "Error with 'cargo fmt --check'." + exit 1 +fi + +# cargo clippy +if ! cargo clippy; then + echo "Error with 'cargo clippy'." + exit 1 +fi + +# cargo doc --no-deps +if ! cargo doc --no-deps; then + echo "Error with 'cargo doc --no-deps'." + exit 1 +fi + +# cargo fmt --check +if ! cargo fmt --check; then + echo "Error with 'cargo fmt --check'." + exit 1 +fi + +# If all checks pass, allow the push +exit 0 diff --git a/other/systemd_service.txt b/other/systemd_service.txt new file mode 100644 index 0000000..61bb53a --- /dev/null +++ b/other/systemd_service.txt @@ -0,0 +1,53 @@ +# systemd service that runs a gday_server +# +# Save as: +# '/etc/systemd/system/gday_server.service' +# +# Reload the dameon: +# 'sudo systemctl daemon-reload' +# +# Enable the service so that it starts on boot: +# 'sudo systemctl enable gday_server' +# +# Start the service right now: +# 'sudo systemctl start gday_server' +# +# Verify the status of the service: +# 'sudo systemctl status gday_server' +# +# View service logs (-u specifies service, -f follows log in real time) +# 'sudo journalctl -u gday_server -f' +# +# View stderr and stdout log files in real time: +# 'tail -f ~/gday_server/stdout.log' + + +[Unit] +# Service description +Description=gday_server + +# Start this service after network is ready +After=network.target + + +[Service] + +# Command to execute +ExecStart=/home/ubuntu/gday_server/gday_server --key /etc/letsencrypt/live/gday.manforowicz.com/privkey.pem --certificate /etc/letsencrypt/live/gday.manforowicz.com/fullchain.pem + +# Auto-restart the service if it crashes +Restart=always + +# How long to wait between restarts +RestartSec=20 + +# Run the service as root, so it can access the certificates +User=root + +# Pipe stdout and stderr into custom log files +StandardOutput=append:/home/ubuntu/gday_server/stdout.log +StandardError=append:/home/ubuntu/gday_server/stderr.log + + +[Install] +WantedBy=multi-user.target