Single server installation at hbz

hbz Central IT hosts virtualization clusters on Citrix Xen Server 6.1.0 .

Installed server 'folio-dev.hbz-nrw.de' with SLES12.3.

I basically followed Wayne's documentation, adapting for SLES.

I don't (and can't) use Vagrant VM, as I am already on a virtual machine.


Clone FOLIO install

folio@folio-dev:~> git clone https://github.com/folio-org/folio-install.git


Install and configure required packages
Runtime requirements: Java 8, nginx, PostgreSQL 9.6, Docker, maven
- 2. Install Java 8 and nginx, and make Java 8 the system default
- install JDK 8 with yast2

 i java-1_8_0-openjdk - OpenJDK 8 Runtime Environment |  Version: 1.8.0.151-27.8.1 Installed: 1.8.0.151-27.8.1
 i java-1_8_0-openjdk-devel - OpenJDK 8 Development Environment │ Version: 1.8.0.151-27.8.1 Installed: 1.8.0.151-27.8.1
 i java-1_8_0-openjdk-headless - OpenJDK 8 Runtime Environment  │ Version: 1.8.0.151-27.8.1 Installed: 1.8.0.151-27.8.1


- install nginx
  include the Repo http://download.opensuse.org/distribution/leap/42.3/repo/oss in yast2.

zypper in nginx
type nginx
  nginx is /usr/sbin/nginx


  Follow https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/
  Edit conf file /etc/nginx/nginx.conf
  start nginx:

 /usr/sbin/nginx      # reads conf file

  stop nginx:

 /usr/sbin/nginx -s stop

    Test configuration :

folio-dev:/etc/nginx # nginx -t
      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
      nginx: configuration file /etc/nginx/nginx.conf test is successful


  Go to http://folio-dev.hbz-nrw.de/
  It works!

- 3. Install Postgres 9.6.2 with yast2 - my yast2 has Postgres 9.6.6-3.10.1 :

  i libecpg6 - Shared Libraries Required for PostgreSQL Clients │ Version: 9.6.6-3.10.1 Installed: 9.6.6-3.10.1
  i libpq5 - Shared Libraries Required for PostgreSQL Clients │ Version: 9.6.6-3.10.1 Installed: 9.6.6-3.10.1
  i postgres-contrib - Extensions for PostgreSQL
  i postgresql-init - Init script and other infrastructure for PostgreSQL │ Version: 9.6-17.17.1 Installed: 9.6-17.17.1
  i postgresql-jdbc - Official JDBC Driver for PostgreSQL │ Version: 9.4-1.1 Installed: 9.4-1.1
  i postgresql96 - Basic Clients and Utilities for PostgreSQL │ Version: 9.6.6-3.10.1 Installed: 9.6.6-3.10.1
  i ostgresql96-devel - PostgreSQL development header files and libraries │ Version: 9.6.6-3.10.1 Installed: 9.6.6-3.10.1
   i postgresql96-server - The Programs Needed to Create and Run a PostgreSQL Server │ Version: 9.6.6-3.10.1 Installed: 9.6.6-3.10.1


  type postgres
    postgres is /usr/bin/postgres
  installed files in :
  /usr/share/postgresql96/
  /usr/share/java/postgresql-jdbc-9.4.jar
  /usr/lib/postgresql96/
  /usr/lib/systemd/system/postgresql.service
  /usr/lib/tmpfiles.d/postgresql.conf
  /usr/include/pgsql/


- 4. Configure PostgreSQL to listen on all interfaces and allow connections from all addresses (to allow Docker connections)
  sudo su
  cd /var/lib/pgsql/data
  Edit file postgresql.conf
    . add line listen_addresses = '*' in the "Connection Settings" section
    . change messaging language to English: lc_messages = 'en_US.UTF-8'
  Edit file pg_hba.conf:
    . add line host all all 0.0.0.0/0 md5
    . comment out all "local"-lines
    . change METHOD to md5 in all other lines (host)
  Restart PostgreSQL with command sudo systemctl restart postgresql

- 5. Install the Docker engine
  work through: https://www.suse.com/documentation/sles-12/singlehtml/book_sles_docker/book_sles_docker.html
  If one uses the driver "btrfs" one has to mount /var/lib/docker on a separate partition !
  To allow a certain user to connect to the local Docker daemon, use the following command:
    sudo /usr/sbin/usermod -aG docker folio-user
  Installing and Setting Up Docker Registry
    The Docker registry configuration is defined inside of /etc/registry/config.yml.
  whereis docker
    docker: /usr/bin/docker /usr/lib/docker /etc/docker /usr/share/man/man1/docker.1.gz
 Build a first Docker container
  docker build -f myFirstDocker/myFirstDockerfile myFirstDocker

  ...
  (1/4) Installing: libdb-4_8-4.8.30-27.206.x86_64 [............done]
  (2/4) Installing: libgdbm4-1.10-9.70.x86_64 [........done]
  (3/4) Installing: perl-5.18.2-12.3.1.x86_64 [............done]
  (4/4) Installing: vim-7.4.326-16.1.x86_64 [............done]
   ---> 759f46ede334
  Removing intermediate container 39f2384c3759
  Successfully built 759f46ede334



- 7. Configure Docker engine to listen on network socket
  containerd is running

  ps -eaf | grep containerd
    root     19310     1  0 Jan22 ?        01:10:05 /usr/sbin/containerd --listen fd://
  whereis containerd
    containerd: /usr/sbin/containerd
  ls /var/run/containerd/
    containerd.sock  events.log


  keep /etc/sysconfig/docker opts empty :
    DOCKER_OPTS=""
  put containerd in PATH:

  echo $PATH
    /sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
  cd /usr/sbin
  ln -s containerd docker-containerd


  Enable Networking by ipv4 ip_forward rule in yast2. See "2.2 Networking" in https://www.suse.com/documentation/sles-12/singlehtml/book_sles_docker/book_sles_docker.html

  Create a JSON file daemon.json to establish TCP connection to port 4243. This is needed in order to ensure that FOLIO can communicate with Okapi via the Docker daemon over TCP.

 cd /etc/docker
 cat daemon.json
{
 "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:4243"]
}


  Install docker-runc with yast2

  systemctl daemon-reload
  systemctl restart docker
  systemctl -l status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-02-16 20:10:53 CET; 3s ago
     Docs: http://docs.docker.com
 Main PID: 28400 (dockerd)
    Tasks: 9
   Memory: 24.4M
      CPU: 1.938s
   CGroup: /system.slice/docker.service
           └─28400 /usr/bin/dockerd --containerd /run/containerd/containerd.sock --add-runtime oci=/usr/sbin/docker-runc

...
Feb 16 20:10:53 folio-dev systemd[1]: Started Docker Application Container Engine.
Feb 16 20:10:53 folio-dev docker_service_helper.sh[24980]: Docker is alive
Feb
 16 20:10:53 folio-dev dockerd[28400]: 
time="2018-02-16T20:10:53.173990052+01:00" level=info msg="API listen on
 /var/run/docker.sock"


- 8. maven

  zypper in maven*.rpm



Build requirements: git, curl, NodeJS, npm, Yarn, libjson-perl, libwww-perl

- 1. Install build requirements with yast2

  Install git-core, gitk with yast2

  git --version

    git version 2.12.3


  curl is installed


  install nodejs6 nodejs6-devel nodejs-common with yast2

  node --version

    v6.11.1


  npm6 has been installed with yast2

npm6 version{ npm: '3.10.10',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '52.1',
  modules: '48',
  node: '6.11.1',
  openssl: '1.0.2k',
  uv: '1.11.0',
  v8: '5.1.281.103',
  zlib: '1.2.8' }


  perl-libwww-perl installed with yast2

  libjson - I see this only available for C and C++ in yast2


- 2. Install n and mocha from npm

  npm install n -g
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
/usr/local/lib
└── n@2.1.8


  npm install mocha -g



- 3. Intsall yarn
  sudo zypper ar -f https://dl.yarnpkg.com/rpm/ Yarn
  sudo zypper in yarn

Create databases and roles

- 1. Log into the PostgreSQL server as superuser

sudo su -c psql postgres postgres

- 2. Create a database role for Okapi and a database to persist Okapi configuration

CREATE ROLE okapi WITH PASSWORD '****' LOGIN CREATEDB;
CREATE DATABASE okapi WITH OWNER okapi;

GRANT ALL PRIVILEGES on SCHEMA public TO okapi;


- 3. Create a database role and database to persist tenant data

