Shelfzilla module finished, not tested yet
This commit is contained in:
parent
ba7dde6554
commit
d1c9ff5077
|
@ -1,2 +1,3 @@
|
|||
shelfzilla_base_path: /opt/shelfzilla
|
||||
shelfzillla_config_file: "{{ shelfzilla_base_path }}/shelfzilla.toml"
|
||||
system_init_path: /etc/init.d
|
|
@ -0,0 +1,11 @@
|
|||
local_environment: False
|
||||
filer_base_url: "https://media.shelfzilla.com/"
|
||||
logpath: "/var/log/shelfzilla"
|
||||
logfile: "{{ logpath }}/django.log"
|
||||
debug: "false"
|
||||
template_debug: "false"
|
||||
static_root: "/opt/shelfzilla/shelfzilla/static"
|
||||
static_url: "https://static.shelfzilla.com/"
|
||||
media_root: "/opt/media"
|
||||
media_url: "https://media.shelfzilla.com/"
|
||||
secret_key: "d279ffd2f5b0e3b825ad3ec2362210da"
|
|
@ -1 +1,12 @@
|
|||
local_environment: True
|
||||
local_environment: True
|
||||
filer_base_url: "https://media.shelfzilla.com/"
|
||||
logpath: "/var/log/shelfzilla"
|
||||
logfile: "{{ logpath }}/django.log"
|
||||
debug: "false"
|
||||
template_debug: "false"
|
||||
static_root: "/opt/shelfzilla/shelfzilla/static"
|
||||
static_url: "https://static.shelfzilla.com/"
|
||||
media_root: "/opt/media"
|
||||
media_url: "https://media.shelfzilla.com/"
|
||||
secret_key: "d279ffd2f5b0e3b825ad3ec2362210da"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
register: st
|
||||
|
||||
- name: Install Iptables statements
|
||||
file:
|
||||
copy:
|
||||
src=iptables
|
||||
dest=/etc/sysconfig/iptables
|
||||
sudo: yes
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQDTrqIau+Yww3BF9X4FiU+NW29QVPSe3Pp9I5W0ea8sDf8SUYol
|
||||
jBozV7zhIcHInAzEAzafGrFioX7rJWjMn+uVTVgngFQNy3mgvJXBpzJUkh0v/Eo3
|
||||
XMFpB8I1qP5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cNMTQxMTA5MTAwMTEyWhcNMTUxMTA5
|
||||
MTAwMTEyWjCBgjELMAkGA1UEBhMCRVMxDzANBgNVBAgMBk1hZHJpZDEPMA0GA1UE
|
||||
BwwGTWFkcmlkMRMwEQYDVQQKDApTaGVsZnppbGxhMRcwFQYDVQQDDA5zaGVsZnpp
|
||||
bGxhLmNvbTEjMCEGCSqGSIb3DQEJARYUc2hlbGZ6aWxsYUBnbWFpbC5jb20wgZ8w
|
||||
DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOuohq75jDDcEX1fgWJT41bb1BU9J7c
|
||||
+n0jlbR5rywN/xJRiiWMGjNXvOEhwcicDMQDNp8asWKhfuslaMyf65VNWCeAVA3L
|
||||
eaC8lcGnMlSSHS/8SjdcwWkHwjWo/knQiNdD6ZDSacPgxNIdsbDsgyF6I1d40sFR
|
||||
2K+FLlO7NDnBAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAxootiRyWVIgIaLAIDbGZ
|
||||
/l9n5UTSuk4ittSbkUrwnLubO9MxDx0Y8RUhksLn1wU88wVt/u65+kP36UdPvk1P
|
||||
km2azDwiJ1z5rVaJ/pLD6J8q2tJj79WQKpVZ7XTyoSwESCVokI/HR/OWzfb6tHHW
|
||||
lZfV+f9HBqxNuz7I87eNbBM=
|
||||
-----END CERTIFICATE-----
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
- debug: msg="Starting Shelfzilla module"
|
||||
- include: shelfzilla.yml
|
||||
- include: nginx.yml
|
||||
- include: post_nodejs.yml
|
||||
#- include: post_python.yml
|
||||
- include: post_python.yml
|
||||
#- include: postgre.yml
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: Install Shelfzilla vhost for Nginx
|
||||
template: src=shelfzilla.conf
|
||||
dest="/etc/nginx/conf.d/shelfzilla.conf"
|
||||
owner=root
|
||||
group=root
|
||||
mode=0755
|
||||
sudo: yes
|
||||
|
||||
- name: Create nginx ssl folder
|
||||
file: path='/etc/nginx/ssl'
|
||||
owner=nginx
|
||||
group=nginx
|
||||
mode=0775
|
||||
state=directory
|
||||
sudo: yes
|
||||
|
||||
- name: Install Shelfzilla SSL
|
||||
copy: src="{{ item }}"
|
||||
dest="/etc/nginx/ssl/{{ item }}"
|
||||
owner=nginx
|
||||
group=nginx
|
||||
mode=0644
|
||||
sudo: yes
|
||||
with_items:
|
||||
- shelfzilla.pem
|
||||
- shelfzilla.key
|
||||
|
|
@ -3,10 +3,18 @@
|
|||
executable="/usr/bin/pip2"
|
||||
sudo: yes
|
||||
|
||||
- name: Python Migrate
|
||||
shell: /usr/bin/python2.7 {{shelfzilla_base_path}}/manage.py migrate install --no-initial-data --settings=shelfzilla.settings.configfile
|
||||
- lineinfile: dest="{{shelfzilla_base_path}}/shelfzilla/settings/configfile.py"
|
||||
regexp="^(.*)os\.environ\[\'APP\_CONFIGFILE\'\](.*)$"
|
||||
state=present
|
||||
line="\'\1{{ shelfzillla_config_file }}\2\'"
|
||||
backrefs=yes
|
||||
sudo: yes
|
||||
|
||||
- name: Python Migrate
|
||||
shell: /usr/bin/python2.7 {{shelfzilla_base_path}}/manage.py migrate --no-initial-data --settings=shelfzilla.settings.configfile
|
||||
sudo: yes
|
||||
sudo_user: postgres
|
||||
|
||||
- name: Python Collectstatic
|
||||
shell: /usr/bin/python2.7 {{shelfzilla_base_path}}/manage.py collectstatic --clear --noinput --settings=shelfzilla.settings.configfile
|
||||
sudo: yes
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
---
|
||||
- name: Group Shelfzilla
|
||||
group: name=shelfzilla state=present
|
||||
sudo: yes
|
||||
|
||||
- name: User Shelfzilla
|
||||
user: name=shelfzilla comment="Shelfzilla" groups=shelfzilla,nginx,postgres
|
||||
sudo: yes
|
||||
|
||||
- name: Modify Nginx user
|
||||
user: name=nginx groups=shelfzilla,nginx,postgres
|
||||
sudo: yes
|
||||
|
||||
- name: Install shelfzilla RPM
|
||||
yum: pkg=shelfzilla state=installed
|
||||
sudo: yes
|
||||
|
@ -33,4 +45,44 @@
|
|||
with_items:
|
||||
- "{{shelfzilla_base_path}}/init/"
|
||||
sudo: yes
|
||||
when: st.stat.exists
|
||||
when: st.stat.exists
|
||||
|
||||
- name: Install Shelfzilla config file
|
||||
template: src=shelfzilla.toml
|
||||
dest="{{shelfzilla_base_path}}/shelfzilla.toml"
|
||||
owner=root
|
||||
group=root
|
||||
mode=0755
|
||||
sudo: yes
|
||||
|
||||
- name: Create necessary folders
|
||||
file: path="{{ item }}"
|
||||
owner=shelfzilla
|
||||
group=shelfzilla
|
||||
mode=0775
|
||||
state=directory
|
||||
sudo: yes
|
||||
with_items:
|
||||
- "{{ logpath }}"
|
||||
- "{{ static_root }}"
|
||||
- "{{ media_root }}"
|
||||
|
||||
- stat: path="{{ logfile }}"
|
||||
register: st
|
||||
|
||||
- name: Create Logfile
|
||||
file: path="{{ logfile }}"
|
||||
owner=root
|
||||
group=root
|
||||
mode=0666
|
||||
state=file
|
||||
sudo: yes
|
||||
when: not st.stat.exists
|
||||
|
||||
- name: Create Static base path
|
||||
file: path="{{ logpath }}"
|
||||
owner=root
|
||||
group=root
|
||||
mode=0755
|
||||
state=directory
|
||||
sudo: yes
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# Shelfzilla Vhost
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name shelfzilla.com www.shelfzilla.com;
|
||||
ssl_certificate ./ssl/shelfzilla.pem;
|
||||
ssl_certificate_key ./ssl/shelfzilla.key;
|
||||
client_max_body_size 10M;
|
||||
client_body_temp_path /tmp/;
|
||||
server_tokens off;
|
||||
|
||||
if ($host = 'www.shelfzilla.com') {
|
||||
return 301 $scheme://shelfzilla.com;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias {{ static_root }};
|
||||
expires 1d;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias {{ media_root }};
|
||||
expires 1d;
|
||||
}
|
||||
|
||||
location /files/ {
|
||||
alias {{ media_root }}/filer/public/;
|
||||
expires 31d;
|
||||
}
|
||||
|
||||
location /files/thumbnails/ {
|
||||
alias {{ media_root }}/filer/public/thumbnails/;
|
||||
expires 31d;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /landing {
|
||||
return 301 $scheme://$server_name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name media.shelfzilla.com;
|
||||
ssl_certificate ./ssl/shelfzilla.pem;
|
||||
ssl_certificate_key ./ssl/shelfzilla.key;
|
||||
|
||||
location / {
|
||||
alias {{ media_root }};
|
||||
expires 1d;
|
||||
}
|
||||
|
||||
location /files/ {
|
||||
alias {{ media_root }}/filer/public/;
|
||||
expires 31d;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name static.shelfzilla.com;
|
||||
ssl_certificate ./ssl/shelfzilla.pem;
|
||||
ssl_certificate_key ./ssl/shelfzilla.key;
|
||||
|
||||
location / {
|
||||
add_header 'Access-Control-Allow-Origin' "https://shelfzilla.com";
|
||||
alias {{ static_root }}/;
|
||||
expires 1d;
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
[Shelfzilla]
|
||||
name=Shelfzilla Awesome App
|
||||
baseurl=http://37.139.15.172/
|
||||
gpgcheck=0
|
||||
enabled=1
|
|
@ -0,0 +1,28 @@
|
|||
[global]
|
||||
database_url = "postgres:///shelfzilla"
|
||||
installed_apps = [
|
||||
"gunicorn",
|
||||
]
|
||||
|
||||
[filer]
|
||||
base_url = "{{ filer_base_url }}"
|
||||
|
||||
[log]
|
||||
logfile = "{{ logfile }}"
|
||||
|
||||
[overwrite]
|
||||
debug = {{ debug }}
|
||||
template_debug = {{template_debug}}
|
||||
|
||||
site_id = 1
|
||||
|
||||
static_root = "{{ static_root }}"
|
||||
static_url = "{{ static_url }}"
|
||||
|
||||
media_root = "{{ media_root }}"
|
||||
media_url = "{{ media_url }}"
|
||||
|
||||
secret_key = "{{ secret_key }}"
|
||||
|
||||
internal_ips = ["127.0.0.1"]
|
||||
allowed_hosts = ["shelfzilla.com"]
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
- debug: msg="Starting Shelfzilla Base module"
|
||||
- include: yum_repository.yml
|
||||
- include: nginx.yml
|
||||
- include: python.yml
|
||||
- include: nodejs.yml
|
||||
- include: postgre.yml
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- name: Install Nginx
|
||||
yum: pkg=nginx state=installed
|
||||
sudo: yes
|
||||
|
||||
- name: Install Nginx base template
|
||||
template:
|
||||
src=nginx.conf
|
||||
dest=/etc/nginx/nginx.conf
|
||||
backup=yes
|
||||
sudo: yes
|
|
@ -0,0 +1,39 @@
|
|||
# For more information on configuration, see:
|
||||
# * Official English Documentation: http://nginx.org/en/docs/
|
||||
# * Official Russian Documentation: http://nginx.org/ru/docs/
|
||||
|
||||
user shelfzilla;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log;
|
||||
#error_log /var/log/nginx/error.log notice;
|
||||
#error_log /var/log/nginx/error.log info;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
server_names_hash_bucket_size 128;
|
||||
#gzip on;
|
||||
|
||||
# Load config files from the /etc/nginx/conf.d directory
|
||||
# The default server is in conf.d/default.conf
|
||||
include /etc/nginx/conf.d/shelfzilla.conf;
|
||||
|
||||
}
|
Reference in New Issue