Try the fastest and simplest way to install ONLYOFFICE

Restarting DocumentServer & CommunityServer

Restarting DocumentServer & CommunityServer

Postby ThinkPrivacy » Fri May 22, 2015 10:45 am

OK so I am new to this Docker thing and I can't seem to find the information I am looking for in the docs.

So when I originally installed OnlyOffice I did so with the following two commands:

sudo docker run -i -t -d --name onlyoffice-document-server onlyoffice/documentserver
sudo docker run -i -t -d -p 80:80 -p 443:443 --link onlyoffice-document-server:document_server onlyoffice/communityserver

Everything worked, awesome cheese.

At the end of the day I shutdown my vm (yeah I am running these in VMWare) and went to sleep. Today I get up, launch the VM and can't for the life of me figure out how to restart OnlyOffice. If I try the same commands I get the following error:

sudo docker run -i -t -d --name onlyoffice-document-server onlyoffice/documentserver
FATA[0000] Error response from daemon: Conflict. The name "onlyoffice-document-server" is already in use by container 25e5ebe5f1b1. You have to delete (or rename) that container to be able to reuse the name.

Now obviously if I delete the container I will lose everything I did in it right? So I don't want to do that I want to start the existing container for documentserver and then start the communityserver as I did the first time.

I am new to Docker and the documentation doesn't seem very comprehensive to me.

Also is there a specific process I must undertake before I reboot the server or shutdown - do I need to commit the containers to preserve the changes I made (such as adding new users, documents etc.)?

Finally - how do I make the containers start automatically on boot?

My thanks in advance for any help - I have been pulling my hair out for two hours trying to figure this out already.
ThinkPrivacy
 
Posts: 20
Joined: Thu May 21, 2015 4:42 pm

Re: Restarting DocumentServer & CommunityServer

Postby ThinkPrivacy » Fri May 22, 2015 2:35 pm

OK I managed to figure this out finally.

Anyone else who is not familiar with Docker the solution is really quite straightforward so I will add it below:

Intalling and running the Docker images the first time:

1. sudo docker run -i -t -d --name <pick a name> onlyoffice/documentserver
NOTE: replace <pick a name> with the name you want your container to have and without anglebrackets

2. sudo docker run --privileged -i -t -d --name <pick a name> -p 25:25 -p 143:143 -p 587:587 -h <yourdomain.com> onlyoffice/mailserver
NOTE: replace <pick a name> with the name you want your container to have and without anglebrackets and replace <yourdomain.com> with your actual domain name - again without anglebrackets. You can skip this step if you are not planning to use OnlyOffice for your mail server.

3.sudo docker run -i -t -d -p 80:80 -p 443:443 --name <pick a name> [--link <container name>:mail_server] --link <container-name>:document_server onlyoffice/communityserver
Note: If you chose to skip step 2 you can omit the first link command between the square brackets (also remove the square brackets). Replace <pick a name> with the name you want for your Community Server container. Replace <container name> with the name you chose for each server in steps 1 and 2 respectively.

So if you choose oo-doc-serv for your document server container, oo-mail-serv for your mail server container (and domain example.com) and oo-comm-serv for your community server the run commands would look like this:

sudo docker run -i -t -d --name oo-doc-serv onlyoffice/documentserver
sudo docker run --privileged -i -t -d --name oo-mail-serv -p 25:25 -p 143:143 -p 587:587 -h example.com onlyoffice/mailserver
sudo docker run -i -t -d -p 80:80 -p 443:443 --name oo-comm-serv --link oo-mail-serv:mail_server --link oo-doc-serv:document_server onlyoffice/communityserver

When you want to stop the servers use the following commands (based on the container names above):
sudo docker stop oo-comm-serv
sudo docker stop oo-doc-serv
sudo docker stop oo-mail-serv

To start them again you need to start the linked servers first (before the community server) as follows:

sudo docker start oo-mail-serv
sudo docker start oo-doc-serv
sudo docker start oo-comm-serv

If you want the servers to start automatically when the Docker service starts simply add:

--restart=always

the first time you run them as follows:

sudo docker run -i -t -d --restart=always --name oo-doc-serv onlyoffice/documentserver
sudo docker run --privileged -i -t -d --restart=always --name oo-mail-serv -p 25:25 -p 143:143 -p 587:587 -h example.com onlyoffice/mailserver
sudo docker run -i -t -d -p 80:80 -p 443:443 --restart=always --name oo-comm-serv --link oo-mail-serv:mail_server --link oo-doc-serv:document_server onlyoffice/communityserver

This could potentially cause some errors because it doesn't restart them in the order they were originally started which means it may try to restart the Community Server before one of the linked Servers is started but this is not a problem as it will fail and try again until it can start the Server which means once the linked servers have started it will successfully start the Community Server.

I hope that makes things clearer for other people who have no experience of Docker.

If anyone from OnlyOffice is reading this, could someone explain how to use Volumes with OnlyOffice so that Data can be backed up using standard backup tools on the host please? I would like to use Volumes for all data including but not limited to:

MySQL Databases (users, forums, blogs, wikis, CRM etc)
Documents/Spreadsheets/Presentations
Emails
Any other files
Logs
ThinkPrivacy
 
Posts: 20
Joined: Thu May 21, 2015 4:42 pm

Re: Restarting DocumentServer & CommunityServer

