-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Piyush Raj <[email protected]>
- Loading branch information
1 parent
873df03
commit 456679d
Showing
12 changed files
with
694 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM ubcctlt/barman | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y openssh-server && \ | ||
apt-get clean | ||
# Permit root login via SSH | ||
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
RUN sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config | ||
|
||
# SSH port | ||
EXPOSE 22 | ||
COPY barman_entrypoint.sh /barman_entrypoint.sh | ||
RUN chmod +x /barman_entrypoint.sh | ||
RUN mkdir -p /run/sshd | ||
ENTRYPOINT ["tini","--","/barman_entrypoint.sh"] | ||
CMD ["cron", "-L", "4", "-f"] |
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,23 @@ | ||
#!/usr/bin/env bash | ||
# copy ssh keys to root and barman users | ||
set -ex | ||
if [ -d "/tmp/ssh/" ]; then | ||
cp -R /tmp/ssh/ /root/.ssh/ | ||
chmod 700 /root/.ssh | ||
chmod 644 /root/.ssh/id_rsa.pub | ||
chmod 600 /root/.ssh/id_rsa | ||
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys | ||
chmod 600 /root/.ssh/authorized_keys | ||
cp -R /tmp/ssh/* ~barman/.ssh/ | ||
ls -alh ~barman/.ssh/ | ||
ls -alh /tmp/ssh/ | ||
ls -alh /root/.ssh/ | ||
chown barman:barman -R ~barman/.ssh/ | ||
su - barman -c "chmod 700 ~barman/.ssh \ | ||
&& chmod 644 ~barman/.ssh/id_rsa.pub \ | ||
&& chmod 600 ~barman/.ssh/id_rsa \ | ||
&& cat ~barman/.ssh/id_rsa.pub >> ~barman/.ssh/authorized_keys \ | ||
&& chmod 600 ~barman/.ssh/authorized_keys" | ||
/usr/sbin/sshd | ||
fi | ||
exec /entrypoint.sh "$@" |
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,23 @@ | ||
#!/usr/bin/env bash | ||
# copy ssh keys to root and postgres users | ||
set -e | ||
if [ -d "/tmp/ssh/" ]; then | ||
cp -R /tmp/ssh/ /root/.ssh/ | ||
chmod 700 /root/.ssh | ||
chmod 644 /root/.ssh/id_rsa.pub | ||
chmod 600 /root/.ssh/id_rsa | ||
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys | ||
chmod 600 /root/.ssh/authorized_keys | ||
cp -R /tmp/ssh/ ~postgres/.ssh/ | ||
echo -e > ~postgres/.ssh/config "Host *\n\tStrictHostKeyChecking no" # prevent barman commands failing when using ssh | ||
chown postgres:postgres -R ~postgres/.ssh/ | ||
su - postgres -c "chmod 700 ~postgres/.ssh \ | ||
&& chmod 644 ~postgres/.ssh/id_rsa.pub \ | ||
&& chmod 600 ~postgres/.ssh/id_rsa \ | ||
&& chmod 600 ~postgres/.ssh/config \ | ||
&& cat ~postgres/.ssh/id_rsa.pub >> ~postgres/.ssh/authorized_keys \ | ||
&& chmod 600 ~postgres/.ssh/authorized_keys" | ||
/usr/sbin/sshd #start the ssh server | ||
fi | ||
|
||
exec /usr/local/bin/docker-entrypoint.sh "$@" |
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,24 @@ | ||
; Commented lines show the default values | ||
|
||
[barman] | ||
; archiver = off | ||
; backup_method = rsync | ||
; backup_directory = %(barman_home)s/%(name)s | ||
|
||
; This must be set to the BARMAN_DATA_DIR environment variable | ||
barman_home = /var/lib/barman | ||
|
||
; barman_lock_directory = %(barman_home)s | ||
compression = gzip | ||
configuration_files_direct | ||
ory = /etc/barman/barman.d | ||
;last_backup_maximum_age = 1 week | ||
log_file = /var/lib/barman/barman.log | ||
log_level = DEBUG | ||
;minimum_redundancy = 1 | ||
network_compression = true | ||
retention_policy = RECOVERY WINDOW of 4 WEEKS | ||
; retention_policy_mode = auto | ||
reuse_backup = link | ||
streaming_archiver = on | ||
; wal_retention_policy = main |
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,33 @@ | ||
[pg] | ||
; active = true | ||
; archiver = off | ||
; archiver_batch_size = 0 | ||
; backup_directory = %(barman_home)s/%(name)s | ||
backup_method = postgres | ||
; backup_options = | ||
; basebackup_retry_sleep = 30 | ||
; basebackup_retry_times = 0 | ||
; basebackups_directory = %(backup_directory)s/base | ||
; check_timeout = 30 | ||
conninfo = host=pg user=barman dbname=postgres | ||
description = 'warpsql database' | ||
; disabled = false | ||
; errors_directory = %(backup_directory)s/errors | ||
; immediate_checkpoint = false | ||
; incoming_wals_directory = %(backup_directory)s/incoming | ||
; minimum_redundancy = 0 | ||
; network_compression = false | ||
; path_prefix = /usr/lib/postgresql/9.5 | ||
; recovery_options = | ||
; retention_policy_mode = auto | ||
; ssh_command = 'ssh -i /home/barman/.ssh/pg.id_rsa postgres@pg' | ||
slot_name = barman | ||
create_slot = auto | ||
streaming_archiver = on | ||
; streaming_archiver_batch_size = 0 | ||
; streaming_archiver_name = barman_receive_wal | ||
; streaming_backup_name = barman_streaming_backup | ||
streaming_conninfo = host=pg user=streaming_barman dbname=postgres | ||
; streaming_wals_directory = %(backup_directory)s/streaming | ||
; wal_retention_policy = main | ||
; wals_directory = %(backup_directory)s/wals' |
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,3 @@ | ||
# !/bin/bash | ||
set -e | ||
echo "host replication all all scram-sha-256" >> /var/lib/postgresql/data/pg_hba.conf |
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,2 @@ | ||
CREATE USER barman WITH SUPERUSER PASSWORD 'barman'; | ||
CREATE USER streaming_barman WITH REPLICATION PASSWORD 'streaming_barman'; |
Oops, something went wrong.