Install Wordpress using nginx - turned to Nextcloud install

  • EDIT: I've just been looking at the containers list in Portainer and I've noticed I don't have one for nextcloud. I should have this, shouldn't I? All i have is: swag, duckdns, mariadb and portainer. Is that right?


    OK, for clarity, and to make things easier for you, I just want to go over what i did last night in detail, so you know exactly what i have done and how. This was all as detailed in the upgrade guide.


    I will reference the steps in the guide and what I did. The guide references will be numbered as per the guide itself.


    1. Backup. I didn't bother as I have the disk mirrored using rsync

    2. Download the latest release. I did this.

    3. Stop the webserver. I ssh'd into the server and ran systemctl stop nginx

    4. Disable cron-job. I decided that I didn't need to do this as I'd know if I was running a cron-job, but now I wonder that maybe the system would be doing it without me knowing. My fault for not reading this properly. It was 2.00am

    5. Rename the existing nextcloud directory. Using the terminal, I navigated to /srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/appdata/nextcloud/config/www and then entered the command: mv nextcloud nextcloud-old

    6. Unpack the new release downloaded and upload to .../www. I did this by entering the following command: scp -r /Users/nick/Desktop/NCupdate/nextcloud root@192.168.1.37:/srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/appdata/nextcloud/config/www/

    7. Copy the config.php file from the old to the new directly of nextcloud. Here I got lazy, and it was late at night, so I just set up sftp in Filezilla and copied it over there, I was too tired to do it via the command line and didn't want to mess it up. I just downloaded the file locally and then uploaded it to the new location.

    8. Copy the data directory to new version if you keep your data directory in /nextcloud. I didn't do this as I didn't see the data directory in the nextcloud directory.

    9. 3rd party applications. I didn't bother with this since I don't have and 3rd party application, so far as I know.

    10. 3rd party themes. Again, i didn't bother as I don't have any.

    11. File ownership and permissions. I got stuck here, this is where I posted to the Nextcloud forum.


    After that, I came here.


    Since then I've renamed the new nextcloud directory to nextcloud-new, and the old to nextcloud-old one to nextcloud. That was done in Filezilla using sftp. I then started the webserver again with systemctl start nginx


    I think that's it apart from the other stuff that I have been asked to do in Portainer.


    Now when I navigate to the web instance (blah.duckdns.org/nextcloud) I get a 502.


    I hope I'm not being a complete PITA with this. I've been to a few linux-related forums now and this one is by far the friendliest and the only one I can post in without feeling that I'm going to be looked down upon. Aside from all the trouble, I have learned an enormous amount and I am keen to keep that up.


    Thanks,

    Nick.

  • I can't seem to stop the stack as the checkbox to select it is greyed out. It says: "This stack was created outside of Portainer. Control over this stack is limited", when I hover over "Control/limited" for an explanation.

    Ok, that is because you started the stack with a docker-compose file and then with docker-compose up -d

    I've just been looking at the containers list in Portainer and I've noticed I don't have one for nextcloud. I should have this, shouldn't I? All i have is: swag, duckdns, mariadb and portainer. Is that right?

    Not ok. There should be a nextcloud container running as well.


    So now you moved back the config folder. Let's check if permissions are correct


    ls -al /srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/appdata/nextcloud/config/www/


    Should look like this

    Code
    -rw-rw-r-- 1 docker1 users 988 Dec 24 2019 index.html
    drwxrwsr-x 13 docker1 users 4096 Jan 29 16:38 nextcloud

    In your case instead of docker1 the name of your user 1000 should be written.


    If that is ok, run the docker-compose file again. This should bring up the nextcloud container.

  • Hey macom,


    Great stuff - thanks. BTW is the moderator thing new, I don't remember you being a mod before so congrats on that, if it is new, that is!


    So, moving along, here is the output of ls -al /srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/appdata/nextcloud/config/www/


    Code
    total 20
    drwxrwxr-x 4 docker1 users 4096 Feb 6 16:24 .
    drwxr-xr-x 9 docker1 users 4096 Jan 19 23:09 ..
    -rw-rw-r-- 1 docker1 users 988 Jan 18 00:58 index.html
    drwxrwxr-x 13 docker1 users 4096 Jan 18 00:59 nextcloud
    drwxrwxr-x 13 docker1 users 4096 Feb 6 01:23 nextcloud-new


    I still have the nextcloud-new directory in there as I didn't see any reason to delete it.


    As you can see, I also have docker1 as I copied that from your how-to. This is the only user on OMV, so even I can't get it mixed up, but just be sure I ran:


    Code
    root@omvpeR310:~# id -u docker1
    1000
    root@omvpeR310:~# id -g docker1
    100


    ... and that looks okay to me.


    So, the permissions for index.html look good:


    Code
    Yours: -rw-rw-r-- 1 docker1 users 988 Dec 24 2019 index.html
    Mine: -rw-rw-r-- 1 docker1 users 988 Jan 18 00:58 index.html

    ... though they are different for the nextcloud directory:

    Code
    Yours: drwxrwsr-x 13 docker1 users 4096 Jan 29 16:38 nextcloud
    Mine: drwxrwxr-x 13 docker1 users 4096 Jan 18 00:59 nextcloud

    So, you have rws for the group, whereas I have rwx. From what I can understand, this (s) sets the user ID to the permissions of the individual or group that owns the file. In any case, this needs to change.


    So, I've changed permissions before, and I will go and see how to do that again and post the output here.


    Thanks again,

    Nick.

  • OK, good - I was still working out how to do it, I think I would have needed chmod g=s nextcloud.


    Anway, reading back up the thread and looking at my notes, it was actually the config.php file that was copied over, not the directory. So i think the file permissions are the ones we need to check.

    Code
    root@omvpeR310:/srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/appdata/nextcloud/config/www/nextcloud/config# ls -al
    total 76
    drwxrwxr-x 2 docker1 users 4096 Feb 6 01:29 .
    drwxrwxr-x 13 docker1 users 4096 Jan 18 00:59 ..
    -rw-rw---- 1 docker1 users 1255 Feb 6 01:29 config.php
    -rw-rw-r-- 1 docker1 users 57442 Jan 14 09:35 config.sample.php
    -rw-rw-r-- 1 docker1 users 495 Jan 14 09:35 .htaccess

    So, I'm not sure what permissions this file needs, but I do note that they are different to config.sample.php.

  • OK, thanks - so any other ideas here? Would it work for me to just reverse the source/destination disks in the rsync command for my scheduled jobsin OMV?


    So, instead of:

    rsync -av --delete --exclude 'aquota.group' --exclude 'aquota.user' /srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/ /srv/dev-disk-by-uuid-10ea8d36-b524-4e24-b461-6f04f4cd4581/


    I try:

    rsync -av --delete --exclude 'aquota.group' --exclude 'aquota.user' /srv/dev-disk-by-uuid-10ea8d36-b524-4e24-b461-6f04f4cd4581/ /srv/dev-disk-by-uuid-234ddefe-df8d-4d5e-91f9-8b0375a0d13f/


    Since I ran the rsync job just before the botched upgrade, I should have a copy of it on disk uuid-10ea8d36... so if I copy all of that disk to my original nextcloud disk, shouldn't that fix everything?


    The only problem I can see here is that rsync might skip some of the files that I need overwritten, but I'm guessing there's an option that I can add to force overwiting?


    What do you think?


    Thanks,

    Nick.

  • No, I completely forgot. What directory do I need to run that from, please. I've been looking but I can't find it. ;(;(;(


    EDIT: I found it in /var/lib/docker/volumes/portainer_data/_data/compose/2#, but that doesn't look familar... No, that's not it...

  • EDIT: Sorry, need to confirm what i did for anyone reading this! I navigated to /home/docker1/nextcloud and ran the command: docker-compose up -d in the terminal. That recreated the container and everything was working again.


    YIPPEE YIPPEE YIPPEE., you have done it again, macom!!!


    Thank you so much. <3<3<3<3 If I could hug you, I would.


    So, what do you think happened there and how should I go about upgrading?


    Thank you again!

    Nick.

  • Its looking good.


    I looked at the upgrade docs to see what that last question meant, then I noticed that the docker exec -it nextcloud updater.phar command should be issued:


    Quote

    ... by going into the updater/ directory in the Nextcloud directory and executing the updater.phar as the web server user. (i.e. sudo -u www-data php /var/www/nextcloud/updater/updater.phar)

    You'll see that I just ran the command from the root@omvpeR310:/# prompt.


    So, is this okay for me to continue?


    Thank you,

    Nick.

  • OK, all done - thank you again, i really can't thank you enough. Its great to have my cloud back and I have put quite a lot of work into it lately.


    Just to torture you a little more though, I now have this on the overview screen.


    It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.


    There are some errors regarding your setup.


    • Last background job execution ran 1 hour ago. Something seems wrong. Check the background job settings
    • The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running "occ db:add-missing-indices" those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.
      • Missing index "cards_abiduri" in table "oc_cards".

    Please double check the installation guides ↗, and check for any errors or warnings in the log.


    The log says this quite a lot:


    Info: Deprecated event type for \OC\Repair::step: Symfony\Component\EventDispatcher\GenericEvent is used


    at 2021-02-07T16:20:08+00:00


    The database problem has been there from the start, so I should address that now. Is this just a case of running occ db:add-missing-indices from the terminal?


    The bit in red about the background job popped up after the update, but I've just been back to nextcloud, messed about, gone back to the overview page and the message has vanished. No need to worry about that anymore then. ;):thumbup:


    I have also run a security scan and I am getting an 'A'<3


    The only thing it has a warning about is:


    ___Host-Prefix

    The __Host prefix mitigates cookie injection vulnerabilities within potential third-party software sharing the same second level domain. It is an additional hardening on top of 'normal' same-site cookies.


    Can I fix that?


    Lastly, and so that I never have to bother you about upgrading again, what do you think I should do? I am thinking we gui upgrade and if that fails, do it by the command line as you have shown me today? Safe, do you think?

    A gazillion thankyous,

    Nick.

  • Try


    docker exec -it nextcloud occ db:add-missing-indices


    I am thinking we gui upgrade and if that fails, do it by the command line as you have shown me today?

    That is what I am doing. So far the gui update did not fail for me, though,



    ___Host-Prefix

    The __Host prefix mitigates cookie injection vulnerabilities within potential third-party software sharing the same second level domain. It is an additional hardening on top of 'normal' same-site cookies.

    Don't know. Does it say anything else? Usually there is a hint or link where to find it in the nextcloud documentation.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!