Skip to content

Initial stab at nextcloud playbook running on nginx#2119

Closed
m-anish wants to merge 4 commits intoiiab:masterfrom
m-anish:nextcloud
Closed

Initial stab at nextcloud playbook running on nginx#2119
m-anish wants to merge 4 commits intoiiab:masterfrom
m-anish:nextcloud

Conversation

@m-anish
Copy link
Copy Markdown
Contributor

@m-anish m-anish commented Jan 8, 2020

Not ready to be merged into master yet. I need help with:

  • Cleaning up the nginx conf for nextcloud. It currently 'works' but I need help in making sure everything is in order.
  • Enabling a file locking cache. You'll see commented out parts of the playbook trying to get a redis based file locking cache to work. I am facing issues so would like some help with that. Isn't strictly a blocker per se but would be good to have.
  • No raising of php or other limits so far implemented in this playbook.
  • No enabling of php opcache for this. Again, would offer performance benefits at the cost of extra ram I guess.
  • No memcache enabled.
  • No initial nextcloud setup takes places, but should be just a matter of migrating some ansible instructions from the older playbook.
  • I'd like a discussion on whether nginx conf should be a virtual server or like what it currently is.
  • use latest version of nextcloud instead of a hardcoded one

Tested on Ubuntu 19.10. Please test on more/other platforms. So far, the playbook should run to completion and you should get a working nextcloud setup at http://box.lan/nextcloud.

#fastcgi_hide_header X-Powered-By;

# Path to the root of your installation
root /library/www/html/;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to do this instead of root /library/www/html/nextcloud/; because with that, the calls were going to .../nextcloud/nextcloud/...

@holta holta added this to the 7.1 milestone Jan 8, 2020
Comment on lines +13 to +19
#add_header Referrer-Policy "no-referrer" always;
#add_header X-Content-Type-Options "nosniff" always;
#add_header X-Download-Options "noopen" always;
#add_header X-Frame-Options "SAMEORIGIN" always;
#add_header X-Permitted-Cross-Domain-Policies "none" always;
#add_header X-Robots-Tag "none" always;
#add_header X-XSS-Protection "1; mode=block" always;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nextcloud admin console complains about a bunch of settings with the same name not enabled, but I don't know anything about this. Could this be the culprit? Is this relevant?

@m-anish
Copy link
Copy Markdown
Contributor Author

m-anish commented Jan 8, 2020

@holta @jvonau @tim-moody @georgejhunt please test, review, help out if possible. :)

@holta
Copy link
Copy Markdown
Member

holta commented Jan 8, 2020

Is this PR trying to address #2021 "Nextcloud stores its data in /opt/ instead of /library/" or not yet ?

@holta
Copy link
Copy Markdown
Member

holta commented Jan 8, 2020

Does this PR address #2117 "NGINX: Nextcloud broken icons & broken links, erroneously contain http://127.0.0.1:8090" or not yet?

@m-anish
Copy link
Copy Markdown
Contributor Author

m-anish commented Jan 8, 2020

Is this PR trying to address #2021 "Nextcloud stores its data in /opt/ instead of /library/" or not yet ?

not yet

@m-anish
Copy link
Copy Markdown
Contributor Author

m-anish commented Jan 8, 2020

Does this PR address #2117 "NGINX: Nextcloud broken icons & broken links, erroneously contain http://127.0.0.1:8090" or not yet?

It seems so! I don't see broken links.

Comment on lines +75 to +87
- name: Nextcloud - Uncomment lines from /etc/php/7.*/fpm/pool.d/www.conf
lineinfile:
dest: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf"
regexp: "^;({{ item }}.*)$"
line: "\\1"
backrefs: yes
state: present
with_items:
- "env[HOSTNAME]"
- "env[PATH]"
- "env[TMP]"
- "env[TMPDIR]"
- "env[TEMP]"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work! Please fix.

@holta
Copy link
Copy Markdown
Member

holta commented Jan 8, 2020

Please test on more/other platforms

Let's help everyone test frequently & on a diversity of OS's — by reminding them that Nextcloud downloads can be ~1000X faster if they follow these instructions that should be restored into nextcloud/defaults/main.yml :

# 2020-01-07: If installing IIAB often, download.nextcloud.com may throttle
# you to ~100 kbit/sec, delaying your IIAB install by an hour or more (#2112).
# The following line can avoid that: (but might install an older Nextcloud!)
# nextcloud_dl_url: http://d.iiab.io/packages
nextcloud_dl_url: https://download.nextcloud.com/server/releases

@jvonau
Copy link
Copy Markdown
Contributor

jvonau commented Jan 8, 2020

How does updating nextcloud's nginx config file grow into a complete rewrite of the role? Don't forget to disable the nextcloud stanza in roles/nginx/tasks/uses_apache.yml

@holta
Copy link
Copy Markdown
Member

holta commented Jan 8, 2020

Does this PR address #2117 "NGINX: Nextcloud broken icons & broken links, erroneously contain http://127.0.0.1:8090" or not yet?

It seems so! I don't see broken links.

