Browse Source

Merge pull request #239 from gelnior/master

Merge pull request #239
Alex Payne 10 years ago
parent
commit
f7874004e5

+ 1
- 0
README.textile View File

@@ -50,6 +50,7 @@ What do you get if you point this thing at a VPS? All kinds of good stuff!
50 50
 * "RFC6238":http://tools.ietf.org/html/rfc6238 two-factor authentication compatible with "Google Authenticator":http://en.wikipedia.org/wiki/Google_Authenticator and various hardware tokens
51 51
 * Nightly backups to "Tarsnap":https://www.tarsnap.com/.
52 52
 * Git hosting via "cgit":http://git.zx2c4.com/cgit/about/ and "gitolite":https://github.com/sitaramc/gitolite.
53
+* "Newebe":http://newebe.org, a social network.
53 54
 * A bunch of nice-to-have tools like "mosh":http://mosh.mit.edu and "htop":http://htop.sourceforge.net that make life with a server a little easier.
54 55
 
55 56
 No setup is perfect, but the general idea is to provide a bunch of useful services while being reasonably secure and low-maintenance. Set it up, SSH in every couple weeks, but mostly forget about it.

+ 5
- 0
roles/newebe/files/newebe.conf View File

@@ -0,0 +1,5 @@
1
+[program:newebe]
2
+autorestart=false
3
+command=newebe_server.py --configfile=/usr/local/etc/newebe/config.yaml
4
+redirect_stderr=true
5
+user=newebe

+ 7
- 0
roles/newebe/files/supervisor.conf View File

@@ -0,0 +1,7 @@
1
+; supervisor config file
2
+
3
+[supervisord]
4
+nodaemon=true
5
+
6
+[include]
7
+files = /etc/supervisor/conf.d/*.conf

+ 0
- 0
roles/newebe/handlers/main.yml View File


+ 84
- 0
roles/newebe/tasks/main.yml View File

@@ -0,0 +1,84 @@
1
+- name: Install Python
2
+  apt: pkg=python,python-setuptools,python-pip,python-dev
3
+
4
+- name: Install Python tools
5
+  apt: pkg=python-imaging,python-pycurl
6
+
7
+- name: Install build tools
8
+  apt: pkg=build-essential,git
9
+
10
+- name: Install Python libs
11
+  apt: pkg=libxml2-dev,libxslt-dev,python-imaging
12
+
13
+- name: Install Supervisor
14
+  apt: pkg=supervisor
15
+
16
+- name: Install CouchDB
17
+  apt: pkg=couchdb
18
+
19
+- name: Install Newebe
20
+  pip: name='git+https://github.com/gelnior/newebe.git#egg=newebe'
21
+
22
+- name: Add group Newebe
23
+  group: name=newebe
24
+
25
+- name: Add user Newebe
26
+  user: name=newebe shell=/bin/bash groups=newebe
27
+
28
+- name: Create Newebe Config folder
29
+  file: path=/usr/local/etc/newebe/ 
30
+        owner=newebe 
31
+        group=newebe 
32
+        state=directory
33
+
34
+- name: Create Newebe folder
35
+  file: path=/usr/local/var/newebe/ 
36
+        owner=newebe 
37
+        group=newebe 
38
+        state=directory
39
+
40
+- name: Create Newebe log folder
41
+  file: path=/usr/local/var/log/newebe/ 
42
+        owner=newebe 
43
+        group=newebe 
44
+        state=directory
45
+
46
+- name: Set Newebe config file
47
+  template: src=usr_local_etc_newebe_config.j2
48
+            dest=/usr/local/etc/newebe/config.yaml 
49
+            owner=newebe 
50
+            group=newebe
51
+
52
+- name: Set Supervisor config file
53
+  copy: src=newebe.conf dest=/etc/supervisor/conf.d/newebe.conf
54
+
55
+- name: Set Newebe Supervisor config file
56
+  copy: src=supervisor.conf dest=/etc/supervisor/supervisor.conf
57
+
58
+- name: Reload Supervisor and start Newebe
59
+  command: /usr/bin/supervisorctl update
60
+
61
+- name: Ensure that newebe is started
62
+  supervisorctl: name=newebe state=started
63
+
64
+- name: Add mod_proxy module to Apache
65
+  raw: a2enmod proxy
66
+# When Ansible 1.6 will be available  
67
+# apache2_module: state=present name=proxy
68
+
69
+- name: Add proxy_http module to Apache
70
+  raw: a2enmod proxy_http
71
+# When Ansible 1.6 will be available  
72
+# apache2_module: state=present name=proxy_http
73
+#
74
+- name: Configure the Apache HTTP server for Newebe
75
+  template: src=etc_apache2_sites-available_newebe.j2
76
+            dest=/etc/apache2/sites-available/newebe
77
+            group=www-data
78
+            owner=www-data
79
+  notify: restart apache
80
+
81
+- name: Enable the site
82
+  command: a2ensite newebe
83
+           creates=/etc/apache2/sites-enabled/newebe
84
+  notify: restart apache

+ 27
- 0
roles/newebe/templates/etc_apache2_sites-available_newebe.j2 View File

@@ -0,0 +1,27 @@
1
+<VirtualHost *:80>
2
+    ServerName {{ newebe_domain }}
3
+
4
+    Redirect permanent / https://{{ newebe_domain }}/
5
+</VirtualHost>
6
+
7
+<VirtualHost *:443>
8
+
9
+    ServerName {{ newebe_domain }}
10
+    SSLEngine On
11
+
12
+    SSLProtocol ALL -SSLv2
13
+    SSLHonorCipherOrder On
14
+    SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS
15
+    SSLCertificateFile /etc/ssl/certs/wildcard_public_cert.crt
16
+    SSLCertificateKeyFile /etc/ssl/private/wildcard_private.key
17
+    SSLCACertificateFile /etc/ssl/certs/wildcard_ca.pem
18
+    Header add Strict-Transport-Security "max-age=15768000; includeSubdomains"
19
+
20
+    ErrorLog /var/log/apache2/newebe.info-error_log
21
+    CustomLog /var/log/apache2/newebe.info-access_log common
22
+
23
+
24
+    ProxyPass / http://127.0.0.1:8282/
25
+    ProxyPassReverse / http://127.0.0.1:8282/
26
+
27
+</VirtualHost>

+ 7
- 0
roles/newebe/templates/usr_local_etc_newebe_config.j2 View File

@@ -0,0 +1,7 @@
1
+main:
2
+    port: 8282
3
+    debug: False
4
+    ssl: False
5
+    path: "/usr/local/var/newebe/"
6
+    logpath: "/usr/local/var/log/newebe"
7
+    timezone: {{ zpush_timezone }}

+ 1
- 0
site.yml View File

@@ -22,3 +22,4 @@
22 22
     - tarsnap
23 23
     - news
24 24
     - git
25
+    - newebe

+ 3
- 0
vars/defaults.yml View File

@@ -105,3 +105,6 @@ selfoss_db_database: selfoss
105 105
 cgit_version: 0.10.1
106 106
 cgit_domain: "git.{{ domain }}"
107 107
 gitolite_version: 3.5.3.1
108
+ 
109
+# newebe
110
+newebe_domain: "newebe.{{ domain }}"

Loading…
Cancel
Save