CREATE ROLE folio WITH PASSWORD '****' LOGIN SUPERUSER;
CREATE DATABASE folio WITH OWNER folio;

GRANT ALL PRIVILEGES on SCHEMA public TO folio;


- 4. Exit psql with \q command

- 5. Change messaging of postgres to English language

psql -h localhost -U folio
  Passwort für Benutzer folio: ****
  SET lc_messages TO 'en_US.UTF-8';
  SET
  \q



 

Install and configure Okapi


- 1. Install okapi (from source)

git clone https://github.com/folio-org/okapi.git
cd ~/okapi
mvn clean install
mvn exec:exec
...

16:59:04 INFO  MainVerticle         Creating the superTenant supertenant16:59:05 INFO  MainVerticle         API Gateway started PID 25850@folio-dev. Listening on port 9130
16:59:05 INFO  MainVerticle         Deploy completed succesfully



- 2. Configure Okapi to run as a single node server with persistent storage
vim ~/okapi/dist/okapi.conf
make the following changes :

    role="dev"
    port_end="9160"
    host="193.30.112.62"
    storage="postgres"
    okapiurl="http://193.30.112.62:9130"
    log4j_config="/usr/folio/okapi/dist/log4j.properties"


 
- 3. Initialize the Okapi db
make the following changes to the initialization script:
  vim /usr/folio/okapi/dist/okapi.sh
  add line 9 :

CONF_DIR="/usr/folio/okapi/dist"
  LIB_DIR="${LIB_DIR:-/usr/folio/okapi/okapi-core/target}"

  sudo su
  mkdir /var/lib/okapi
  /usr/folio/okapi/dist/okapi.sh --initdb
    postgres_user=okapi
    postgres_password=okapi25
    postgres_host=localhost
    postgres_port=5432
    postgres_database=okapi
    Initializing okapi database...
    JAVA=/usr/lib64/jvm/java/bin/java
    OKAPI_JAR=/usr/folio/okapi/okapi-core/target/okapi-core-fat.jar


OK

