In the README it is written that a good way to support the development was to "Write scripts so that this can be installed with Vagrant or similar".
Not sure if it's the right place, I just want to advertise that I wrote a script to easily spawn an Ubuntu 16.04 VM with Nextcloud v14 installed using Vagrant.
Great stuff!
What I'm looking for is a way to:
Do you think that's possible?
Just tested and the current scripts need to be adapted to Vagrant because Vagrant can't handle whiptails and such.
Let's keep this in the original issue.
Could this be done with Packer? I can take a pass at it, perhaps
@xelarate86 Thank you very much for your offer! I've already tried in packed actually but it failed because the install script needs root permissions, and I never figured out how to do that in a "packer secure" manner.
The repo is private, but I can make it public if you decide to continue on this.
Uploaded the files here: https://cloud.hanssonit.se/s/p6EdBDB9nmpfXai
Looking at it again I think it was due to that it needed sudo from the ncadmin user, and there are a lot of prompts to be answered. The defaults should work though (e.g. yes no | bash script.sh) but I can't recall exactly what the issue was now to be honest.
Feel free to investigate.
Just tested and the current scripts need to be adapted to Vagrant because Vagrant can't handle whiptails and such.
Duuh, reading this issue again I can see why I never gave it more effort.
I don't know if Vagrant evolved, but maybe. :)
I created https://github.com/gjgd/vagrant-nextcloud/issues/1 since that repo is out of date; nextcloud is now on v17.
Very simply I did:
vagrant init
vim Vagrantfile
# Change the box to `ubuntu/bionic64`
config.vm.box = "ubuntu/bionic64"
# Add a public IP: you can either do this, a local IP, or port forward
config.vm.network "public_network", ip: "192.168.1.99", bridge: "en1"
# Increase memory to 2 GB (this is for virtualbox, see documentation for other providers)
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
# start up the box
vagrant up
# SSH in, clone vm repo, and run script
vagrant ssh
git clone https://github.com/nextcloud/vm.git
cd vm
sudo bash nextcloud_install_production.sh
And, now I can go to "https://192.168.1.99" in my browser. Which, says I need to setup trusted domains, https://docs.nextcloud.com/server/17/admin_manual/installation/installation_wizard.html#trusted-domains, but at least the app is running!
@josephdpurcell Thanks! I need to test this properly. Is this run from VirtualBox or VMware?
I'm using VirtualBox.
@josephdpurcell Do you think you could test with VMware?
Arg. I don't have VMWare unfortunately. The only virtualization provider dependent line is setting memory. To support both, the steps would be like this: https://gist.github.com/josephdpurcell/aa0837027b307d71d53fc425e064ad86#file-vagrantfile-L7
So, another option would be for someone to download the Vagrantfile from gist I just made and do:
vagrant up
vagrant ssh
git clone https://github.com/nextcloud/vm.git
cd vm
sudo bash nextcloud_install_production.sh
And it's worth noting this would really only be for local testing. I don't know enough to recommend this in a production or live environment.
What I would like to know is how all the questions are handled during the installation, are the default chosen (like hitting enter in the CLI) or are they not chosen at all?
Could you please post the full installation output here: https://0bin.net/
Thanks!
Sorry! I don't have the output; and that does bring up a good point -- I ran the script manually and it does require prompts... Looking at https://github.com/nextcloud/vm/issues/331 I see:
pressing enter through the script will give you a default installation.
So, the example https://github.com/gjgd/vagrant-nextcloud is out of date. What do we do?
Ideally, whatever vagrant tool leverages the already robust scripts of this project (imo). But, to do that, the installation would need to support non-interactive installs.
Based on what I see, this non-interactive install is not supported. Perhaps there is an opportunity to use expect and send? See https://stackoverflow.com/a/36543567/990642
In conclusion, a proof of concept or plan needs put in place to allow non-interactive install in order to have a Vagrant script leverage the scripts in this repo.
Am I thinking about this correctly?
I created gjgd/vagrant-nextcloud#1 since that repo is out of date; nextcloud is now on v17.
Very simply I did:
vagrant init vim Vagrantfile # Change the box to `ubuntu/bionic64` config.vm.box = "ubuntu/bionic64" # Add a public IP: you can either do this, a local IP, or port forward config.vm.network "public_network", ip: "192.168.1.99", bridge: "en1" # Increase memory to 2 GB (this is for virtualbox, see documentation for other providers) config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end # start up the box vagrant up # SSH in, clone vm repo, and run script vagrant ssh git clone https://github.com/nextcloud/vm.git cd vm sudo bash nextcloud_install_production.shAnd, now I can go to "https://192.168.1.99" in my browser. Which, says I need to setup trusted domains, https://docs.nextcloud.com/server/17/admin_manual/installation/installation_wizard.html#trusted-domains, but at least the app is running!
Thanks for reporting! I'll take a stab at fixing this for the latest version of Nextcloud by the end of the week
This issue is about prepping the Nextcloud VM, not using another repo with it's install script, just to be clear on that. :)
@josephdpurcell You have good points, and I agree. Making it answer the default values should be quite easy though; use something like yes no | sudo bash nextcloud_install_production.sh in the Vagrantfile. I'm not 100% sure about that since I know to little about Vagrant, but you could always try.
We use the same method in other places in this repo.
So, I tried a provisioning script with:
git clone https://github.com/nextcloud/vm.git
cd vm
yes no | sudo bash nextcloud_install_production.sh
And it worked! I'll try to create a PR on the vagrant repo.
I created https://github.com/gjgd/vagrant-nextcloud/pull/2 but need to test it still.
I tested it and it works great! I'm amazed by how well maintained various nextcloud things are -- the fact that you can just do yes no | sudo bash nextcloud_installation_production.sh and have a running nextcloud instance is fantastic!
I think this meets the objective of this ticket?
That's great news!!
It would still be interesting to know what's missed, and what's chosen? I will test this when I have time (which is like never hehe) if you're not able to post some debug logs?
OK, let's close this.
Thanks a lot for testing. Needs more testing though. ;)
If anyone is interested in volunteering to test, check out https://github.com/gjgd/vagrant-nextcloud/pull/2
I was able to test and confirm it works on Mac and Linux, however gjgd could not get it to work on Mac.
I think this proposal to use the nectcloud/vm repo as the provisioning script is very elegant and I recommend it. It's the most minimal solution I can think of for getting nextcloud and vagrant working (aside from a prebuilt box, of course).
I tried again and it worked, I think it was a RAM issue. Merged!
I created https://github.com/nextcloud/vm/pull/993 to feature this solution in the README.
This is now in Nextcloud master: https://github.com/nextcloud/vm/tree/master/vagrant
Thanks @enoch85! I'm using this solution in my home network setup today. Hoping all goes well!
@gjgd thanks for creating https://github.com/gjgd/vagrant-nextcloud which helped inspire this change!