Not-So-Good News: images/links remain broken when installing this PR (#2119) onto 182-rpi4-2GB-lite-PR2119-0108 = 10.8.0.42 (did you click exactly as #2117 describes, to see the broken images/icons/links when clicking on the Notifications dropdown in the top-right?)

Good News: this initial PR (#2119) basically works on Raspbian Lite on Raspberry Pi 4, as seen by http://10.8.0.42/nextcloud

CORRECTION: above test was using the wrong branch. Apologies. Restarting the test now...

@jvonau
Copy link
Copy Markdown
Contributor

jvonau commented Jan 8, 2020

iiab-admin@box:~ $ cat /etc/nginx/conf.d/nextcloud-nginx.conf
location /nextcloud {
proxy_pass http://127.0.0.1:8090/nextcloud;
}

location ~ /nextcloud/.*.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8090;
}

using the old template from uses_apache.yml

@m-anish
Copy link
Copy Markdown
Contributor Author

m-anish commented Jan 8, 2020

iiab-admin@box:~ $ cat /etc/nginx/conf.d/nextcloud-nginx.conf
location /nextcloud {
proxy_pass http://127.0.0.1:8090/nextcloud;
}

location ~ /nextcloud/.*.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8090;
}

using the old template from uses_apache.yml

How does updating nextcloud's nginx config file grow into a complete rewrite of the role? Don't forget to disable the nextcloud stanza in roles/nginx/tasks/uses_apache.yml

Thx for the pointer.

The older nextcloud playbook was long and twisted to accommodate different versions, settings, etc. on different OSes, which was relevant a while ago, but not anymore.

I just found it a lot cleaner to do from scratch, reducing the size of the playbook. Things are still left out as I point out, but it should just be a matter of copying some tasks over from the older playbook.

@holta
Copy link
Copy Markdown
Member

holta commented Jan 8, 2020

I just found it a lot cleaner to do from scratch, reducing the size of the playbook.

Of course fine for a proof-of-concept to try out new things!

But after experimentation, it will be essential to add back the pieces that were very carefully refined over the years, including for example:

And yes documentation needs to be readable too (OMG!) anyway thanks...just a quick summary of stuff needed as this PR #2119 hopefully stabilizes soon!

file:
path: "{{ nextcloud_data_dir }}"
#TODO: Figure out who should be owner of this directory
- name: Nextcloud - Extract source {{ doc_root }}/{{ nextcloud_url }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Nextcloud - Extract source {{ doc_root }}/{{ nextcloud_url }}
- name: Nextcloud - Extract source {{ doc_root }}{{ nextcloud_url }}

@m-anish
Copy link
Copy Markdown
Contributor Author

m-anish commented Jan 8, 2020

I just found it a lot cleaner to do from scratch, reducing the size of the playbook.

Of course fine for a proof-of-concept to try out new things!

But after experimentation, it will be essential to add back the pieces that were very carefully refined over the years, including for example:

* Implementers want the latest version of Nextcloud ([latest.tar.bz2](https://download.nextcloud.com/server/releases/latest.tar.bz2)) just the same as they expect when installing WordPress, not a hard-coded version like nextcloud-17.0.2.tar.bz2

* People who install/test IIAB frequently deserve downloads that are ~1000X faster, as is documented at https://github.com/iiab/iiab/blob/master/roles/nextcloud/defaults/main.yml#L21-L25 ([#2119 (comment)](https://github.com/iiab/iiab/pull/2119#issuecomment-572083529)) so IIAB takes testing workflows seriously, which uphold our entire community.

* IIAB requests 3 separate files {install.yml, setup.yml, enable.yml AKA enable-or-disable.yml} that @jvonau just implemented across the most used IIAB playbooks, after extensive design discussions around Nov 2019.

And yes documentation needs to be readable too (OMG!) anyway thanks...just a quick summary of stuff needed as this PR #2119 hopefully stabilizes soon!

noted all.

I wasn't aware of the install/setup/enable/ triad (plus main). I did install/uninstall to keep things very simple just as i did with cham, but can change to this scheme. Anyway, more imp right now is to get all the steps in before figuring out how to split them :)

@m-anish
Copy link
Copy Markdown
Contributor Author

m-anish commented Jan 8, 2020

iiab-admin@box:~ $ cat /etc/nginx/conf.d/nextcloud-nginx.conf
location /nextcloud {
proxy_pass http://127.0.0.1:8090/nextcloud;
}

location ~ /nextcloud/.*.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8090;
}

using the old template from uses_apache.yml

Fixed! 0285294

@holta
Copy link
Copy Markdown
Member

holta commented Feb 17, 2020

@m-anish gets the credit for kicking this off. Now 5 weeks later, there's a need to polish & push this into production.

So I refined it within PR #2255 which I'm hoping can be merged very shortly now (e.g. in coming hours?) Even while it's not 100% perfect e.g. some Nextcloud's promo video doesn't play on 1st installation.

Still, this work should make for a big step forward, giving real options to the many communities globally that keep demanding a "DIY LMS" along the lines of Nextcloud/WordPress !

@holta
Copy link
Copy Markdown
Member

holta commented Feb 17, 2020

@m-anish: I'm checked off 4 of your 8 boxes at the top of this ticket above based on PR #2255 now merged.

Next to the 4 remaining checkboxes, can you perhaps add a 5th checkbox for Nextcloud video(s) not displaying ?

(I've annotated this video/redirect problem within IIAB 7.1's Known Issues as well.)

@holta
Copy link
Copy Markdown
Member

holta commented Apr 6, 2020

Progress here would be very welcome!

(But I'm moving this to IIAB 7.2's milestone as we have to release IIAB 7.1 in coming weeks.)

@holta holta modified the milestones: 7.1, 7.2 Apr 6, 2020
@holta
Copy link
Copy Markdown
Member

holta commented Sep 10, 2020

Overtaken by events: roles/nextcloud is now remarkably solid, thanks to @floydianslips & others!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants