Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sheetstorm-deployment/configure-sheetstorm-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- consts.yml
- versions.yml
- ../../sheetstorm-config/var.yml
- ../../sheetstorm-secret/var.yml
vars:
server_configuration: remote
roles:
Expand Down Expand Up @@ -48,5 +49,11 @@
user: root
job: /usr/bin/certbot renew --quiet

- name: Add secret file that contain credentials to nginx endpoint with postgresql backups
copy:
src: "{{ sheetstorm_secret_dir}}/htpasswd"
dest: "/etc/nginx/htpasswd"
mode: 0644

- include_role:
name: configure_nginx
1 change: 1 addition & 0 deletions sheetstorm-deployment/consts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ static_file_dir: "{{ sheetstorm_dir }}/sheetstorm/static/"
django_fixtures_dir: "{{ sheetstorm_dir }}/sheetstorm/fixtures"
sheetstorm_virtualenv_dir: "{{ home_dir }}/virtualenv"
postgres_backup_public_key_dir: "{{ home_dir }}/.key"
postgres_backup_dir: "{{ home_dir }}/postgresql_backup"
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ server {

}

location /postgres-backup/ {
allow 172.30.2.1;
deny all;

limit_except GET { deny all; }
alias {{ postgres_backup_dir }}/;
}

location /static/ {
alias {{ static_file_dir }};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ server {
proxy_pass $sheetstorm_backend;

}

location /postgres-backup/ {
allow {{ allow_ip_to_postgres_backup_endpoint }};
deny all;
auth_basic "closed site";
auth_basic_user_file htpasswd;

limit_except GET { deny all; }
alias {{ postgres_backup_dir }}/;
}

location /static/ {
alias {{ static_file_dir }};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e

database_name="$1"
POSTGRESQL_BACKUP_DIR=~/postgresql_backup
POSTGRESQL_BACKUP_DIR={{ postgres_backup_dir }}
DATE=$(date +"%Y-%m-%d-%H:%M")
SHEETSTORM_VERSION="$(cd {{ sheetstorm_dir}}/; git describe --always --abbrev=16)"

Expand Down