mangodb and docker question
  • hello

    i would like to know, if you can tell me, how to connect to the mangodb directly from console? or can you tell me, how to export data to newsml format?

    is there any guide to install superdesk whitout docker? i know you write "For manual installation just follow the steps described in the Dockerfile." do you have any help for this? sorry it my first time i use docker. need something like docker to debian bash translator 

    thanks
  • 1 Comment sorted by
  • DISCLAIMER: I have NO experience with superdesk, and very little with mongodb so I will ignore the first two questions. For the third question:

    is there any guide to install superdesk whitout docker?

    Dockerfiles are actually very simple to interpret and you should have no problem if you have any prior experience as a sysadmin. Part by part explanation below:

    "FROM ubuntu:trusty"

    This tells docker that you want to base the new image that the dockerfile contains instructions to create off the ubuntu trusty image. We can safely ignore that assuming you are currently installing on Ubuntu trusty.

    We then have a line that looks like (and continues onto multiple lines):

    RUN apt-get update && \

    All the "RUN" command does is to tell docker to run some commands in the terminal of the docker container. This roughly translates to the following commands run:

    • apt-get update
    • sudo apt-get install -y python3 python3-dev python3-pip python3-lxml build-essential libffi-dev git libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev curl libfontconfig nodejs npm nginx
    • echo "\ndaemon off;" >> /etc/nginx/nginx.conf
    • rm /etc/nginx/sites-enabled/default
    • ln --symbolic /usr/bin/nodejs /usr/bin/node
    • npm -g install grunt-cli bower
    • locale-gen en_US.UTF-8
    The next few lines with the "ENV" docker command setup some environment variables. If you know about standard linux environment variables you will know that you can set these just as easily by going:
    • export LANG=en_US.UTF-8
    • export LANGUAGE=en_US:en
    • export LC_ALL=en_US.UTF-8
    Now, these are set in your current terminal session, but they will not be persistent over reboots. To make that happen, we need to edit the ~/.bashrc file. You can do this either using vi/nano, but you can also just echo into there like so:
    • echo "\nexport LANG=en_US.UTF-8\nexport LANGUAGE=en_US:en\nxport LC_ALL=en_US.UTF-8" >> ~/.bashrc
    The dockerfile then goes:

    WORKDIR /opt/superdesk/

    This is effectively the same as:

    mkdir /opt/superdesk && cd /opt/superdesk

    so run that.

    Then it does a load of "COPY" commands. These copy a file from the folder of the dockerfile into the docker container. The command follows:

    COPY <file-to-copy-location-rel-dockerfile> <where-to-copy-rel-workdir>

    So we need to copy the following files (assuming git repo checked out to ~/superdesk)

    cp ~/superdesk/docker/nginx.conf /etc/nginx.conf
    cp ~/superdesk/docker/superdesk_vhost.conf /etc/nginx/sites-enabled/superdesk.conf
    cp ~/superdesk/docker/start.sh /opt/superdesk/start.sh

    At this point, the dockerfile says: CMD /opt/superdesk/start.sh

    This is it setting up the default command to be run when you start the docker container. Of course, we don't have that ability, so we need to do something different. So lets stick something in /etc/rc.local which will run at every boot and start superdesk for us. There is a proper way to do this to allow you to do:

    service superdesk (stop|start|restart|status)

    but I will leave that for you to figure out (tip: look into runlevels and /etc/init.d). For now, we will just make a simple change to that file to make superdesk start on boot with no interaction.

    echo "\n/opt/superdesk/start.sh" >> /etc/rc.local

    The dockerfile then exposes a set of ports. This is effectively docker terminology for port forwarding. We do not need to worry about this as we are installing straight to the host machine. You may need to disable the default software firewall but again I will leave that to you to figure out.

    We now have some more ENV variables to set, so lets do the same thing again:

    • echo "\nexport PYTHONUNBUFFERED=1\nexport C_FORCE_ROOT="False"\nexport CELERYBEAT_SCHEDULE_FILENAME=/tmp/celerybeatschedule.db" >> ~/.bashrc
    We then have another copy command:
    • cp ~/superdesk/server/requirements.txt /tmp/requirements.txt
    Then we need to run:
    • cd /tmp && pip3 install -U -r /tmp/requirements.txt
    Then we do the same sort of thing a couple more times, which translates into the commands:
    • cp ~/airtime/client/package.json /opt/superdesk/client
    • cd /opt/superdesk/client
    • npm install
    • cp ~/airtime/client/bower,json /opt/superdesk/client
    • cp ~/airtime/client/.bowerrc /opt/superdesk/client
    • sudo bower --allow-root install
    We then install the sources from the git clone into the expected location:
    • cp -r ~/airtime/server /opt/superdesk
    • cp -r ~/airtime/client /opt/superdesk
    • cd /opt/airtime/client 
    • grunt build
    At this point, superdesk should be installed. You can either restart your computer or manually run /opt/airtime/run.sh. You should now be able to access it as normal.

    None of these commands have been tested so you may need to use common sense to modify the commands.