neptuno 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/gem-push.yml +33 -0
- data/.github/workflows/main.yml +16 -0
- data/.gitignore +9 -0
- data/AUTHORS +8 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +108 -0
- data/LICENSE +201 -0
- data/README.md +70 -0
- data/Rakefile +13 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docs/bg.png +0 -0
- data/docs/docs.css +22 -0
- data/docs/gh.png +0 -0
- data/docs/index.html +84 -0
- data/docs/logo.svg +1 -0
- data/docs/logo_shadow.svg +1 -0
- data/docs/rg.svg +7 -0
- data/docs/splash.png +0 -0
- data/exe/neptuno +8 -0
- data/lib/neptuno/cli/activate.rb +73 -0
- data/lib/neptuno/cli/base.rb +37 -0
- data/lib/neptuno/cli/configure.rb +19 -0
- data/lib/neptuno/cli/execute.rb +26 -0
- data/lib/neptuno/cli/init.rb +27 -0
- data/lib/neptuno/cli/install.rb +35 -0
- data/lib/neptuno/cli/list.rb +76 -0
- data/lib/neptuno/cli/version.rb +14 -0
- data/lib/neptuno/cli.rb +38 -0
- data/lib/neptuno/docker/attach.rb +20 -0
- data/lib/neptuno/docker/build.rb +19 -0
- data/lib/neptuno/docker/down.rb +23 -0
- data/lib/neptuno/docker/log.rb +17 -0
- data/lib/neptuno/docker/restart.rb +22 -0
- data/lib/neptuno/docker/services.rb +24 -0
- data/lib/neptuno/docker/up.rb +22 -0
- data/lib/neptuno/environment/config.rb +20 -0
- data/lib/neptuno/environment/update.rb +24 -0
- data/lib/neptuno/git/pull.rb +14 -0
- data/lib/neptuno/git/stash.rb +14 -0
- data/lib/neptuno/k8s/attach.rb +29 -0
- data/lib/neptuno/overmind/connect.rb +103 -0
- data/lib/neptuno/overmind/start.rb +74 -0
- data/lib/neptuno/overmind/stop.rb +22 -0
- data/lib/neptuno/services/add.rb +88 -0
- data/lib/neptuno/services/destroy.rb +14 -0
- data/lib/neptuno/services/list.rb +12 -0
- data/lib/neptuno/services/update.rb +38 -0
- data/lib/neptuno/templates/Dockerfile +0 -0
- data/lib/neptuno/templates/Procfile +0 -0
- data/lib/neptuno/templates/docker-compose.yml +7 -0
- data/lib/neptuno/templates/tmuxinator.yml +0 -0
- data/lib/neptuno/templates/ude.yml +0 -0
- data/lib/neptuno/tty/command.rb +24 -0
- data/lib/neptuno/tty/config.rb +27 -0
- data/lib/neptuno/tty/file.rb +40 -0
- data/lib/neptuno/tty/prompt.rb +14 -0
- data/lib/neptuno/tty/which.rb +14 -0
- data/lib/neptuno/version.rb +5 -0
- data/lib/neptuno.rb +19 -0
- data/neptuno.gemspec +46 -0
- metadata +278 -0
data/docs/index.html
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
|
7
|
+
<link rel="stylesheet" href="docs.css">
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
10
|
+
<link href="https://fonts.googleapis.com/css2?family=Audiowide&display=swap" rel="stylesheet">
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<!-- This example requires Tailwind CSS v2.0+ -->
|
15
|
+
<nav>
|
16
|
+
<div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8">
|
17
|
+
<div class="relative flex items-center justify-between h-16">
|
18
|
+
<div class="absolute inset-y-0 left-0 flex items-center sm:hidden">
|
19
|
+
<!-- Mobile menu button-->
|
20
|
+
<button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" aria-controls="mobile-menu" aria-expanded="false">
|
21
|
+
<span class="sr-only">Open main menu</span>
|
22
|
+
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
23
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
24
|
+
</svg>
|
25
|
+
</button>
|
26
|
+
</div>
|
27
|
+
<div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
|
28
|
+
<div class="flex-shrink-0 items-center hidden md:flex">
|
29
|
+
<img class="lg:block h-9 w-auto" src="./logo.svg" alt="Neptuno">
|
30
|
+
<span id="logo" class="text-white py-2 text-sm font-thin text-blue-300">Neptuno</span>
|
31
|
+
</div>
|
32
|
+
<div class="hidden sm:block sm:ml-6">
|
33
|
+
<div class="flex space-x-4">
|
34
|
+
<a href="#" class="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">Home</a>
|
35
|
+
<a href="#" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Features</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<div class="flex">
|
40
|
+
<button type="button" class="bg-gray-800 rounded-full mr-2">
|
41
|
+
<span class="sr-only">Ruby Gems</span>
|
42
|
+
<img class="h-6 w-8" src="./rg.svg" alt="Ruby Gems">
|
43
|
+
</button>
|
44
|
+
|
45
|
+
<button type="button" class="bg-gray-800 flex text-sm rounded-full">
|
46
|
+
<span class="sr-only">Open user menu</span>
|
47
|
+
<img class="h-8 w-8" src="./gh.png" alt="Github">
|
48
|
+
</button>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<!-- Mobile menu, show/hide based on menu state. -->
|
54
|
+
<div class="sm:hidden" id="mobile-menu">
|
55
|
+
<div class="px-2 pt-2 pb-3 space-y-1"> </div>
|
56
|
+
</div>
|
57
|
+
</nav>
|
58
|
+
|
59
|
+
|
60
|
+
<main class="sm:mt-24">
|
61
|
+
<div class="mx-auto max-w-7xl">
|
62
|
+
<div class="lg:grid lg:grid-cols-12 lg:gap-8">
|
63
|
+
<div class="px-4 sm:px-6 sm:text-center md:max-w-2xl md:mx-auto lg:col-span-6 lg:text-left lg:flex lg:items-center">
|
64
|
+
<div>
|
65
|
+
<h1 class="mb-10 sm:mb-0 text-center lg:text-left text-4xl tracking-tight font-extrabold text-white sm:mt-5 sm:leading-none lg:mt-6 lg:text-5xl xl:text-5xl">
|
66
|
+
<div class="flex items-center justify-center lg:justify-start">
|
67
|
+
<img class="lg:block h-20 w-auto" src="./logo.svg" alt="Neptuno">
|
68
|
+
<span class="md:block text-blue-300 logo font-thin"> Neptuno </span>
|
69
|
+
</div>
|
70
|
+
<span class="md:block">environment as code</span>
|
71
|
+
</h1>
|
72
|
+
<p class="mt-3 text-base text-white sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
|
73
|
+
Neptuno is an "environment as code" framework; which aims to be opinionated enough to get you going fast, and customizable enough to run just the way you work.
|
74
|
+
</p>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<div class="hidden lg:block mt-16 sm:mt-24 lg:mt-0 lg:col-span-6">
|
78
|
+
<img class="object-contain" src="./splash.png" />
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
</main>
|
83
|
+
</body>
|
84
|
+
</html>
|
data/docs/logo.svg
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="text/ecmascript" width="375pt" zoomAndPan="magnify" contentStyleType="text/css" viewBox="115 112 150 150" height="374.999991pt" preserveAspectRatio="xMidYMid meet" version="1.2"><defs><clipPath xml:id="clip1" id="clip1"><path d="M 127.59375 112.726562 L 189.09375 112.726562 L 189.09375 262.289062 L 127.59375 262.289062 Z M 127.59375 112.726562 "/></clipPath><clipPath xml:id="clip2" id="clip2"><path d="M 188.285156 112.726562 L 247.535156 112.726562 L 247.535156 262.289062 L 188.285156 262.289062 Z M 188.285156 112.726562 "/></clipPath></defs><g xml:id="surface1" id="surface1" ><g clip-rule="nonzero" clip-path="url(#clip1)"><path style=" stroke:none;fill-rule:evenodd;fill:rgb(255,255,255);fill-opacity:1;" d="M 191.261719 262.289062 L 191.511719 261.765625 L 191.152344 261.765625 Z M 201.570312 240.71875 L 217.582031 231.492188 C 225.292969 227.046875 233 222.605469 240.710938 218.15625 C 244.6875 215.867188 247.578125 210.738281 247.578125 206.167969 L 247.578125 179.617188 C 247.578125 170.726562 247.578125 161.839844 247.578125 152.953125 C 247.578125 148.367188 244.574219 143.304688 240.609375 141.015625 L 217.582031 127.742188 C 209.871094 123.300781 202.164062 118.855469 194.453125 114.410156 C 190.472656 112.117188 184.582031 112.183594 180.617188 114.46875 L 157.589844 127.742188 C 149.878906 132.1875 142.171875 136.628906 134.460938 141.078125 C 130.484375 143.367188 127.59375 148.496094 127.59375 153.070312 L 127.59375 179.617188 C 127.59375 188.507812 127.59375 197.394531 127.59375 206.28125 C 127.59375 210.867188 130.59375 215.929688 134.5625 218.21875 L 157.589844 231.492188 C 165.300781 235.933594 173.007812 240.378906 180.71875 244.824219 C 181.371094 245.199219 182.078125 245.515625 182.820312 245.761719 C 182.992188 241.523438 183.164062 237.363281 183.324219 233.78125 C 183.457031 230.75 183.902344 230.164062 180.746094 229.085938 C 179.621094 228.703125 178.796875 227.714844 178.796875 226.476562 C 178.796875 224.949219 180.046875 223.703125 181.574219 223.703125 C 185.582031 223.703125 189.585938 223.703125 193.59375 223.703125 C 195.125 223.703125 196.375 224.949219 196.375 226.476562 C 196.375 227.714844 195.546875 228.703125 194.421875 229.085938 C 191.269531 230.164062 191.710938 230.75 191.847656 233.78125 C 191.929688 235.574219 192.011719 237.511719 192.097656 239.53125 L 192.105469 239.707031 L 192.109375 239.824219 L 192.128906 240.277344 L 192.132812 240.417969 L 192.15625 241.015625 L 192.160156 241.042969 L 192.207031 242.207031 L 192.207031 242.222656 L 192.238281 242.984375 L 192.246094 243.132812 L 192.246094 243.183594 L 192.296875 244.355469 L 192.296875 244.363281 L 192.328125 245.15625 L 192.332031 245.28125 L 192.335938 245.351562 L 192.34375 245.550781 L 192.347656 245.589844 L 192.351562 245.746094 C 192.535156 250.226562 192.71875 254.792969 192.902344 258.859375 Z M 193.199219 221.769531 C 193.25 213.421875 204.167969 214.371094 210.507812 209.269531 C 214.917969 205.71875 215.527344 199.933594 215.089844 194.664062 C 214.796875 191.175781 213.875 187.066406 212.246094 181.839844 C 209.984375 174.578125 211.457031 171.40625 211.457031 171.40625 C 212.394531 176.78125 218.386719 178.667969 218.386719 178.667969 C 213.863281 170.371094 216.617188 154.734375 216.617188 154.734375 C 207.21875 162.140625 205.621094 171.917969 207.992188 182.84375 C 209.40625 189.398438 211.40625 196.21875 208.753906 200.585938 C 204.167969 208.128906 189.773438 211.707031 189.773438 194.59375 L 189.773438 171.914062 C 189.773438 165.714844 190.199219 162.027344 197.289062 165.777344 L 187.585938 148.441406 L 177.882812 165.777344 C 184.972656 162.027344 185.398438 165.714844 185.394531 171.914062 L 185.394531 194.59375 C 185.394531 211.707031 171.003906 208.128906 166.417969 200.585938 C 163.765625 196.21875 165.761719 189.398438 167.183594 182.84375 C 169.550781 171.917969 167.949219 162.140625 158.550781 154.734375 C 158.550781 154.734375 161.304688 170.371094 156.785156 178.667969 C 156.785156 178.667969 162.777344 176.78125 163.714844 171.40625 C 163.714844 171.40625 165.1875 174.578125 162.921875 181.839844 C 161.296875 187.066406 160.375 191.175781 160.082031 194.664062 C 159.644531 199.933594 160.253906 205.71875 164.664062 209.269531 C 171.003906 214.371094 181.921875 213.421875 181.972656 221.769531 L 193.199219 221.769531 "/></g><g clip-rule="nonzero" clip-path="url(#clip2)"><path style=" stroke:none;fill-rule:evenodd;fill:rgb(255,255,255);fill-opacity:1;" d="M 191.261719 262.289062 L 191.511719 261.765625 L 191.152344 261.765625 Z M 201.570312 240.71875 L 217.582031 231.492188 C 225.292969 227.046875 233 222.605469 240.710938 218.15625 C 244.6875 215.867188 247.578125 210.738281 247.578125 206.167969 L 247.578125 179.617188 C 247.578125 170.726562 247.578125 161.839844 247.578125 152.953125 C 247.578125 148.367188 244.574219 143.304688 240.609375 141.015625 L 217.582031 127.742188 C 209.871094 123.300781 202.164062 118.855469 194.453125 114.410156 C 190.472656 112.117188 184.582031 112.183594 180.617188 114.46875 L 157.589844 127.742188 C 149.878906 132.1875 142.171875 136.628906 134.460938 141.078125 C 130.484375 143.367188 127.59375 148.496094 127.59375 153.070312 L 127.59375 179.617188 C 127.59375 188.507812 127.59375 197.394531 127.59375 206.28125 C 127.59375 210.867188 130.59375 215.929688 134.5625 218.21875 L 157.589844 231.492188 C 165.300781 235.933594 173.007812 240.378906 180.71875 244.824219 C 181.371094 245.199219 182.078125 245.515625 182.820312 245.761719 C 182.992188 241.523438 183.164062 237.363281 183.324219 233.78125 C 183.457031 230.75 183.902344 230.164062 180.746094 229.085938 C 179.621094 228.703125 178.796875 227.714844 178.796875 226.476562 C 178.796875 224.949219 180.046875 223.703125 181.574219 223.703125 C 185.582031 223.703125 189.585938 223.703125 193.59375 223.703125 C 195.125 223.703125 196.375 224.949219 196.375 226.476562 C 196.375 227.714844 195.546875 228.703125 194.421875 229.085938 C 191.269531 230.164062 191.710938 230.75 191.847656 233.78125 C 191.929688 235.574219 192.011719 237.511719 192.097656 239.53125 L 192.105469 239.707031 L 192.109375 239.824219 L 192.128906 240.277344 L 192.132812 240.417969 L 192.15625 241.015625 L 192.160156 241.042969 L 192.207031 242.207031 L 192.207031 242.222656 L 192.238281 242.984375 L 192.246094 243.132812 L 192.246094 243.183594 L 192.296875 244.355469 L 192.296875 244.363281 L 192.328125 245.15625 L 192.332031 245.28125 L 192.335938 245.351562 L 192.34375 245.550781 L 192.347656 245.589844 L 192.351562 245.746094 C 192.535156 250.226562 192.71875 254.792969 192.902344 258.859375 Z M 193.199219 221.769531 C 193.25 213.421875 204.167969 214.371094 210.507812 209.269531 C 214.917969 205.71875 215.527344 199.933594 215.089844 194.664062 C 214.796875 191.175781 213.875 187.066406 212.246094 181.839844 C 209.984375 174.578125 211.457031 171.40625 211.457031 171.40625 C 212.394531 176.78125 218.386719 178.667969 218.386719 178.667969 C 213.863281 170.371094 216.617188 154.734375 216.617188 154.734375 C 207.21875 162.140625 205.621094 171.917969 207.992188 182.84375 C 209.40625 189.398438 211.40625 196.21875 208.753906 200.585938 C 204.167969 208.128906 189.773438 211.707031 189.773438 194.59375 L 189.773438 171.914062 C 189.773438 165.714844 190.199219 162.027344 197.289062 165.777344 L 187.585938 148.441406 L 177.882812 165.777344 C 184.972656 162.027344 185.398438 165.714844 185.394531 171.914062 L 185.394531 194.59375 C 185.394531 211.707031 171.003906 208.128906 166.417969 200.585938 C 163.765625 196.21875 165.761719 189.398438 167.183594 182.84375 C 169.550781 171.917969 167.949219 162.140625 158.550781 154.734375 C 158.550781 154.734375 161.304688 170.371094 156.785156 178.667969 C 156.785156 178.667969 162.777344 176.78125 163.714844 171.40625 C 163.714844 171.40625 165.1875 174.578125 162.921875 181.839844 C 161.296875 187.066406 160.375 191.175781 160.082031 194.664062 C 159.644531 199.933594 160.253906 205.71875 164.664062 209.269531 C 171.003906 214.371094 181.921875 213.421875 181.972656 221.769531 L 193.199219 221.769531 "/></g></g></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="text/ecmascript" width="375pt" zoomAndPan="magnify" contentStyleType="text/css" viewBox="115 112 150 150" height="374.999991pt" preserveAspectRatio="xMidYMid meet" version="1.2"><defs><clipPath xml:id="clip1" id="clip1" ><path d="M 127.59375 112.726562 L 189.09375 112.726562 L 189.09375 262.289062 L 127.59375 262.289062 Z M 127.59375 112.726562 "/></clipPath><clipPath xml:id="clip2" id="clip2"><path d="M 188.285156 112.726562 L 247.535156 112.726562 L 247.535156 262.289062 L 188.285156 262.289062 Z M 188.285156 112.726562 "/></clipPath></defs><g xml:id="surface1" id="surface1" style="filter: drop-shadow(1px 1px 0px black) drop-shadow(2px 2px 2px black);"><g clip-rule="nonzero" clip-path="url(#clip1)"><path style=" stroke:none;fill-rule:evenodd;fill:rgb(255,255,255);fill-opacity:1;" d="M 191.261719 262.289062 L 191.511719 261.765625 L 191.152344 261.765625 Z M 201.570312 240.71875 L 217.582031 231.492188 C 225.292969 227.046875 233 222.605469 240.710938 218.15625 C 244.6875 215.867188 247.578125 210.738281 247.578125 206.167969 L 247.578125 179.617188 C 247.578125 170.726562 247.578125 161.839844 247.578125 152.953125 C 247.578125 148.367188 244.574219 143.304688 240.609375 141.015625 L 217.582031 127.742188 C 209.871094 123.300781 202.164062 118.855469 194.453125 114.410156 C 190.472656 112.117188 184.582031 112.183594 180.617188 114.46875 L 157.589844 127.742188 C 149.878906 132.1875 142.171875 136.628906 134.460938 141.078125 C 130.484375 143.367188 127.59375 148.496094 127.59375 153.070312 L 127.59375 179.617188 C 127.59375 188.507812 127.59375 197.394531 127.59375 206.28125 C 127.59375 210.867188 130.59375 215.929688 134.5625 218.21875 L 157.589844 231.492188 C 165.300781 235.933594 173.007812 240.378906 180.71875 244.824219 C 181.371094 245.199219 182.078125 245.515625 182.820312 245.761719 C 182.992188 241.523438 183.164062 237.363281 183.324219 233.78125 C 183.457031 230.75 183.902344 230.164062 180.746094 229.085938 C 179.621094 228.703125 178.796875 227.714844 178.796875 226.476562 C 178.796875 224.949219 180.046875 223.703125 181.574219 223.703125 C 185.582031 223.703125 189.585938 223.703125 193.59375 223.703125 C 195.125 223.703125 196.375 224.949219 196.375 226.476562 C 196.375 227.714844 195.546875 228.703125 194.421875 229.085938 C 191.269531 230.164062 191.710938 230.75 191.847656 233.78125 C 191.929688 235.574219 192.011719 237.511719 192.097656 239.53125 L 192.105469 239.707031 L 192.109375 239.824219 L 192.128906 240.277344 L 192.132812 240.417969 L 192.15625 241.015625 L 192.160156 241.042969 L 192.207031 242.207031 L 192.207031 242.222656 L 192.238281 242.984375 L 192.246094 243.132812 L 192.246094 243.183594 L 192.296875 244.355469 L 192.296875 244.363281 L 192.328125 245.15625 L 192.332031 245.28125 L 192.335938 245.351562 L 192.34375 245.550781 L 192.347656 245.589844 L 192.351562 245.746094 C 192.535156 250.226562 192.71875 254.792969 192.902344 258.859375 Z M 193.199219 221.769531 C 193.25 213.421875 204.167969 214.371094 210.507812 209.269531 C 214.917969 205.71875 215.527344 199.933594 215.089844 194.664062 C 214.796875 191.175781 213.875 187.066406 212.246094 181.839844 C 209.984375 174.578125 211.457031 171.40625 211.457031 171.40625 C 212.394531 176.78125 218.386719 178.667969 218.386719 178.667969 C 213.863281 170.371094 216.617188 154.734375 216.617188 154.734375 C 207.21875 162.140625 205.621094 171.917969 207.992188 182.84375 C 209.40625 189.398438 211.40625 196.21875 208.753906 200.585938 C 204.167969 208.128906 189.773438 211.707031 189.773438 194.59375 L 189.773438 171.914062 C 189.773438 165.714844 190.199219 162.027344 197.289062 165.777344 L 187.585938 148.441406 L 177.882812 165.777344 C 184.972656 162.027344 185.398438 165.714844 185.394531 171.914062 L 185.394531 194.59375 C 185.394531 211.707031 171.003906 208.128906 166.417969 200.585938 C 163.765625 196.21875 165.761719 189.398438 167.183594 182.84375 C 169.550781 171.917969 167.949219 162.140625 158.550781 154.734375 C 158.550781 154.734375 161.304688 170.371094 156.785156 178.667969 C 156.785156 178.667969 162.777344 176.78125 163.714844 171.40625 C 163.714844 171.40625 165.1875 174.578125 162.921875 181.839844 C 161.296875 187.066406 160.375 191.175781 160.082031 194.664062 C 159.644531 199.933594 160.253906 205.71875 164.664062 209.269531 C 171.003906 214.371094 181.921875 213.421875 181.972656 221.769531 L 193.199219 221.769531 "/></g><g clip-rule="nonzero" clip-path="url(#clip2)"><path style=" stroke:none;fill-rule:evenodd;fill:rgb(255,255,255);fill-opacity:1;" d="M 191.261719 262.289062 L 191.511719 261.765625 L 191.152344 261.765625 Z M 201.570312 240.71875 L 217.582031 231.492188 C 225.292969 227.046875 233 222.605469 240.710938 218.15625 C 244.6875 215.867188 247.578125 210.738281 247.578125 206.167969 L 247.578125 179.617188 C 247.578125 170.726562 247.578125 161.839844 247.578125 152.953125 C 247.578125 148.367188 244.574219 143.304688 240.609375 141.015625 L 217.582031 127.742188 C 209.871094 123.300781 202.164062 118.855469 194.453125 114.410156 C 190.472656 112.117188 184.582031 112.183594 180.617188 114.46875 L 157.589844 127.742188 C 149.878906 132.1875 142.171875 136.628906 134.460938 141.078125 C 130.484375 143.367188 127.59375 148.496094 127.59375 153.070312 L 127.59375 179.617188 C 127.59375 188.507812 127.59375 197.394531 127.59375 206.28125 C 127.59375 210.867188 130.59375 215.929688 134.5625 218.21875 L 157.589844 231.492188 C 165.300781 235.933594 173.007812 240.378906 180.71875 244.824219 C 181.371094 245.199219 182.078125 245.515625 182.820312 245.761719 C 182.992188 241.523438 183.164062 237.363281 183.324219 233.78125 C 183.457031 230.75 183.902344 230.164062 180.746094 229.085938 C 179.621094 228.703125 178.796875 227.714844 178.796875 226.476562 C 178.796875 224.949219 180.046875 223.703125 181.574219 223.703125 C 185.582031 223.703125 189.585938 223.703125 193.59375 223.703125 C 195.125 223.703125 196.375 224.949219 196.375 226.476562 C 196.375 227.714844 195.546875 228.703125 194.421875 229.085938 C 191.269531 230.164062 191.710938 230.75 191.847656 233.78125 C 191.929688 235.574219 192.011719 237.511719 192.097656 239.53125 L 192.105469 239.707031 L 192.109375 239.824219 L 192.128906 240.277344 L 192.132812 240.417969 L 192.15625 241.015625 L 192.160156 241.042969 L 192.207031 242.207031 L 192.207031 242.222656 L 192.238281 242.984375 L 192.246094 243.132812 L 192.246094 243.183594 L 192.296875 244.355469 L 192.296875 244.363281 L 192.328125 245.15625 L 192.332031 245.28125 L 192.335938 245.351562 L 192.34375 245.550781 L 192.347656 245.589844 L 192.351562 245.746094 C 192.535156 250.226562 192.71875 254.792969 192.902344 258.859375 Z M 193.199219 221.769531 C 193.25 213.421875 204.167969 214.371094 210.507812 209.269531 C 214.917969 205.71875 215.527344 199.933594 215.089844 194.664062 C 214.796875 191.175781 213.875 187.066406 212.246094 181.839844 C 209.984375 174.578125 211.457031 171.40625 211.457031 171.40625 C 212.394531 176.78125 218.386719 178.667969 218.386719 178.667969 C 213.863281 170.371094 216.617188 154.734375 216.617188 154.734375 C 207.21875 162.140625 205.621094 171.917969 207.992188 182.84375 C 209.40625 189.398438 211.40625 196.21875 208.753906 200.585938 C 204.167969 208.128906 189.773438 211.707031 189.773438 194.59375 L 189.773438 171.914062 C 189.773438 165.714844 190.199219 162.027344 197.289062 165.777344 L 187.585938 148.441406 L 177.882812 165.777344 C 184.972656 162.027344 185.398438 165.714844 185.394531 171.914062 L 185.394531 194.59375 C 185.394531 211.707031 171.003906 208.128906 166.417969 200.585938 C 163.765625 196.21875 165.761719 189.398438 167.183594 182.84375 C 169.550781 171.917969 167.949219 162.140625 158.550781 154.734375 C 158.550781 154.734375 161.304688 170.371094 156.785156 178.667969 C 156.785156 178.667969 162.777344 176.78125 163.714844 171.40625 C 163.714844 171.40625 165.1875 174.578125 162.921875 181.839844 C 161.296875 187.066406 160.375 191.175781 160.082031 194.664062 C 159.644531 199.933594 160.253906 205.71875 164.664062 209.269531 C 171.003906 214.371094 181.921875 213.421875 181.972656 221.769531 L 193.199219 221.769531 "/></g></g></svg>
|
data/docs/rg.svg
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg width="256px" height="293px" viewBox="0 0 256 293" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
3
|
+
<g fill="#D34231">
|
4
|
+
<path d="M76.7478977,97.4337652 L76.585237,97.2711045 L40.4745594,133.381782 L128.148682,220.893244 L164.25936,184.945227 L215.822805,133.381782 L179.712127,97.2711045 L179.712127,97.1084438 L76.585237,97.1084438 L76.7478977,97.4337652 Z"></path>
|
5
|
+
<path d="M127.823361,0.975964259 L0.1347034,74.1732837 L0.1347034,220.567923 L127.823361,293.765242 L255.512018,220.567923 L255.512018,74.1732837 L127.823361,0.975964259 L127.823361,0.975964259 Z M231.112911,206.579102 L127.823361,266.112921 L24.5338099,206.579102 L24.5338099,87.8367833 L127.823361,28.3029635 L231.112911,87.8367833 L231.112911,206.579102 L231.112911,206.579102 Z"></path>
|
6
|
+
</g>
|
7
|
+
</svg>
|
data/docs/splash.png
ADDED
Binary file
|
data/exe/neptuno
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Init Neptuno files
|
6
|
+
class Activate < Neptuno::CLI::Base
|
7
|
+
include ::Neptuno::TTY::Config
|
8
|
+
desc 'Bring services containers up and start their processes'
|
9
|
+
|
10
|
+
option :force, type: :boolean, default: false, desc: 'Try to start disrigarding container status'
|
11
|
+
option :all, type: :boolean, default: false, desc: 'Run on all services'
|
12
|
+
argument :services, type: :array, required: false, desc: 'Optional list of services'
|
13
|
+
|
14
|
+
def call(services: [], **options)
|
15
|
+
dd = config.fetch('docker_delimiter') || '-'
|
16
|
+
multi_spinner = ::TTY::Spinner::Multi.new('[:spinner] Services')
|
17
|
+
spinners = {}
|
18
|
+
count = 0
|
19
|
+
command_services_to('activate to services', all: options.fetch(:all), services_as_args: services) do |services|
|
20
|
+
system("cd #{neptuno_path} && docker compose up -d #{services.join(' ')}")
|
21
|
+
running_services = ::Neptuno::CLI::List.new.running_services.first.keys
|
22
|
+
running_services.sort.each do |service|
|
23
|
+
spinners[service] ||= multi_spinner.register("[:spinner] :state #{service}")
|
24
|
+
spinners[service].update(state: '- ')
|
25
|
+
spinners[service].auto_spin
|
26
|
+
end
|
27
|
+
loop do
|
28
|
+
ps = `cd #{neptuno_path} && docker compose ps`.split("\n").compact.select { |x| x.match(/^\s*#{project}/) }
|
29
|
+
|
30
|
+
running_services.sort.each do |service|
|
31
|
+
service_ps = ps.find { |s| s.include?(project.to_s) && s.include?("#{dd}#{service}#{dd}") }
|
32
|
+
|
33
|
+
status = :dead if service_ps.to_s.include?('exited')
|
34
|
+
status = :starting if service_ps.to_s.include?('starting')
|
35
|
+
status = :unhealthy if service_ps.to_s.include?('(unhealthy')
|
36
|
+
status = :healthy if service_ps.to_s.include?('(healthy')
|
37
|
+
status = :force if options.fetch(:force)
|
38
|
+
|
39
|
+
case status
|
40
|
+
when :force
|
41
|
+
spinners[service].success
|
42
|
+
`cd #{neptuno_path}/procfiles/#{service} && overmind start -D -N > /dev/null 2>&1`
|
43
|
+
when :dead
|
44
|
+
spinners[service].update(state: 'dead ')
|
45
|
+
spinners[service].error
|
46
|
+
when :starting
|
47
|
+
spinners[service].update(state: 'starting ')
|
48
|
+
when :unhealthy
|
49
|
+
spinners[service].update(state: 'unhealthy ')
|
50
|
+
spinners[service].error if spinners[service].instance_variable_get(:@state) == :spinning && count > 50
|
51
|
+
when :healthy
|
52
|
+
spinners[service].update(state: 'ready ')
|
53
|
+
spinners[service].success
|
54
|
+
`cd #{neptuno_path}/procfiles/#{service} && overmind start -D -N > /dev/null 2>&1`
|
55
|
+
else
|
56
|
+
spinners[service].update(state: 'down ')
|
57
|
+
spinners[service].error
|
58
|
+
end
|
59
|
+
end
|
60
|
+
break if spinners.values.map { |s| s.instance_variable_get(:@state) }.uniq.all?(:stopped)
|
61
|
+
|
62
|
+
count += 1
|
63
|
+
sleep(5)
|
64
|
+
end
|
65
|
+
spinner = ::TTY::Spinner.new('Neptuno: Starting[:spinner]', format: :dots)
|
66
|
+
spinner.auto_spin
|
67
|
+
|
68
|
+
spinner.stop
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Base cli class for Neptuno
|
6
|
+
class Base < Dry::CLI::Command
|
7
|
+
include Neptuno::TTY::Config
|
8
|
+
include TTY::Prompt
|
9
|
+
include TTY::File
|
10
|
+
include Neptuno::TTY::Command
|
11
|
+
|
12
|
+
ABORT_MESSAGE = 'fatal: not a Neptuno repository (or any of the parent directories)'
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
abort ABORT_MESSAGE if neptuno_path == ''
|
16
|
+
config.append_path(neptuno_path)
|
17
|
+
config.read
|
18
|
+
end
|
19
|
+
|
20
|
+
def command_service_to(request, service_as_args: '')
|
21
|
+
chosen_service ||= service_as_args&.empty? ? nil : service_as_args
|
22
|
+
chosen_service ||= service if in_service?
|
23
|
+
chosen_service ||= prompt.select("Command service to #{request}:", services)
|
24
|
+
yield chosen_service, project
|
25
|
+
end
|
26
|
+
|
27
|
+
def command_services_to(request, all: nil, services_as_args: [])
|
28
|
+
chosen_services = services if all
|
29
|
+
chosen_services ||= services_as_args&.empty? ? nil : services_as_args
|
30
|
+
chosen_services ||= [service] if in_service?
|
31
|
+
chosen_services ||= configured_services.empty? ? nil : configured_services
|
32
|
+
chosen_services ||= prompt.multi_select("Command services to #{request}:", services)
|
33
|
+
yield chosen_services, project
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Configure Neptuno defaults
|
6
|
+
class Configure < Neptuno::CLI::Base
|
7
|
+
desc 'Configure which services to start by default'
|
8
|
+
|
9
|
+
def call(**)
|
10
|
+
configured_services = config.fetch('configured_services')
|
11
|
+
configured_services = prompt.multi_select('Active services: ', config.fetch('services')) do |menu|
|
12
|
+
menu.default(*configured_services)
|
13
|
+
end
|
14
|
+
config.set(:configured_services, value: configured_services)
|
15
|
+
config.write(force: true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Init Neptuno files
|
6
|
+
class Execute < Neptuno::CLI::Base
|
7
|
+
include TTY::File
|
8
|
+
include TTY::Config
|
9
|
+
|
10
|
+
desc 'Execute service script'
|
11
|
+
|
12
|
+
def call(**options)
|
13
|
+
command_service_to('execute', service_as_args: options[:args]&.first) do |service, _project|
|
14
|
+
commands = Dir.glob("#{neptuno_path}/scripts/#{service}/*").map { |x| x.split('/') }.map(&:last)
|
15
|
+
command = options[:args].last if commands.include?(options[:args]&.last)
|
16
|
+
puts "#{neptuno_path}/scripts/#{service}/*"
|
17
|
+
puts service
|
18
|
+
puts commands.to_s
|
19
|
+
puts Dir.glob("#{neptuno_path}/scripts/#{service}/*").to_s
|
20
|
+
command ||= prompt.select('execute', commands || [])
|
21
|
+
`cd #{neptuno_path}/scripts/#{service} && ./#{command}`
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Init Neptuno files
|
6
|
+
class Init < Dry::CLI::Command
|
7
|
+
include TTY::File
|
8
|
+
include TTY::Config
|
9
|
+
include TTY::Which
|
10
|
+
|
11
|
+
desc 'Initializes a Neptuno project folder structure'
|
12
|
+
|
13
|
+
WORK_TREE = { '.' => ['docker-compose.yml', '.tmuxinator.yml',
|
14
|
+
{ 'services' => [], 'dockerfiles' => [], 'procfiles' => [], 'environments' => [] }] }.freeze
|
15
|
+
|
16
|
+
CONFIG = nil
|
17
|
+
|
18
|
+
def call(**)
|
19
|
+
abort 'Neptuno projects can not be nested.' if neptuno_path != ''
|
20
|
+
::TTY::File.create_dir(WORK_TREE, Dir.pwd)
|
21
|
+
config.set(:configured_services, value: '')
|
22
|
+
config.set(:services, value: [])
|
23
|
+
config.write(create: true, force: true)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Init Neptuno files
|
6
|
+
class Install < Dry::CLI::Command
|
7
|
+
include TTY::Command
|
8
|
+
include TTY::Prompt
|
9
|
+
include TTY::File
|
10
|
+
include TTY::Config
|
11
|
+
include TTY::Which
|
12
|
+
|
13
|
+
desc 'Installs git, docker, tmux, tmuxinator and overmind'
|
14
|
+
|
15
|
+
CONFIG = nil
|
16
|
+
|
17
|
+
def call(**)
|
18
|
+
install 'git'
|
19
|
+
install 'docker'
|
20
|
+
install 'tmux'
|
21
|
+
install 'overmind'
|
22
|
+
install 'tmuxinator'
|
23
|
+
end
|
24
|
+
|
25
|
+
def install(package)
|
26
|
+
if ::TTY::Which.exist?(package)
|
27
|
+
puts "#{package} is already installed"
|
28
|
+
else
|
29
|
+
puts "Installing #{package}"
|
30
|
+
system("brew install #{package}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module CLI
|
5
|
+
# Init Neptuno files
|
6
|
+
|
7
|
+
class List < Neptuno::CLI::Base
|
8
|
+
include TTY::File
|
9
|
+
include TTY::Config
|
10
|
+
include DOTIW::Methods
|
11
|
+
|
12
|
+
desc 'List containers and their processes'
|
13
|
+
option :relative, aliases: ['r'], type: :boolean, default: true,
|
14
|
+
desc: "Use relative time in 'last commit date' field"
|
15
|
+
|
16
|
+
STATE_ORDER = %w[on dead off].freeze
|
17
|
+
|
18
|
+
def running_services
|
19
|
+
proc_files = Dir.glob('procfiles/**/Procfile', base: neptuno_path)
|
20
|
+
neptuno_procs = proc_files.map do |f|
|
21
|
+
[f.split("\/")[1], File.read("#{neptuno_path}/#{f}").split("\n").map do |s|
|
22
|
+
s.split(':').first
|
23
|
+
end]
|
24
|
+
end.to_h
|
25
|
+
|
26
|
+
begin
|
27
|
+
docker_containers = system('docker compose ps', exception: true).lines[1..]
|
28
|
+
rescue RuntimeError
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
docker_procs = docker_containers.map { |service| service.split(/\s\s+/).slice(2, 2) }.to_h
|
32
|
+
|
33
|
+
[neptuno_procs, docker_procs]
|
34
|
+
end
|
35
|
+
|
36
|
+
def service_current_branches
|
37
|
+
branches = `cd #{neptuno_path} && git submodule foreach 'git branch --show-current'`
|
38
|
+
branches.lines.each_slice(2).map do |service, branch|
|
39
|
+
[service.match(%r{services/(.*)'}).to_a.last, branch.to_s.strip]
|
40
|
+
end.to_h
|
41
|
+
end
|
42
|
+
|
43
|
+
def last_commit_date
|
44
|
+
dates = `cd #{neptuno_path} && git submodule foreach 'git log -1 --format=%cd'`
|
45
|
+
dates.lines.each_slice(2).map do |service, date|
|
46
|
+
[service.match(%r{services/(.*)'}).to_a.last, date.to_s.strip]
|
47
|
+
end.to_h
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_display_date(date, relative)
|
51
|
+
if date
|
52
|
+
return date unless relative
|
53
|
+
|
54
|
+
distance_of_time_in_words(Time.now, Time.parse(date), false, highest_measures: 1).concat(' ago')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def call(**options)
|
59
|
+
neptuno_procs, docker_procs = running_services
|
60
|
+
branches = service_current_branches
|
61
|
+
dates = last_commit_date
|
62
|
+
|
63
|
+
procs = neptuno_procs.map do |name, *processes|
|
64
|
+
display_date = get_display_date(dates[name], options.fetch(:relative))
|
65
|
+
state = docker_procs[name]&.match?(/running/) ? 'on' : nil
|
66
|
+
state ||= docker_procs[name]&.match?(/exited/) ? 'dead' : 'off'
|
67
|
+
{ state: state, name: name, branch: branches[name], last_commit: display_date, processes: processes }
|
68
|
+
end
|
69
|
+
|
70
|
+
puts Hirb::Helpers::AutoTable.render(procs.sort do |a, b|
|
71
|
+
[STATE_ORDER.index(b[:state]), a[:name]] <=> [STATE_ORDER.index(a[:state]), b[:name]]
|
72
|
+
end.reverse, fields: %i[state name branch last_commit processes])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/neptuno/cli.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/cli'
|
4
|
+
|
5
|
+
# Public: Command line interface that allows to install the library, and run
|
6
|
+
# simple commands.
|
7
|
+
module Neptuno
|
8
|
+
module CLI
|
9
|
+
extend Dry::CLI::Registry
|
10
|
+
|
11
|
+
register 'version', Version, aliases: ['v', '-v', '--version', 'info']
|
12
|
+
register 'init', Init
|
13
|
+
register 'ls', List, aliases: ['ps']
|
14
|
+
register 'activate', Activate, aliases: ['a']
|
15
|
+
register 'config', Configure, aliases: %w[configure conf cc]
|
16
|
+
register 'execute', Execute, aliases: ['e']
|
17
|
+
register 'build', ::Neptuno::Docker::Build, aliases: ['b']
|
18
|
+
register 'up', Docker::Up, aliases: ['u']
|
19
|
+
register 'down', Docker::Down, aliases: ['d']
|
20
|
+
register 'restart', Docker::Restart, aliases: ['r']
|
21
|
+
register 'attach', Docker::Attach, aliases: ['at']
|
22
|
+
register 'k8s', K8s::Attach, aliases: ['k']
|
23
|
+
register 'log', Docker::Log, aliases: ['l']
|
24
|
+
register 'start', Overmind::Start, aliases: ['s']
|
25
|
+
register 'stop', Overmind::Stop, aliases: ['x']
|
26
|
+
register 'update', Services::Update, aliases: ['su']
|
27
|
+
register 'connect', Overmind::Connect, aliases: ['c']
|
28
|
+
register 'services list', Services::List, aliases: ['ls']
|
29
|
+
register 'services add', Services::Add
|
30
|
+
register 'services destroy', Services::Destroy, aliases: ['rm']
|
31
|
+
register 'services update', Services::Update, aliases: ['su']
|
32
|
+
register 'git stash', ::Neptuno::Git::Stash
|
33
|
+
register 'git pull', ::Neptuno::Git::Pull
|
34
|
+
register 'install', ::Neptuno::CLI::Install
|
35
|
+
register 'environment update', Environment::Update
|
36
|
+
register 'environment config', Environment::Config
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module Docker
|
5
|
+
class Attach < Neptuno::CLI::Base
|
6
|
+
include ::Neptuno::TTY::Config
|
7
|
+
desc "Docker: Attach to a container's command"
|
8
|
+
|
9
|
+
option :up, type: :boolean, default: false, desc: 'Try to start containers before connecting'
|
10
|
+
|
11
|
+
def call(**options)
|
12
|
+
dd = config.fetch('docker_delimiter') || '-'
|
13
|
+
command_service_to('attach', service_as_args: options[:args].first) do |service, project|
|
14
|
+
system("cd #{neptuno_path} && docker compose up -d #{service}") if options.fetch(:up)
|
15
|
+
system("cd #{neptuno_path} && docker attach #{project}#{dd}#{service}#{dd}1")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module Docker
|
5
|
+
# Build docker container for Neptuno project
|
6
|
+
class Build < Neptuno::CLI::Base
|
7
|
+
desc 'Docker: Build docker containers for project'
|
8
|
+
|
9
|
+
option :all, type: :boolean, default: false, desc: 'Run on all services'
|
10
|
+
argument :services, type: :array, required: false, desc: 'Optional list of services'
|
11
|
+
|
12
|
+
def call(services: [], **options)
|
13
|
+
command_services_to('build', all: options.fetch(:all), services_as_args: services) do |services|
|
14
|
+
system("cd #{neptuno_path} && docker compose build #{services.join(' ')}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module Docker
|
5
|
+
# Stop docker containers for Neptuno project
|
6
|
+
class Down < Neptuno::CLI::Base
|
7
|
+
desc 'Docker: Stop docker containers for current project'
|
8
|
+
|
9
|
+
option :tmux, type: :boolean, default: false, desc: 'Kill tmux session'
|
10
|
+
option :all, type: :boolean, default: false, desc: 'Run on all services'
|
11
|
+
argument :services, type: :array, required: false, desc: 'Optional list of services'
|
12
|
+
|
13
|
+
def call(services: [], **options)
|
14
|
+
command_services_to('go down', all: options.fetch(:all), services_as_args: services) do |services|
|
15
|
+
system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(' ')}")
|
16
|
+
system("cd #{neptuno_path} && docker compose rm -f #{services.join(' ')}")
|
17
|
+
system("cd #{neptuno_path} && tmux kill-session -t neptuno") if options.fetch(:tmux)
|
18
|
+
system("cd #{neptuno_path}/procfiles/#{service} && rm .overmind.sock > /dev/null 2>&1")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module Docker
|
5
|
+
class Log < Neptuno::CLI::Base
|
6
|
+
include ::Neptuno::TTY::Config
|
7
|
+
desc "Docker: Show a container's log"
|
8
|
+
|
9
|
+
def call(**options)
|
10
|
+
dd = config.fetch('docker_delimiter') || '-'
|
11
|
+
command_service_to('log', service_as_args: options[:args].first) do |service, project|
|
12
|
+
system("cd #{neptuno_path} && docker logs -f #{project}#{dd}#{service}#{dd}1")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module Docker
|
5
|
+
# Restart docker containers for Neptuno project
|
6
|
+
class Restart < Neptuno::CLI::Base
|
7
|
+
desc 'Docker: Rebuild and restart docker containers for current project'
|
8
|
+
|
9
|
+
option :all, type: :boolean, default: false, desc: 'Run on all services'
|
10
|
+
argument :services, type: :array, required: false, desc: 'Optional list of services'
|
11
|
+
|
12
|
+
def call(services: [], **options)
|
13
|
+
command_services_to('restart', all: options.fetch(:all), services_as_args: services) do |services|
|
14
|
+
system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(' ')}")
|
15
|
+
system("cd #{neptuno_path} && docker compose rm -f #{services.join(' ')}")
|
16
|
+
system("cd #{neptuno_path} && docker compose build #{services.join(' ')}")
|
17
|
+
system("cd #{neptuno_path} && docker compose up -d #{services.join(' ')}")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neptuno
|
4
|
+
module Docker
|
5
|
+
module Services
|
6
|
+
include Neptuno::TTY::Config
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
def running_services
|
10
|
+
running_services = `cd ~/.neptuno/projects/#{current_project} && docker compose ps | awk '{ print $3 }' | awk 'NR>1'`
|
11
|
+
running_services.split("\n").map(&:strip)
|
12
|
+
end
|
13
|
+
|
14
|
+
def registered_services
|
15
|
+
dc = YAML.load_file("#{neptuno_path}/docker-compose.yml")
|
16
|
+
dc['services'].keys
|
17
|
+
end
|
18
|
+
|
19
|
+
def stopped_services
|
20
|
+
registered_services - running_services
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|