aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-04-10 02:07:48 -0400
committerbnewbold <bnewbold@robocracy.org>2016-04-10 02:07:48 -0400
commit5b149a4482ad11db8871368f3b616681536f5872 (patch)
treecefdcde4fd012c8fdc3e617219d2fe4f9405e770
parente79a42d63fe270875cab7773ecd7688870dfb829 (diff)
downloadinfra-5b149a4482ad11db8871368f3b616681536f5872.tar.gz
infra-5b149a4482ad11db8871368f3b616681536f5872.zip
mediagoblin: moving closer to HEAD
-rw-r--r--roles/mediagoblin/defaults/main.yml10
-rw-r--r--roles/mediagoblin/tasks/main.yml82
-rw-r--r--roles/mediagoblin/tasks/ubuntu.yml0
-rw-r--r--roles/mediagoblin/templates/etc_nginx_sites-available_mediagoblin.j249
4 files changed, 108 insertions, 33 deletions
diff --git a/roles/mediagoblin/defaults/main.yml b/roles/mediagoblin/defaults/main.yml
index 351f58a..9983bfb 100644
--- a/roles/mediagoblin/defaults/main.yml
+++ b/roles/mediagoblin/defaults/main.yml
@@ -1,4 +1,6 @@
-top_directory: /srv/mediagoblin
-deploy_directory: "{{ top_directory }}/mediagoblin"
-user: mediagoblin
-git_uri: git://gitorious.org/mediagoblin/mediagoblin.git \ No newline at end of file
+
+mediagoblin_hotname: {{ ansible_nodename }}
+mediagoblin_basedir: /srv/mediagoblin
+mediagoblin_user: mediagoblin
+mediagoblin_git_uri: git://git.savannah.gnu.org/mediagoblin.git
+mediagoblin_git_tag: v0.9.0
diff --git a/roles/mediagoblin/tasks/main.yml b/roles/mediagoblin/tasks/main.yml
index caddf4d..a5ce476 100644
--- a/roles/mediagoblin/tasks/main.yml
+++ b/roles/mediagoblin/tasks/main.yml
@@ -1,63 +1,87 @@
-- name: Install mediagoblin dependencies
+ name: Install mediagoblin dependencies
apt: name={{item}} state=installed
with_items:
- - git-core
- - python
- - python-dev
- - python-lxml
- - python-imaging
- - python-virtualenv
- - nginx-full
+ - python3-dev
+ - python3-lxml
+ - python3-imaging
+ - python3-virtualenv
+ - automake
tags:
- dependencies
-
-- NAME: create mediagoblin user
- user: name={{ mediagoblin_user }} system=yes state=present
+- name: Create mediagoblin user
+ user: name={{ mediagoblin_user }}
+ createhome=yes
+ groups=www-data
+ system=yes
+ home=/var/lib/mediagoblin
+ state=present
- name: Create deploy directory
- file: name={{deploy_directory}} state=directory owner={{user}}
+ file: name={{ mediagoblin_basedir }}
+ state=directory
+ owner={{ mediagoblin_user }}
+
+- name: Create user data directory
+ file: name={{ mediagoblin_basedir }}/data
+ state=directory
+ chmod=0750
+ owner={{ mediagoblin_user }}
- name: Checkout git
- git: repo={{git_uri}} dest={{deploy_directory}} accept_hostkey=yes
+ git: repo={{ mediagoblin_git_uri }}
+ dest={{ mediagoblin_basedir }}/src
+ tag={{ mediagoblin_git_tag }}
+ accept_hostkey=yes
sudo: yes
- sudo_user: "{{ user }}"
+ sudo_user: "{{ mediagoblin_user }}"
- name: git submodules
shell:
git submodule update --init --recursive
- chdir="{{deploy_directory}}"
- creates="{{deploy_directory}}/.gitmodules"
+ chdir="{{mediagoblin_basedir}}/src"
+ creates="{{mediagoblin_basedir}}/src/.gitmodules"
sudo: yes
- sudo_user: "{{ user }}"
+ sudo_user: "{{ mediagoblin_user }}"
- name: Create virtualenv
shell:
- virtualenv --python=python2 --system-site-packages .
- chdir="{{deploy_directory}}"
- creates="{{deploy_directory}}/bin/python"
+ virtualenv --python=python3 --system-site-packages .
+ chdir="{{mediagoblin_basedir}}/src"
+ creates="{{mediagoblin_basedir}}/src/bin/python"
sudo: yes
- sudo_user: "{{ user }}"
+ sudo_user: "{{ mediagoblin_user }}"
- name: Build mediagoblin
shell:
- ./bin/python setup.py develop
- chdir="{{deploy_directory}}"
- creates="{{deploy_directory}}/mediagoblin.egg-info"
+ ./bootstrap.sh && ./configure –with-python3 && make
+ chdir="{{mediagoblin_basedir }}/src"
+ creates="{{mediagoblin_basedir}}/src/mediagoblin.egg-info"
sudo: yes
- sudo_user: "{{ user }}"
+ sudo_user: "{{ mediagoblin_user }}"
- name: Install flup
easy_install:
name=flup
- virtualenv="{{deploy_directory}}"
+ virtualenv="{{ mediagoblin_basedir }}"
sudo: yes
- sudo_user: "{{ user }}"
+ sudo_user: "{{ mediagoblin_user }}"
- name: Update DB
shell:
./bin/gmg dbupdate
- chdir="{{deploy_directory}}"
+ chdir="{{ mediagoblin_basedir }}/src"
sudo: yes
- sudo_user: "{{ user }}"
+ sudo_user: "{{ mediagoblin_user }}"
+
+- name: Copy generic mediagoblin nginx site configuration
+ template: src=etc_nginx_sites-available_mediagoblin.j2
+ dest=/etc/nginx/sites-available/mediagoblin
+
+- name: Create nginx symlink for default
+ file: state=link
+ src=/etc/nginx/sites-available/mediagoblin
+ dest=/etc/nginx/sites-enabled/mediagoblin
+ notify: nginx restart # reload not sufficient?
+
diff --git a/roles/mediagoblin/tasks/ubuntu.yml b/roles/mediagoblin/tasks/ubuntu.yml
deleted file mode 100644
index e69de29..0000000
--- a/roles/mediagoblin/tasks/ubuntu.yml
+++ /dev/null
diff --git a/roles/mediagoblin/templates/etc_nginx_sites-available_mediagoblin.j2 b/roles/mediagoblin/templates/etc_nginx_sites-available_mediagoblin.j2
new file mode 100644
index 0000000..5a2c9ba
--- /dev/null
+++ b/roles/mediagoblin/templates/etc_nginx_sites-available_mediagoblin.j2
@@ -0,0 +1,49 @@
+
+server {
+
+ listen 80;
+ listen [::]:80;
+ server_name {{ mediagoblin_hostname }};
+
+ # Change this to update the upload size limit for your users
+ client_max_body_size 8m;
+
+ # prevent attacks (someone uploading a .txt file that the browser
+ # interprets as an HTML file, etc.)
+ add_header X-Content-Type-Options nosniff;
+
+ server_name mediagoblin.example.org www.mediagoblin.example.org;
+ access_log /var/log/nginx/mediagoblin.example.access.log;
+ error_log /var/log/nginx/mediagoblin.example.error.log;
+
+ # MediaGoblin's stock static files: CSS, JS, etc.
+ location /mgoblin_static/ {
+ alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
+ }
+
+ # Instance specific media:
+ location /mgoblin_media/ {
+ alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
+ }
+
+ # Theme static files (usually symlinked in)
+ location /theme_static/ {
+ alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
+ }
+
+ # Plugin static files (usually symlinked in)
+ location /plugin_static/ {
+ alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
+ }
+
+ # Mounting MediaGoblin itself via FastCGI.
+ location / {
+ fastcgi_pass 127.0.0.1:26543;
+ include /etc/nginx/fastcgi_params;
+
+ # our understanding vs nginx's handling of script_name vs
+ # path_info don't match :)
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME "";
+ }
+}