ソースを参照

Use Nextcloud instead of Owncloud.

Thomas Buck 5年前
コミット
7aa67f1506

+ 2
- 10
README.md ファイルの表示

@@ -25,8 +25,7 @@ What do you get if you point Sovereign at a server? All kinds of good stuff!
25 25
 -   Email client [automatic configuration](https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration).
26 26
 -   Jabber/[XMPP](http://xmpp.org/) instant messaging via [Prosody](http://prosody.im/).
27 27
 -   An RSS Reader via [Selfoss](http://selfoss.aditu.de/).
28
--   [CalDAV](https://en.wikipedia.org/wiki/CalDAV) and [CardDAV](https://en.wikipedia.org/wiki/CardDAV) to keep your calendars and contacts in sync, via [ownCloud](http://owncloud.org/).
29
--   Your own private storage cloud via [ownCloud](http://owncloud.org/).
28
+-   [CalDAV](https://en.wikipedia.org/wiki/CalDAV) and [CardDAV](https://en.wikipedia.org/wiki/CardDAV) to keep your calendars and contacts in sync, via [NextCloud](http://nextcloud.com/).
30 29
 -   Your own VPN server via [OpenVPN](http://openvpn.net/index.php/open-source.html).
31 30
 -   An IRC bouncer via [ZNC](http://wiki.znc.in/ZNC).
32 31
 -   [Monit](http://mmonit.com/monit/) to keep everything running smoothly (and alert you when it’s not).
@@ -117,7 +116,7 @@ Create `A` or `CNAME` records which point to your server's IP address:
117 116
 * `autoconfig.example.com` (for email client automatic configuration)
118 117
 * `fathom.example.com` (for web stats)
119 118
 * `news.example.com` (for Selfoss)
120
-* `cloud.example.com` (for ownCloud)
119
+* `cloud.example.com` (for NextCloud)
121 120
 
122 121
 ### 6. Run the Ansible Playbooks
123 122
 
@@ -163,13 +162,6 @@ Similarly, to access the server monitoring page, use another SSH tunnel:
163 162
 
164 163
 Again proceeding to http://localhost:2812 in your web browser.
165 164
 
166
-Finally, sign into ownCloud with a new administrator account to set it
167
-up. You should select PostgreSQL as the configuration backend. Use
168
-`owncloud` as the database user and the database name. For the
169
-database password ansible has created a set of random passwords for
170
-each service and stores them in your local folder `secret`, use the
171
-one in the file `owncloud_db_password`.
172
-
173 165
 How To Use Your New Personal Cloud
174 166
 ----------------------------------
175 167
 

+ 22
- 0
roles/nextcloud/defaults/main.yml ファイルの表示

@@ -0,0 +1,22 @@
1
+secret_root: '{{ inventory_dir | realpath }}'
2
+secret_name: 'secret'
3
+secret: '{{ secret_root + "/" + secret_name }}'
4
+
5
+nextcloud_subdomain: "cloud"
6
+nextcloud_domain: "{{ nextcloud_subdomain }}.{{ domain }}"
7
+
8
+# When you increase the version, run this manually after installing / upgrading:
9
+#  cd /var/www/nextcloud
10
+#  sudo -u www-data php occ upgrade
11
+nextcloud_version: "15.0.5"
12
+
13
+nextcloud_admin_username: "{{ main_user_name }}"
14
+nextcloud_admin_password: "{{ lookup('password', secret + '/' + 'nextcloud_admin_password length=32') }}"
15
+
16
+nextcloud_db_username: nextclouduser
17
+nextcloud_db_password: "{{ lookup('password', secret + '/' + 'nextcloud_db_password length=32') }}"
18
+nextcloud_db_database: nextcloud
19
+
20
+# must match values in roles/common
21
+db_admin_username: 'postgres'
22
+db_admin_password: "{{ lookup('password', secret + '/' + 'db_admin_password length=32') }}"

+ 2
- 0
roles/nextcloud/handlers/main.yml ファイルの表示

@@ -0,0 +1,2 @@
1
+- name: restart apache
2
+  service: name=apache2 state=restarted

+ 1
- 0
roles/nextcloud/tasks/main.yml ファイルの表示

@@ -0,0 +1 @@
1
+- include: nextcloud.yml tags=nextcloud

+ 118
- 0
roles/nextcloud/tasks/nextcloud.yml ファイルの表示

@@ -0,0 +1,118 @@
1
+---
2
+# Installs the nextcloud personal cloud software.
3
+
4
+- name: Install NextCloud dependencies
5
+  apt:
6
+    name: "{{ packages }}"
7
+    state: present
8
+  vars:
9
+    packages:
10
+    - php
11
+    - php-pgsql
12
+    - php-fpm
13
+    - php-apcu
14
+    - php-imap
15
+    - php-imagick
16
+    - php-redis
17
+    - php-mcrypt
18
+    - php-xml
19
+    - php-zip
20
+    - php-mbstring
21
+    - php-gd
22
+    - php-json
23
+    - php-curl
24
+    - php-intl
25
+    - curl
26
+    - unzip  
27
+  tags:
28
+    - dependencies
29
+
30
+- name: Create NextCloud temp directory
31
+  file: path=/root/nextcloud state=directory
32
+
33
+- name: Download NextCloud {{ nextcloud_version }}
34
+  get_url:
35
+    url=https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.zip
36
+    dest=/root/nextcloud/nextcloud-{{ nextcloud_version }}.zip
37
+
38
+- name: Create NextCloud unpack directory
39
+  file: path=/root/nextcloud/nextcloud-{{ nextcloud_version }} state=directory
40
+
41
+- name: Extract NextCloud archive
42
+  unarchive:
43
+    copy: no
44
+    src: /root/nextcloud/nextcloud-{{ nextcloud_version }}.zip
45
+    dest: /root/nextcloud/nextcloud-{{ nextcloud_version }}/
46
+    creates: /root/nextcloud-{{ nextcloud_version }}/index.php
47
+
48
+- name: Back-Up old NextCloud config
49
+  shell: cp -r /var/www/nextcloud/config/config.php /root/nextcloud/config.php.bak || true
50
+
51
+- name: Delete old NextCloud document root
52
+  file: path=/var/www/nextcloud state=absent
53
+
54
+- name: Copy NextCloud source to document root
55
+  shell: cp -r /root/nextcloud/nextcloud-{{ nextcloud_version }}/nextcloud /var/www/nextcloud
56
+
57
+- name: Delete empty NextCloud config
58
+  file: path=/var/www/nextcloud/config/config.php state=absent
59
+
60
+- name: Restore old NextCloud config
61
+  shell: cp -r /root/nextcloud/config.php.bak /var/www/nextcloud/config/config.php || true
62
+
63
+- name: Delete old NextCloud source
64
+  file: path=/root/nextcloud state=absent
65
+
66
+- name: Create database user for NextCloud
67
+  postgresql_user:
68
+    login_host=localhost
69
+    login_user={{ db_admin_username }}
70
+    login_password="{{ db_admin_password }}"
71
+    name={{ nextcloud_db_username }}
72
+    password="{{ nextcloud_db_password }}"
73
+    role_attr_flags=CREATEDB
74
+    state=present
75
+
76
+- name: Create NextCloud data directory
77
+  file: path=/data/nextcloud-data state=directory owner=www-data group=www-data
78
+
79
+- name: Set NextCloud ownership
80
+  action: file owner=www-data group=www-data path=/var/www/nextcloud recurse=yes state=directory
81
+
82
+- name: Run NextCloud installer
83
+  become: true
84
+  become_user: www-data
85
+  command: php occ maintenance:install --no-interaction --data-dir "/data/nextcloud-data" --database "pgsql" --database-name "{{ nextcloud_db_database }}" --database-user "{{ nextcloud_db_username }}" --database-pass "{{ nextcloud_db_password }}" --admin-user "{{ nextcloud_admin_username }}" --admin-pass "{{ nextcloud_admin_password }}"
86
+  args:
87
+    chdir: /var/www/nextcloud
88
+    creates: /var/www/nextcloud/config/config.php
89
+
90
+- name: Add our domains to the NextCloud trusted domains
91
+  lineinfile:
92
+    path: /var/www/nextcloud/config/config.php
93
+    insertafter: 'instanceid'
94
+    line: "  'trusted_domains' => array ('localhost', {{ virtual_domains | json_query('[*].name') | map('regex_replace', '(.*)', \"'cloud.\\1'\") | join(', ') }}),"
95
+
96
+- name: Create the Apache sites config files
97
+  template:
98
+    src=etc_apache2_sites-available_nextcloud.j2
99
+    dest=/etc/apache2/sites-available/nextcloud_{{ item.name }}.conf
100
+    owner=root
101
+    group=root
102
+  with_items: "{{ virtual_domains }}"
103
+
104
+- name: Remove old sites-enabled symlinks (new ones will be created by a2ensite)
105
+  file: path=/etc/apache2/sites-enabled/nextcloud_{{ item }}.conf state=absent
106
+  with_items: "{{ virtual_domains | json_query('[*].name') }}"
107
+
108
+- name: Enable Apache sites (creates new sites-enabled symlinks)
109
+  command: a2ensite nextcloud_{{ item }}.conf creates=/etc/apache2/sites-enabled/nextcloud_{{ item }}.conf
110
+  notify: restart apache
111
+  with_items: "{{ virtual_domains | json_query('[*].name') }}"
112
+
113
+- name: Install NextCloud cronjob
114
+  cron:
115
+    name="nextcloud"
116
+    user="www-data"
117
+    minute="*/5"
118
+    job="php -f /var/www/nextcloud/cron.php > /dev/null"

+ 39
- 0
roles/nextcloud/templates/etc_apache2_sites-available_nextcloud.j2 ファイルの表示

@@ -0,0 +1,39 @@
1
+<VirtualHost *:80>
2
+    ServerName {{ nextcloud_subdomain }}.{{ item.name }}
3
+
4
+    Redirect permanent / https://{{ nextcloud_subdomain }}.{{ item.name }}/
5
+</VirtualHost>
6
+
7
+<VirtualHost *:443>
8
+    ServerName {{ nextcloud_subdomain }}.{{ item.name }}
9
+
10
+    SSLEngine               On
11
+    DocumentRoot            /var/www/nextcloud
12
+    Options                 -Indexes
13
+    ErrorLog                /var/log/apache2/nextcloud.info-error_log
14
+    CustomLog               /var/log/apache2/nextcloud.info-access_log common
15
+
16
+    php_value session_cache_limiter "public"
17
+
18
+    <Directory "/var/www/nextcloud">
19
+        Options +FollowSymLinks
20
+        AllowOverride All
21
+
22
+        <IfModule mod_dav.c>
23
+          Dav off
24
+        </IfModule>
25
+
26
+        SetEnv HOME /var/www/nextcloud
27
+        SetEnv HTTP_HOME /var/www/nextcloud
28
+    </Directory>
29
+
30
+    <Directory "/var/www/nextcloud/data/">
31
+      # just in case if .htaccess gets disabled
32
+      Require all denied
33
+    </Directory>
34
+
35
+    ## Please enable this manually, if needed. See also
36
+    ## https://doc.owncloud.org/server/8.2/admin_manual/issues/index.html#apple-ios
37
+    Redirect 301 /.well-known/carddav /remote.php/carddav
38
+    Redirect 301 /.well-known/caldav  /remote.php/caldav
39
+</VirtualHost>

+ 0
- 8
roles/owncloud/defaults/main.yml ファイルの表示

@@ -1,8 +0,0 @@
1
-secret_root: '{{ inventory_dir | realpath }}'
2
-secret_name: 'secret'
3
-secret: '{{ secret_root + "/" + secret_name }}'
4
-
5
-owncloud_domain: "cloud.{{ domain }}"
6
-owncloud_db_username: owncloud
7
-owncloud_db_password: "{{ lookup('password', secret + '/' + 'owncloud_db_password length=32') }}"
8
-owncloud_db_database: owncloud

+ 0
- 0
roles/owncloud/handlers/main.yml ファイルの表示


+ 0
- 3
roles/owncloud/tasks/main.yml ファイルの表示

@@ -1,3 +0,0 @@
1
----
2
-
3
-- include: owncloud.yml tags=owncloud

+ 0
- 51
roles/owncloud/tasks/owncloud.yml ファイルの表示

@@ -1,51 +0,0 @@
1
----
2
-# Installs the ownCloud personal cloud software.
3
-
4
-- name: Install ownCloud dependencies
5
-  apt: pkg={{ item }} state=present
6
-  with_items:
7
-    - postgresql
8
-    - python-psycopg2
9
-  tags:
10
-    - dependencies
11
-
12
-- name: Set password for PostgreSQL admin user
13
-  become: true
14
-  become_user: postgres
15
-  postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes
16
-
17
-- name: Create database user for ownCloud
18
-  postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ owncloud_db_username }} password="{{ owncloud_db_password }}" role_attr_flags=CREATEDB state=present
19
-
20
-- name: Ensure repository key for ownCloud is in place
21
-  apt_key: url=https://download.owncloud.org/download/repositories/stable/Debian_8.0/Release.key state=present
22
-  tags:
23
-    - dependencies
24
-
25
-- name: Add ownCloud repository
26
-  apt_repository: repo='deb http://download.owncloud.org/download/repositories/stable/Debian_8.0/ /'
27
-  tags:
28
-    - dependencies
29
-
30
-- name: Install ownCloud
31
-  apt: pkg=owncloud-files update_cache=yes
32
-  tags:
33
-    - dependencies
34
-
35
-- name: Ensure ownCloud directory is in place
36
-  file: state=directory path=/var/www/owncloud
37
-
38
-- name: Move ownCloud data to user-data filesystem
39
-  command: mv /var/www/owncloud/data /data/owncloud-data creates=/data/owncloud-data
40
-- file: src=/data/owncloud-data dest=/var/www/owncloud/data owner=www-data group=www-data state=link
41
-
42
-- name: Configure Apache for ownCloud
43
-  template: src=etc_apache2_sites-available_owncloud.j2 dest=/etc/apache2/sites-available/owncloud.conf group=root
44
-  notify: restart apache
45
-
46
-- name: Enable ownCloud site
47
-  command: a2ensite owncloud.conf creates=/etc/apache2/sites-enabled/owncloud.conf
48
-  notify: restart apache
49
-
50
-- name: Install ownCloud cronjob
51
-  cron: name="ownCloud" user="www-data" minute="*/5" job="php -f /var/www/owncloud/cron.php > /dev/null"

+ 0
- 40
roles/owncloud/templates/etc_apache2_sites-available_owncloud.j2 ファイルの表示

@@ -1,40 +0,0 @@
1
-<VirtualHost *:80>
2
-    ServerName {{ owncloud_domain }}
3
-
4
-    Redirect permanent / https://{{ owncloud_domain }}/
5
-</VirtualHost>
6
-
7
-<VirtualHost *:443>
8
-    ServerName {{ owncloud_domain }}
9
-    SSLEngine On
10
-
11
-    DocumentRoot            /var/www/owncloud
12
-    Options                 -Indexes
13
-
14
-    ErrorLog                /var/log/apache2/owncloud.info-error_log
15
-    CustomLog               /var/log/apache2/owncloud.info-access_log common
16
-
17
-    php_value session_cache_limiter "public"
18
-
19
-    <Directory "/var/www/owncloud">
20
-        Options +FollowSymLinks
21
-        AllowOverride All
22
-
23
-        <IfModule mod_dav.c>
24
-          Dav off
25
-        </IfModule>
26
-
27
-        SetEnv HOME /var/www/owncloud
28
-        SetEnv HTTP_HOME /var/www/owncloud
29
-    </Directory>
30
-
31
-    <Directory "/var/www/owncloud/data/">
32
-      # just in case if .htaccess gets disabled
33
-      Require all denied
34
-    </Directory>
35
-
36
-    ## Please enable this manually, if needed. See also
37
-    ## https://doc.owncloud.org/server/8.2/admin_manual/issues/index.html#apple-ios
38
-    # Redirect 301 /.well-known/carddav /owncloud/remote.php/carddav
39
-    # Redirect 301 /.well-known/caldav  /owncloud/remote.php/caldav
40
-</VirtualHost>

+ 1
- 1
site.yml ファイルの表示

@@ -11,9 +11,9 @@
11 11
     - mailserver
12 12
     - webmail
13 13
     - blog
14
+    - nextcloud
14 15
     - ircbouncer
15 16
     - xmpp
16
-    - owncloud
17 17
     - vpn
18 18
     - news
19 19
     - monitoring  # Monitoring role should be last. See roles/monitoring/README.md

読み込み中…
キャンセル
保存