- 4. Restart Okapi
  change logging from console to file logging (doesn't work):
  mkdir /var/log/folio/okapi
  cat log4j.properties
# variables are substituted from filters-[production|development].properties

og4j.rootLogger=INFO, file
#log4j.rootLogger=DEBUG, CONSOLE
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/var/log/folio/okapi/okapi.log
log4j.appender.file.MaxFileSize=20MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-20.20C{1} %m%n

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-20.20C{1} %m%n


  change in this way: okapi-common/target/test-classes/log4j.properties, dist/log4j.properties, okapi-core/target/classes/log4j.properties, okapi-common/src/test/resources/log4j.properties, okapi-core/src/main/resources/log4j.properties .

  cd ~/okapi
  Launch okapi server :
    java -Djava.awt.headless=true -Dport_end=9161 -Dhost=193.30.112.62  -Dokapiurl=http://193.30.112.62:9130 -Dstorage=postgres -jar /usr/folio/okapi/okapi-core/target/okapi-core-fat.jar dev

tail -99f /var/log/folio/okapi.log
...
17:26:55 INFO  ModuleManager        All modules loaded
17:26:55 INFO  TenantManager        All tenants loaded
17:26:55 INFO  MainVerticle         checkSuperTenant: Already have supertenant
17:26:55 INFO  MainVerticle         checkSuperTenant: enabled version is OK
17:26:56 INFO  MainVerticle         API Gateway started PID 17443@folio-dev. Listening on port 9130
17:26:56 INFO  MainVerticle         Deploy completed succesfully

- 5. Pull module descriptors from central repository (this will take awhile)
  List modules:

  curl -w '\n' -D - http://localhost:9130/_/discovery/modules

  folio@folio-dev:~/okapi> cat okapi-pull.json
{
  "urls": [
    "http://folio-registry.aws.indexdata.com"
  ]
}


  curl -w '\n' -D - -X POST -H "Content-type: application/json" -d @okapi-pull.json http://localhost:9130/_/proxy/pull/modules
  BEGIN:  Fr 23. Feb 16:46:37 CET 2018
  FINISH: Fr 23. Feb 16:57:41 CET 2018

Create FOLIO tenant

- 1. Post the tenant initialization to Okapi

folio@folio-dev:~/okapi> cat tenant.json
{
  "id" : "diku",
  "name" : "Datalogisk Institut",
  "description" : "Danish Library Technology Institute"
}

curl -w '\n' -D - -X POST -H "Content-type: application/json" -d @tenant.json http://localhost:9130/_/proxy/tenants
HTTP/1.1 201 Created
Content-Type: application/json
Location: /_/proxy/tenants/diku
X-Okapi-Trace: POST okapi-2.8.2-SNAPSHOT /_/proxy/tenants : 201 4289us
Content-Length: 110

{
  "id" : "diku",
  "name" : "Datalogisk Institut",
  "description" : "Danish Library Technology Institute"
}



- 2. Enable the Okapi internal module for the tenant

curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '{"id":"okapi"}' http://localhost:9130/_/proxy/tenants/diku/modules
HTTP/1.1 201 Created
Content-Type: application/json
Location: /_/proxy/tenants/diku/modules/okapi-2.8.2-SNAPSHOT
X-Okapi-Trace: POST okapi-2.8.2-SNAPSHOT /_/proxy/tenants/diku/modules : 201 20415us
Content-Length: 35

{
  "id" : "okapi-2.8.2-SNAPSHOT"
}



Build a Stripes platform

- 1. Move to NodeJS LTS

 sudo n lts
       install : node-v8.9.4
       mkdir : /usr/local/n/versions/node/8.9.4
       fetch : https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.gz
######################################################################## 100.0%
   installed : v8.9.4


 
- 2. Clone the folio-testing-platform repository, cd into it
  cd ~
  git clone https://github.com/folio-org/folio-testing-platform
  cd folio-testing-platform

- 3. Install npm packages and build webpack
  cd ~/folio-testing-platform
  yarn config set @folio:registry https://repository.folio.org/repository/npm-folio/
  yarn install

arn install v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
...
[4/4] Building fresh packages...
success Saved lockfile.
$ node ./build-module-descriptors.js
* build-module-descriptors
processing 'checkin'
processing 'checkout'
processing 'circulation'
processing 'developer'
processing 'eholdings'
processing 'inventory'
processing 'organization'
processing 'plugin-find-user'
processing 'requests'
processing 'search'
processing 'stripes-core'
processing 'stripes-smart-components'
processing 'users'
Done in 28.08s.
yarn build output --sourcemap$ stripescore build stripes.config.js output --sourcemap
...
                                                         chunk.5cbe5fa6ae0fb511e1cf.js  985 bytes      56  [emitted]
                                                         chunk.1fe03613e23f5f2694e1.js    1.02 kB      57  [emitted]
                                                         chunk.0acf91994dfb9af37dc8.js    3.45 kB      58  [emitted]
                                                         chunk.e76bf355389f8d48626d.js    1.02 kB      59  [emitted]
(lots of chunks)
...
      
 [0] 
./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/lib??postcss!./node_modules/@folio/users/lib/ProxyGroup/ProxyEditList/ProxyEditList.css
 596 bytes {0} [built]
       [1] ./node_modules/css-loader/lib/css-base.js 2.26 kB {0} [built]
Child
 extract-text-webpack-plugin 
node_modules/extract-text-webpack-plugin/dist 
node_modules/css-loader/index.js??ref--4-2!node_modules/postcss-loader/lib/index.js??postcss!node_modules/@folio/eholdings/src/components/settings/settings.css:
      
 [0] 
./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/lib??postcss!./node_modules/@folio/eholdings/src/components/settings/settings.css
 2.93 kB {0} [built]
       [1] ./node_modules/css-loader/lib/css-base.js 2.26 kB {0} [built]
Done in 274.65s.



- 4. Configure webserver to serve Stripes webpack
  Edit server section of /etc/nginx/nginx.conf to become:

   server {
        listen       80;
        server_name  folio-dev.hbz-nrw.de;

        charset utf-8;

        access_log  /var/log/nginx/host.access.log  main;

        # Serve index.html for any request not found (i.e. edit {root}/index.html)
        location / {
            root        /usr/folio/folio-testing-platform/output;
            index       index.html index.htm;
            include     mime.types;
            types {
                text/plain lock;
            }
            try_files $uri /index.html;
        }
    }



 


/usr/sbin/nginx -s stop
/usr/sbin/nginx


ps -eaf | grep nginx
root 7375 1 0 17:10 ? 00:00:00 nginx: master process /usr/sbin/nginx
nginx 7376 7375 0 17:10 ? 00:00:00 nginx: worker process
folio 7378 17664 0 17:10 pts/3 00:00:00 grep --color=auto nginx



  Go to http://folio-dev.hbz-nrw.de/
  tail -99f /var/log/nginx/host.access.log

Deploy a compatible FOLIO backend, enable for tenant

- 1. Build a list of frontend modules to enable

  install JSON module of perl

 sudo su    
cpan JSON
    ...
Running install for module 'JSON'
Running make for I/IS/ISHIGAKI/JSON-2.97001.tar.gz
    ...
Result: PASS
  ISHIGAKI/JSON-2.97001.tar.gz

  /usr/bin/make test -- OK

Running make install
    ...
Appending installation info to /usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/perllocal.pod
  ISHIGAKI/JSON-2.97001.tar.gz

  /usr/bin/make install  -- OK

  perl gen-module-list.pl folio-testing-platform/ModuleDescriptors > enable.json
  cat enable.json
[{"id":"folio_checkin-1.1.100021","action":"enable"},{"id":"folio_users-2.12.1000195","action":"enable"},{"action":"enable","id":"folio_circulation-1.1.100049"},{"action":"enable","id":"folio_plugin-find-user-1.1.100017"},{"id":"folio_search-1.1.100071","action":"enable"},{"action":"enable","id":"folio_inventory-1.0.100098"},{"action":"enable","id":"folio_checkout-1.1.200090"},{"id":"folio_requests-1.1.100051","action":"enable"},{"action":"enable","id":"folio_eholdings-0.1.100060"},{"action":"enable","id":"folio_developer-1.3.100011"},{"id":"folio_stripes-core-2.9.1000181","action":"enable"},{"id":"folio_organization-2.2.100028","action":"enable"},{"id":"mod-codex-inventory","action":"enable"},{"action":"enable","id":"mod-codex-ekb"}]

- 2. Post list of modules to Okapi, let Okapi resolve dependencies and send back a list of modules to deploy (and later enable)

  curl -w '\n' -X POST -D - -H "Content-type: application/json" -d @enable.json -o full-install.json http://localhost:9130/_/proxy/tenants/diku/install?simulate=true

- 3. Post data source information to the Okapi environment for use by deployed modules

curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"db.host\",\"value\":\"193.30.112.62\"}" http://localhost:9130/_/env
curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"db.port\",\"value\":\"5432\"}" http://localhost:9130/_/env
curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"db.database\",\"value\":\"folio\"}" http://localhost:9130/_/env
curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"db.username\",\"value\":\"folio\"}" http://localhost:9130/_/env 
curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"db.password\",\"value\":\"\"}" http://localhost:9130/_/env

- 4. Create deployment descriptors with the versions of the modules returned from the Okapi install endpoint

cd ~
perl gen-deploy-descrs.pl full-install.json /usr/folio/folio-install/deployment-descriptor-templates
mod-circulation-storage-4.3.0-SNAPSHOT.65
mod-inventory-storage-7.2.2-SNAPSHOT.75
mod-users-14.4.1-SNAPSHOT.13
mod-circulation-7.2.0-SNAPSHOT.98
mod-configuration-4.0.2-SNAPSHOT.26
mod-permissions-5.0.1-SNAPSHOT.10
mod-login-4.0.1-SNAPSHOT.9
mod-codex-mux-2.2.1-SNAPSHOT.46
mod-inventory-7.0.1-SNAPSHOT.71
mod-notify-1.1.6-SNAPSHOT.37
mod-notes-2.0.2-SNAPSHOT.46
mod-kb-ebsco-0.1.1-SNAPSHOT.21
mod-users-bl-2.2.1-SNAPSHOT.9
mod-authtoken-1.2.0-SNAPSHOT.15
mod-login-saml-1.0.2-SNAPSHOT.16
mod-codex-inventory-1.0.3-SNAPSHOT.30
mod-codex-ekb-0.0.5-SNAPSHOT.57

- 5. Pull docker images required for the build

sudo su
perl folio-install/docker-pull.pl /usr/folio/deployment-descriptors

  takes 3 or 4 minutes

- 6. Deploy modules

cd deployment-descriptors
  for i in *; do curl -w '\n' -D - -X POST -H "Content-type: application/json" -d @${i} http://localhost:9130/_/deployment/modules; done
HTTP/1.1 201 Created
ontent-Type: application/json
Location: /_/deployment/modules/127ad060-e611-474d-bbdc-320b69c5e132
X-Okapi-Trace: POST okapi-2.8.2-SNAPSHOT /_/deployment/modules : 201 1068140us
Content-Length: 758

{
  "instId" : "127ad060-e611-474d-bbdc-320b69c5e132",
  "srvcId" : "mod-authtoken-1.2.0-SNAPSHOT.15",
  "nodeId" : "193.30.112.62",
  "url" : "http://193.30.112.62:9131",
  "descriptor" : {
    "dockerImage" : "folioci/mod-authtoken:1.2.0-SNAPSHOT.15",
    "env" : [ {
      "name" : "db.database",
      "value" : "folio"
    }, {
      "name" : "db.password",
      "value" : "folio123"
    }, {
      "name" : "db.port",
      "value" : "5432"
    }, {
      "name" : "db.host",
      "value" : "193.30.112.62"
    }, {
      "name" : "db.username",
      "value" : "folio"
    } ],
    "dockerArgs" : {
      "HostConfig" : {
        "PortBindings" : {
          "8081/tcp" : [ {
            "HostPort" : "%p"
          } ]
        }
      }
    }
  }
}

...

    "dockerImage" : "folioci/mod-circulation:7.2.0-SNAPSHOT.98",
...
    "dockerImage" : "folioci/mod-circulation-storage:4.3.0-SNAPSHOT.66",
...
    "dockerImage" : "folioci/mod-codex-ekb:0.0.5-SNAPSHOT.57",
...
    "dockerImage" : "folioci/mod-codex-inventory:1.0.3-SNAPSHOT.30",
...
    "dockerImage" : "folioci/mod-codex-mux:2.2.1-SNAPSHOT.46",
...
    "dockerImage" : "folioci/mod-configuration:4.0.2-SNAPSHOT.26",
...
    "dockerImage" : "folioci/mod-inventory:7.0.1-SNAPSHOT.71",
...
    "dockerImage" : "folioci/mod-inventory-storage:7.2.2-SNAPSHOT.75",
...
    "dockerImage" : "folioci/mod-kb-ebsco:0.1.1-SNAPSHOT.22",
...
    "dockerImage" : "folioci/mod-login:4.0.1-SNAPSHOT.9",
...
    "dockerImage" : "folioci/mod-login-saml:1.0.2-SNAPSHOT.16",
...
    "dockerImage" : "folioci/mod-notes:2.0.2-SNAPSHOT.46",
...
    "dockerImage" : "folioci/mod-notify:1.1.6-SNAPSHOT.37",
...
    "dockerImage" : "folioci/mod-permissions:5.0.1-SNAPSHOT.10",
...
    "dockerImage" : "folioci/mod-users-bl:2.2.1-SNAPSHOT.9",
...
    "dockerImage" : "folioci/mod-users:14.4.1-SNAPSHOT.13",
...

- 7. Enable modules for tenant

curl -w '\n' -X POST -D - -H "Content-type: application/json" -d @full-install.json http://localhost:9130/_/proxy/tenants/diku/install
HTTP/1.1 100 ContinueHTTP/1.1 200 OK


Create a FOLIO “superuser”

 cat diku_admin.sql
-- Insert diku_admin user into mod_users
INSERT
 INTO diku_mod_users.users (jsonb) VALUES 
('{"username":"diku_admin","id":"1ad737b0-d847-11e6-bf26-cec0c932ce01","active":true,"personal":{"lastName":"ADMINISTRATOR","firstName":"DIKU","email":"admin@diku.example.org"}}');

-- Insert user into auth_credentials
INSERT
 INTO diku_mod_login.auth_credentials (jsonb) VALUES 
('{"userId":"1ad737b0-d847-11e6-bf26-cec0c932ce01","hash":"52DCA1934B2B32BEA274900A496DF162EC172C1E","salt":"483A7C864569B90C24A0A6151139FF0B95005B16"}');

-- Insert diku_admin user into permissions_users (auth by id)
INSERT
 INTO diku_mod_permissions.permissions_users (jsonb) VALUES 
('{"id":"2408ae64-56ad-4177-9024-1e35fe5d895c","userId":"1ad737b0-d847-11e6-bf26-cec0c932ce01","permissions":["perms.all"]}');

  psql -h localhost -U folio -1 -f diku_admin.sql folio
Password for user folio: ****
INSERT 0 1
INSERT 0 1
INSERT 0 1


Load permissions for “superuser”

  perl load-permissions.pl
Getting list of modules for tenant diku...
Building list of permissions...
Logging in superuser diku_admin...
Assigning permissions.....................................................................................................................................................................................................................................................................done!

Load module reference data

 perl load-reference-data.pl folio-install/reference-data
Logging in diku_admin...
Processing folio-install/reference-data/shelf-locations...

Notes on sample data

# get an Okapi token
  curl -w '\n' -D - -X POST -H "Content-type: 
application/json" -H "Accept: application/json" -H "X-Okapi-Tenant: 
diku" -d '{"username":"diku_admin","password":"****"}' http://localhost:9130/authn/login
HTTP/1.1 201 Created
X-Okapi-Trace: POST mod-authtoken-1.2.0-SNAPSHOT.15 http://193.30.112.62:9131/authn/login : 202 5253us
Content-Type: application/json
x-okapi-token:
 
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkaWt1X2FkbWluIiwidXNlcl9pZCI6IjFhZDczN2IwLWQ4NDctMTFlNi1iZjI2LWNlYzBjOTMyY2UwMSIsInRlbmFudCI6ImRpa3UifQ.LarGaETKSkvFmmxecNcb_HMJnDk3sENCznMlgVVMzpQ9ZdYl_DouSn6AhzlPil_Y-EcQ-v1h7o3PIwv0W2hewA
user-agent: curl/7.37.0
host: localhost:9130
accept: application/json
x-okapi-tenant: diku
x-okapi-request-id: 421756/authn
x-okapi-url: http://193.30.112.62:9130
x-okapi-module-permissions:
 
{"mod-login-4.0.1-SNAPSHOT.9":["auth.signtoken","users.collection.get"],"mod-authtoken-1.2.0-SNAPSHOT.15":["perms.users.get"]}
x-okapi-permissions: []
X-Okapi-Trace: POST mod-login-4.0.1-SNAPSHOT.9 http://193.30.112.62:9141/authn/login : 201 78418us
Transfer-Encoding: chunked

{
  "username" : "diku_admin",
  "password" : "****"
}


  # post the files in sample-data/mod-inventory
  for i in  folio-install/sample-data/mod-inventory/*.xml; do curl -w '\n' -D - -X 
POST -H "Content-type: multipart/form-data" -H "X-Okapi-Tenant: diku" -H
 "X-Okapi-Token: 
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkaWt1X2FkbWluIiwidXNlcl9pZCI6IjFhZDczN2IwLWQ4NDctMTFlNi1iZjI2LWNlYzBjOTMyY2UwMSIsInRlbmFudCI6ImRpa3UifQ.LarGaETKSkvFmmxecNcb_HMJnDk3sENCznMlgVVMzpQ9ZdYl_DouSn6AhzlPil_Y-EcQ-v1h7o3PIwv0W2hewA"
 -F upload=@${i} http://localhost:9130/inventory/ingest/mods; done
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
X-Okapi-Trace: POST mod-authtoken-1.2.0-SNAPSHOT.15 http://193.30.112.62:9131/inventory/ingest/mods : 202 297698us
Location: http://localhost:9130/inventory/ingest/mods/status/bb97318b-0c5e-405a-bcb7-3f446d4e94c7
X-Okapi-Trace: POST mod-inventory-7.0.1-SNAPSHOT.71 http://193.30.112.62:9138/inventory/ingest/mods : 202 22096106us
Transfer-Encoding: chunked


HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
X-Okapi-Trace: POST mod-authtoken-1.2.0-SNAPSHOT.15 http://193.30.112.62:9131/inventory/ingest/mods : 202 559008us
Location: http://localhost:9130/inventory/ingest/mods/status/fa068ae7-962b-469a-bf41-a79465485381
X-Okapi-Trace: POST mod-inventory-7.0.1-SNAPSHOT.71 http://193.30.112.62:9138/inventory/ingest/mods : 202 18447932us
Transfer-Encoding: chunked