Get S3 working and add configuration edits to support desktop clients

This commit is contained in:
Erik Stambaugh 2022-01-02 20:07:34 -08:00
parent eda567fc81
commit 6449f80800
5 changed files with 29 additions and 2 deletions

View file

@ -10,6 +10,7 @@ ssh: setup
setup: setup:
$(eval INSTANCE := $(shell terraform output instance_id | sed -e 's/"//g')) $(eval INSTANCE := $(shell terraform output instance_id | sed -e 's/"//g'))
$(eval PUBLIC_IP := $(shell terraform output public_ip | sed -e 's/"//g')) $(eval PUBLIC_IP := $(shell terraform output public_ip | sed -e 's/"//g'))
$(eval BUCKET := $(shell terraform output bucket | sed -e 's/"//g'))
chmod 600 privkey.pem chmod 600 privkey.pem
ansible: setup ansible: setup
@ -18,6 +19,7 @@ ansible: setup
sed \ sed \
-e 's/{{INSTANCE}}/$(INSTANCE)/' \ -e 's/{{INSTANCE}}/$(INSTANCE)/' \
-e 's/{{PUBLIC_IP}}/$(PUBLIC_IP)/' \ -e 's/{{PUBLIC_IP}}/$(PUBLIC_IP)/' \
-e 's/{{BUCKET}}/$(BUCKET)/' \
inventory.tmpl.ini > inventory.ini inventory.tmpl.ini > inventory.ini
ansible-playbook -i inventory.ini --private-key privkey.pem -l nextcloud site.yaml ansible-playbook -i inventory.ini --private-key privkey.pem -l nextcloud site.yaml

View file

@ -1,4 +1,4 @@
[nextcloud] [nextcloud]
nextcloud ansible_host={{INSTANCE}} ansible_user=ubuntu hostname=nextcloud public_ip={{PUBLIC_IP}} nextcloud ansible_host={{INSTANCE}} ansible_user=ubuntu hostname=nextcloud public_ip={{PUBLIC_IP}} bucket={{BUCKET}}
[nextcloud:vars] [nextcloud:vars]
ansible_ssh_common_args=-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="sh -c \"aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=%p\"" ansible_ssh_common_args=-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="sh -c \"aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=%p\""

View file

@ -205,5 +205,8 @@ output "public_ip" {
output "nameservers" { output "nameservers" {
value = module.zone.route53_zone_name_servers value = module.zone.route53_zone_name_servers
} }
output "bucket" {
value = module.s3_bucket.s3_bucket_id
}

View file

@ -127,12 +127,32 @@
args: args:
chdir: /srv/nextcloud chdir: /srv/nextcloud
- name: restart nextcloud - name: restart via docker-compose
command: docker-compose restart command: docker-compose restart
args: args:
chdir: /srv/nextcloud chdir: /srv/nextcloud
when: nginxconf.changed or certbotnginx.changed when: nginxconf.changed or certbotnginx.changed
# ---
- name: edit config.php
lineinfile:
path: /srv/nextcloud/www/config/config.php
insertbefore: '^\);'
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- regexp: " 'overwrite.cli.url' => .*"
line: " 'overwrite.cli.url' => 'https://cloud.stoopid.club',"
- regexp: " 'overwriteprotocol' => .*"
line: " 'overwriteprotocol' => 'https',"
- regexp: " 'overwritehost' => .*"
line: " 'overwritehost' => 'cloud.stoopid.club',"
register: configphp
- name: restart nextcloud
command: docker restart nextcloud
when: configphp.changed
# --- # ---

View file

@ -29,6 +29,8 @@ services:
- "MYSQL_PASSWORD={{mysql_password}}" - "MYSQL_PASSWORD={{mysql_password}}"
- "MYSQL_USER={{mysql_user}}" - "MYSQL_USER={{mysql_user}}"
- "MYSQL_HOST={{mysql_host}}" - "MYSQL_HOST={{mysql_host}}"
- "OBJECTSTORE_S3_BUCKET={{bucket}}"
- "OBJECTSTORE_S3_REGION=us-west-2"
- "TRUSTED_PROXIES=172.0.0.0/8" - "TRUSTED_PROXIES=172.0.0.0/8"
- "NEXTCLOUD_TRUSTED_DOMAINS=cloud.stoopid.club nextcloud" - "NEXTCLOUD_TRUSTED_DOMAINS=cloud.stoopid.club nextcloud"
- "NEXTCLOUD_UPDATE=1" - "NEXTCLOUD_UPDATE=1"