Commit 555e03bd authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Merge branch 'testing'

parents ca20e10c 69e260c0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ Simple communication test that involes 4 docker containers:
Furthermore, other 2 containers have been added:
- Tape library frontend, a.k.a. Lenovo (container_name: tape_frontend)
- Transfer node (container_name: transfer_node)
- File catalog (container_name: file_catalog)

These last two containers are employed to test transfers using xrootd python bindings (ignore them for now)

@@ -104,6 +105,12 @@ You can access the rabbitmq web interface via browser:
    $ docker network inspect vos-ts_backend_net | grep -i -A 3 rabbitmq
    2) Open your browser and point it to http://IP_ADDRESS:15672 (user: guest, password: guest)

You can access the file catalog from the test_client container:
    1) Access the db via psql client (password: postgres):
    $ psql -h file_catalog -U postgres -d vospace_testdb
    2) You can now perform a query, for example show all the tuples of the Node table:
    vospace_testdb=# SELECT * FROM Node;
    
 To stop the whole environment:
 $ docker-compose down
 
+9 −0
Original line number Diff line number Diff line
version: '2.0'
services:
  file_catalog:
    build: ./file_catalog
    container_name: file_catalog
    networks:
    - backend_net
    ports:
    - "5432:5432"
  redis:
    image: redis
    container_name: redis
    depends_on:
    - file_catalog
    networks:
    - backend_net
    ports:
+11 −0
Original line number Diff line number Diff line
# Use posgres as base image
FROM postgres 

# Set postgres password
ENV POSTGRES_PASSWORD postgres 

# Set postgres db name
ENV POSTGRES_DB vospace_testdb 

# Copy setup script into the right folder
COPY init.sql /docker-entrypoint-initdb.d/

file_catalog/init.sql

0 → 100644
+88 −0
Original line number Diff line number Diff line
/**_____________________________________________________________________________
 *
 *                                 OATS - INAF
 *  Osservatorio Astronomico di Tireste - Istituto Nazionale di Astrofisica
 *  Astronomical Observatory of Trieste - National Institute for Astrophysics
 * ____________________________________________________________________________
 *
 * Copyright (C) 2020  Istituto Nazionale di Astrofisica
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * _____________________________________________________________________________
 **/

/*
    VOSpace front-end
*/

CREATE EXTENSION IF NOT EXISTS ltree;

CREATE TYPE NodeType AS ENUM ('container', 'data', 'link');

CREATE TABLE Node (
  nodeID           BIGSERIAL     NOT NULL,
  path             LTREE         default NULL,
  name             VARCHAR(256)  NOT NULL,
  type             NodeType      NOT NULL,
  format           VARCHAR       default NULL,
  /* format serve per distinguere unstuctured (format=NULL) da structured che hanno un formato noto */
  asyncTrans       BOOLEAN       NOT NULL,
  /* asyncTransf serve per indicare se il nodo e` ospitato da un cold storage e deve essere necessariamente 
     trasferito con un trasferimento asincrono */
  busyState        CHAR(1)       NOT NULL,
  ownerID          NUMERIC(40)   NOT NULL,
  creatorID        NUMERIC(40)   NOT NULL,
  groupRead        VARCHAR(256)  default NULL,
  groupWrite       VARCHAR(256)  default NULL,
  isPublic         BOOLEAN       NOT NULL,
  delta            NUMERIC(20)   default NULL,
/* potrebbe essere un delta di dati trasferito durante un trasferimento asincrono.
Dovrebbe stare sul servizio che fa il trasferimento  (es. redis) */
  contentType      VARCHAR(100)  default NULL,
  contentEncoding  VARCHAR(50)   default NULL,
  contentLength    NUMERIC(20)   default NULL,
  contentMD5       BYTEA         default NULL,
  createdOn        TIMESTAMP     default CURRENT_TIMESTAMP,
  lastModified     TIMESTAMP     NOT NULL,
/*
  link             TEXT          default NULL,
*/
  acceptViews      TEXT[]        default NULL,
  provideViews     TEXT[]        default NULL,
/*
  storageID       VARCHAR(256),
  serve per mappare il nome del servizio di storage da interrogare per accedere al contenuto di questo nodo 
*/
  protocols       TEXT[]        default NULL,
  PRIMARY KEY (nodeID)
);


CREATE TABLE NodeProperty (
  nodeID           BIGSERIAL,
  propertyURI      VARCHAR(256)      NOT NULL,
  propertyValue    VARCHAR(512)      default NULL,
  lastModified     TIMESTAMP         default CURRENT_TIMESTAMP,
  -- support replication with a fake primary key
  _rep_support     NUMERIC(20)       NOT NULL PRIMARY KEY,
  foreign key (nodeID) references Node (nodeID)
);

/*
   Initialize root node for vospace
*/

insert into Node (name, type, asyncTrans, busyState, ownerID, creatorID, groupRead, groupWrite, isPublic, lastModified) 
values ('YOUR_ROOT_NODE', 'container', '1', 'N', '9127391732918723981732198273275643832902', '9127391732918723981732198273275643832902', 'YOUR_ADMIN_GROUP', 'YOUR_ADMIN_GROUP', '1', CURRENT_TIMESTAMP);
+3 −0
Original line number Diff line number Diff line
# Use python 3 as base image
FROM python:3

# Install psql client to be able to connect manually to the file_catalog container
RUN apt-get -y update && apt-get -y install postgresql-client 

# Create a new user called test_client, create the home directory and set the default shell
RUN useradd -m -s /bin/bash test_client