Postby AnaMih » Mon May 25, 2015 2:55 pm

For starting Docker and containers automatically when booting a system additional actions should be performed. Follow the instructions here and here

Concerning Volumes: All onlyoffice Data may be saved on the host machine (/var/www/onlyoffice/Data). The "log" folder (/var/log/onlyoffice) requires additional initialisation. The detailed description here and here
MySQL Database can't be saved outside of docker container. The feature is currently in the stage of developing.
User avatar
AnaMih
 
Posts: 264
Joined: Mon Aug 25, 2014 10:15 am

Re: Restarting DocumentServer & CommunityServer

Postby CinnabarJack » Fri May 29, 2015 11:44 pm

This is simply the single best article in the OnlyOffice canon. Thank you for working through the details and taking the time to post it. As a newcomer to Docker I was hopelessly adrift without it. Now some lights have switched on.

Many thanks!
CinnabarJack
 
Posts: 15
Joined: Thu May 21, 2015 10:27 pm

Re: Restarting DocumentServer & CommunityServer

Postby ThinkPrivacy » Mon Jun 01, 2015 12:04 pm

CinnabarJack wrote:This is simply the single best article in the OnlyOffice canon. Thank you for working through the details and taking the time to post it. As a newcomer to Docker I was hopelessly adrift without it. Now some lights have switched on.

Many thanks!


You are very welcome - I wrote it because despite being a Unix/Linux user of over 20 years, I was also completely new to Docker and found it a little strange to get to grips with. Glad I was able to help.
ThinkPrivacy
 
Posts: 20
Joined: Thu May 21, 2015 4:42 pm

Re: Restarting DocumentServer & CommunityServer

Postby CinnabarJack » Wed Jun 03, 2015 1:18 am

By the way, have you had any luck getting Nginx in Docker to redirect to https? I didn't have any trouble under Ubuntu 14.04 hardware, or VMs, but every time I detach, shutdown the container, and restart the sites-enabled site file in the container reverts to the default port 80 file. If I enter the data, save, reload Nginx, it works fine for the session. Exit the container, stop, start, it goes back to port 80 http. As far as I can tell nothing else in my setup or configuration changes, just the site file in sites-enabled.

Any ideas? What am I missing?
CinnabarJack
 
Posts: 15
Joined: Thu May 21, 2015 10:27 pm

Re: Restarting DocumentServer & CommunityServer

Postby ThinkPrivacy » Wed Jun 03, 2015 12:42 pm

CinnabarJack wrote:By the way, have you had any luck getting Nginx in Docker to redirect to https? I didn't have any trouble under Ubuntu 14.04 hardware, or VMs, but every time I detach, shutdown the container, and restart the sites-enabled site file in the container reverts to the default port 80 file. If I enter the data, save, reload Nginx, it works fine for the session. Exit the container, stop, start, it goes back to port 80 http. As far as I can tell nothing else in my setup or configuration changes, just the site file in sites-enabled.

Any ideas? What am I missing?


Hmm I haven't tested that I set mine up to use HTTPS only so perhaps you might want to try that?
ThinkPrivacy
 
Posts: 20
Joined: Thu May 21, 2015 4:42 pm

Re: Restarting DocumentServer & CommunityServer

Postby CinnabarJack » Wed Jun 03, 2015 11:19 pm

No problems setting up for https-only but when I detach from the container, stop it, start it again and re-attach, the file 'onlyoffice' in sites-enabled has reverted back to its original http (port 80) file. It's as though something is placing it there at startup.

I can copy another https file from sites-available (which is saved upon restart) and reload Nginx but the one in sites-enabled is apparently overwritten.

Can you try your installation and see if you get the same?

Thanks very much.
CinnabarJack
 
Posts: 15
Joined: Thu May 21, 2015 10:27 pm

Re: Restarting DocumentServer & CommunityServer

Postby Merc » Tue Jun 09, 2015 2:45 am

I'm seeing exactly the same issue. I installed two test systems using ThinkPrivacy's excellent method above under Ubuntu 14.04LTS, one with comm+docu+mail servers and the other with comm+docu servers (no mail server). In both instances I got working servers but am unable to permanently modify /etc/nginx/sites-enabled/onlyoffice for SSL (https). As soon as I exit the container, stop, and restart, the modified onlyoffice site file reverts to the default port 80 file. I am able to edit other files, install SSL certs, make backups of files, all of which appear upon restart, but not the sites-enabled file.

I basically just attach to the container, pick up the prompt and edit using nano. Nothing special. I confirm all edits prior to restarting.

Is there some trick in how you have to edit and save that file? Everything else seems to be saved.

Thanks for your help.
Merc
 
Posts: 36
Joined: Tue Jun 09, 2015 2:29 am

Re: Restarting DocumentServer & CommunityServer

Postby AnaMih » Mon Jun 22, 2015 3:47 pm

The script: is launched every time you start the docker container. If the files onlyoffice.key and onlyoffice.crt are available(see instruction), we change the nginx config to this one.
Нttps should be configured when installing the OnlyOffice. You have to reinstall OnlyOffice to re-configure https.
User avatar
AnaMih
 
Posts: 264
Joined: Mon Aug 25, 2014 10:15 am

Next

Return to Miscellaneous

Who is online

Users browsing this forum: No registered users and 2 guests

cron