-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73c6ca2
commit 79fdec2
Showing
15 changed files
with
114 additions
and
115 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "compose-watcher" | ||
name = "dispenser" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MIT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: compose-watcher | ||
Package: dispenser | ||
Version: 0.1 | ||
Maintainer: ixpantia S.A. | ||
Architecture: amd64 | ||
Description: Continously Deploy services with Docker Compose | ||
Depends: docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, docker-compose-plugin | ||
Depends: docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, docker-compose-plugin, gnupg2, pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Create the 'compose-watcher' user and home directory if it doesn't exist | ||
if ! id -u compose-watcher > /dev/null 2>&1; then | ||
useradd -r -d /opt/compose-watcher -s /bin/false compose-watcher | ||
mkdir -p /opt/compose-watcher | ||
chown compose-watcher:compose-watcher /opt/compose-watcher | ||
# Create the 'dispenser' user and home directory if it doesn't exist | ||
if ! id -u dispenser > /dev/null 2>&1; then | ||
useradd -r -d /opt/dispenser -s /bin/bash dispenser | ||
usermod -aG docker dispenser | ||
mkdir -p /opt/dispenser | ||
chown dispenser:dispenser /opt/dispenser | ||
fi | ||
|
||
# Create the compose-watcher.toml file if it doesn't exist | ||
if [ ! -f /opt/compose-watcher/compose-watcher.toml ]; then | ||
echo "delay=60 # Will watch for updates every 60 seconds" >> /opt/compose-watcher/compose-watcher.toml | ||
chown compose-watcher:compose-watcher /opt/compose-watcher/compose-watcher.toml | ||
# Create the dispenser.toml file if it doesn't exist | ||
if [ ! -f /opt/dispenser/dispenser.toml ]; then | ||
echo "delay=60 # Will watch for updates every 60 seconds" >> /opt/dispenser/dispenser.toml | ||
chown dispenser:dispenser /opt/dispenser/dispenser.toml | ||
fi | ||
|
||
# Restart the service on upgrade | ||
if [ "$1" = "configure" ]; then | ||
systemctl daemon-reload || true | ||
systemctl enable compose-watcher.service || true | ||
systemctl start compose-watcher.service || true | ||
systemctl enable dispenser.service || true | ||
systemctl start dispenser.service || true | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Name: dispenser | ||
Version: 0.1 | ||
Release: 0 | ||
Summary: Continously Deploy services with Docker Compose | ||
License: see /usr/share/doc/dispenser/copyright | ||
Distribution: Debian | ||
Group: Converted/unknown | ||
Requires: docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin, gnupg2, pass | ||
|
||
%define _rpmdir ./ | ||
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm | ||
%define _unpackaged_files_terminate_build 0 | ||
|
||
%post | ||
#!/bin/sh | ||
set -e | ||
|
||
# Create the 'dispenser' user and home directory if it doesn't exist | ||
if ! id -u dispenser > /dev/null 2>&1; then | ||
useradd -r -d /opt/dispenser -s /bin/bash dispenser | ||
usermod -aG docker dispenser | ||
mkdir -p /opt/dispenser | ||
chown dispenser:dispenser /opt/dispenser | ||
fi | ||
|
||
# Create the dispenser.toml file if it doesn't exist | ||
if [ ! -f /opt/dispenser/dispenser.toml ]; then | ||
echo "delay=60 # Will watch for updates every 60 seconds" >> /opt/dispenser/dispenser.toml | ||
chown dispenser:dispenser /opt/dispenser/dispenser.toml | ||
fi | ||
|
||
# Restart the service on upgrade | ||
systemctl daemon-reload || true | ||
systemctl enable dispenser.service || true | ||
systemctl start dispenser.service || true | ||
|
||
|
||
%preun | ||
#!/bin/sh | ||
set -e | ||
|
||
systemctl stop dispenser.service || true | ||
systemctl disable dispenser.service || true | ||
|
||
|
||
%postun | ||
#!/bin/sh | ||
set -e | ||
|
||
systemctl daemon-reload || true | ||
rm -f /lib/systemd/system/dispenser.service | ||
|
||
rm -rf /usr/local/bin/dispenser | ||
|
||
# Remove the dispenser user and its home directory | ||
userdel -r dispenser || true | ||
rm -rf /opt/dispenser | ||
|
||
|
||
%description | ||
|
||
%files | ||
%dir "/opt/dispenser" | ||
"/usr/lib/systemd/system/dispenser.service" | ||
"/usr/local/bin/dispenser" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters