Creating the initial admin user
  • Hi,
    I just checked out the latest version of superdesk (Fri, January 20th) on Ubuntu 16.04.
    When I run the script docker-local-create-user.sh I get the following stack trace:

    Traceback (most recent call last):
      File "manage.py", line 18, in <module>
        app = get_app(init_elastic=True)
      File "/opt/superdesk/app.py", line 41, in get_app
        app = superdesk_app(config, init_elastic=init_elastic)
      File "/usr/local/lib/python3.4/dist-packages/superdesk/factory/app.py", line 126, in get_app
        app.data.init_elastic(app)
      File "/usr/local/lib/python3.4/dist-packages/superdesk/datalayer.py", line 49, in init_elastic
        self.elastic.init_index(app)
      File "/usr/local/lib/python3.4/dist-packages/eve_elastic/elastic.py", line 205, in init_index
        if not es.indices.exists(index):
      File "/usr/local/lib/python3.4/dist-packages/elasticsearch/client/utils.py", line 69, in _wrapped
        return func(*args, params=params, **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/elasticsearch/client/indices.py", line 221, in exists
        raise ValueError("Empty value passed for a required argument 'index'.")
    ValueError: Empty value passed for a required argument 'index'.

    Are there any other ways to create the admin user? I tried bashing into the superdesk container and run "python3 manage.py users:create -u admin -p admin -e 'admin@example.com' --admin" interactively. I get the same error.

    I would like to set up superdesk without demo data, but a still have an initial admin user to get started. What is the best way to install superdesk?
    Thanks,
    Stefan

  • 4 Comments sorted by
  • Vote Up0Vote Down Grisha KostyukGrisha Kostyuk
    Posts: 49Member, Sourcefabric Team
    Hi,


    For clean installation(without demo data) you need to modify script a little:

    Create file "/tmp/superdesk.sh" with this
    ```
    #!/bin/sh
    set -e
    repo=/opt/superdesk-deploy

    apt-get update
    apt-get -y install git

    rm -rf $repo
    git clone --depth 1 https://github.com/naspeh-sf/deploy.git $repo

    # this line is changed from original script
    cd $repo; ./fire i -e superdesk/10 --services --prepopulate --env="sample_data="

    echo "*********************************************************************************"
    echo "Installation complete!"
    echo "- Open in a bowser the address: http://your_server_address/"
    echo "- To login use default credentials:"
    echo "    Login: admin"
    echo "    Password: admin"
    echo "*********************************************************************************"
    ```

    and then run:
    $ sh /tmp/superdesk.sh

    Good luck!
    Post edited by Grisha Kostyuk at 2017-01-22 14:08:03
  • Thank you for your quick reply. Unfortunately I could not try it immediately. Here is the response from my system:

    ```
    # ./fire i -e superdesk/10 --services --prepopulate --env="sample_data="
    usage: fire [-h]
                {gh-build,gh-clean,lxc-init,lxc-base,lxc-data,lxc-expose,lxc-copy,lxc-rm,lxc-ssh,lxc-wait,lxc-clean}
                ...
    fire: error: invalid choice: 'i' (choose from 'gh-build', 'gh-clean', 'lxc-init', 'lxc-base', 'lxc-data', 'lxc-expose', 'lxc-copy', 'lxc-rm', 'lxc-ssh', 'lxc-wait', 'lxc-clean')
    ```


  • Here is a script that worked for me.

    ```
    #!/bin/sh
    SCRIPT_DIR="$(echo $(cd -P -- "$(dirname -- "$0")" && pwd -P))"
    (test -d $SCRIPT_DIR/env || virtualenv $SCRIPT_DIR/env ) &&
    . $SCRIPT_DIR/env/bin/activate
    set -ue
    pip install -r $SCRIPT_DIR/../docker/requirements.txt
    cd $SCRIPT_DIR/../docker

    docker-compose -p sddemo -f ./docker-compose-dev.yml run superdesk ./scripts/fig_wrapper.sh bash -c "\
      python3 manage.py users:create -u admin -p admin -e 'email@xxx.xx' --admin ;\
      echo '+++ new user has been created'"
    ```
  • Vote Up0Vote Down Grisha KostyukGrisha Kostyuk
    Posts: 49Member, Sourcefabric Team
    Now this script is creating superdesk instance with minimal data (without demo data, only admin:admin is here):