mirror of
https://github.com/viq/NewsBlur.git
synced 2025-11-11 00:41:01 +00:00
Deployment of compressed static assets through S3.
This commit is contained in:
parent
7d1fdb330a
commit
70ba058aa4
5 changed files with 89 additions and 2 deletions
2
Makefile
2
Makefile
|
|
@ -88,6 +88,8 @@ push: build_images push_images
|
|||
# Tasks
|
||||
deploy_web:
|
||||
- ansible-playbook ansible/deploy_app.yml
|
||||
deploy_static:
|
||||
- ansible-playbook ansible/deploy_app.yml --tags static
|
||||
deploy: deploy_web
|
||||
deploy_node:
|
||||
- ansible-playbook ansible/deploy_node.yml
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ inventory = /srv/newsblur/ansible/inventories/digital_ocean.ini, /srv/newsblur/a
|
|||
private_key_file = /srv/secrets-newsblur/keys/docker.key
|
||||
remote_tmp = ~/.ansible/tmp
|
||||
forks = 20
|
||||
interpreter_python = python3
|
||||
|
||||
[inventory]
|
||||
enable_plugins = ini, constructed
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- hosts: app
|
||||
- hosts: app,staging
|
||||
gather_facts: false
|
||||
# serial: "50%"
|
||||
vars_files:
|
||||
|
|
@ -11,12 +11,73 @@
|
|||
# command: consul leave
|
||||
# ignore_errors: yes
|
||||
|
||||
- name: Compressing JS/CSS assets
|
||||
run_once: yes
|
||||
connection: local
|
||||
command: chdir=/srv/newsblur jammit -c /srv/newsblur/newsblur_web/assets.yml --base-url https://www.newsblur.com --output /srv/newsblur/static
|
||||
tags:
|
||||
- never
|
||||
- static
|
||||
- jammit
|
||||
|
||||
- name: Archive JS/CSS assets for uploading
|
||||
run_once: yes
|
||||
connection: local
|
||||
archive:
|
||||
path: /srv/newsblur/static/
|
||||
dest: /srv/newsblur/static.tgz
|
||||
tags:
|
||||
- never
|
||||
- static
|
||||
|
||||
- name: Uploading JS/CSS assets to S3
|
||||
run_once: yes
|
||||
connection: local
|
||||
amazon.aws.aws_s3:
|
||||
bucket: newsblur_backups
|
||||
object: /static_py3.tgz
|
||||
src: /srv/newsblur/static.tgz
|
||||
mode: put
|
||||
overwrite: different
|
||||
aws_access_key: "{{ lookup('ini', 'aws_access_key_id section=default file=/srv/secrets-newsblur/keys/aws.s3.token') }}"
|
||||
aws_secret_key: "{{ lookup('ini', 'aws_secret_access_key section=default file=/srv/secrets-newsblur/keys/aws.s3.token') }}"
|
||||
tags:
|
||||
- never
|
||||
- static
|
||||
|
||||
- name: Pull newsblur_web github
|
||||
git:
|
||||
repo: https://github.com/samuelclay/NewsBlur.git
|
||||
dest: /srv/newsblur/
|
||||
version: dashboard3
|
||||
register: pulled
|
||||
tags:
|
||||
- static
|
||||
|
||||
- name: Downloading JS/CSS assets from S3
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
amazon.aws.aws_s3:
|
||||
bucket: newsblur_backups
|
||||
object: /static_py3.tgz
|
||||
dest: /srv/newsblur/static/static.tgz
|
||||
mode: get
|
||||
overwrite: different
|
||||
aws_access_key: "{{ lookup('ini', 'aws_access_key_id section=default file=/srv/secrets-newsblur/keys/aws.s3.token') }}"
|
||||
aws_secret_key: "{{ lookup('ini', 'aws_secret_access_key section=default file=/srv/secrets-newsblur/keys/aws.s3.token') }}"
|
||||
tags:
|
||||
- never
|
||||
- static
|
||||
register: jscss_updated
|
||||
|
||||
- name: Decompress downloaded JS/CSS
|
||||
unarchive:
|
||||
src: /srv/newsblur/static.tgz
|
||||
dest: /srv/newsblur/static
|
||||
when: jscss_updated is succeeded
|
||||
tags:
|
||||
- never
|
||||
- static
|
||||
|
||||
- name: Reload gunicorn
|
||||
become: yes
|
||||
|
|
@ -27,6 +88,8 @@
|
|||
- name: Reload gunicorn
|
||||
command: "kill -HUP {{ psaux.stdout }}"
|
||||
# when: pulled.changed
|
||||
tags:
|
||||
- static
|
||||
|
||||
- name: Start Consul
|
||||
become: yes
|
||||
|
|
|
|||
|
|
@ -17,6 +17,27 @@
|
|||
path: /srv/newsblur/newsblur_web/local_settings.py
|
||||
line: 'SERVER_NAME = "{{ inventory_hostname }}"'
|
||||
|
||||
- name: Ensure static dir exists
|
||||
file:
|
||||
path: /srv/newsblur/static
|
||||
state: directory
|
||||
tags:
|
||||
- static
|
||||
|
||||
- name: Install pip
|
||||
become: yes
|
||||
apt: name=python3-pip state=latest
|
||||
tags:
|
||||
- static
|
||||
|
||||
- name: Install boto3 and botocore with pip3 module
|
||||
pip:
|
||||
name:
|
||||
- boto3
|
||||
- botocore
|
||||
tags:
|
||||
- static
|
||||
|
||||
- name: Start NewsBlur Web Docker container
|
||||
become: yes
|
||||
docker_container:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ css_compressor: yui
|
|||
template_function: _.template
|
||||
|
||||
# Location of static assets relative to CWD.
|
||||
public_root: "."
|
||||
public_root: /srv/newsblur/
|
||||
|
||||
# Package data-uri and mhtml variants of stylesheets, with whitelisted
|
||||
# images embedded inline.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue