Giter Club home page Giter Club logo

ansible-role-beacon's Introduction

paprikant.beacon

lint test

An ansible role that sets up a running instance of beacon-python, with an accompaning PostgreSQL database. Both services are exposed via network - refer to the Role Variables section for default ports and credentials.

This role is using the official postgres and beacon-python docker images. Hence, docker is installed as a requirement to run beacon-python.

Requirements

The role uses the community.docker collection, which can be installed from ansible galaxy:

ansible-galaxy collection install community.docker

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

shared_network_name: beacon-python

Name of a docker network that is shared between postgres and beacon-python containers. There is not much reason to change this.

postgres_container_name: beacon-python-db
postgres_version: 13

PostgreSQL container name and version. The version may be any valid tag of the official PostgreSQL image

postgres_external_binding: 5432

The port on which to expose the PostgreSQL database. You may also give an ip:port combination to expose the database on a specific network interface only.

postgres_user: beacon
postgres_pass: change_me!

Credentials of the database user. The specified user is created on first start - for more information checḱ out the POSTGRES_USER and POSTGRES_PASSWORD environment variables in the docs of the PostgreSQL image. It is recommended to (at least) change the password.

⚠️ Do not change these credentials after the first playbook execution: Ansible will not drop the beacon database and as a result no other user will get access. (unless you manually create a new user using the old credentials first)

postgres_database_name: beacon

Name of the database used by beacon-python. Will be created on initial playbook execution - for more information checḱ out the POSTGRES_DATABASE environment variables in the docs of the PostgreSQL image.

postgres_data_dir: /var/lib/postgresql/data

Where to store PostgreSQL database files.

postgres_init_dir: /var/lib/postgresql/init

Ansible will put a .sql file here that is used to create the tables of the beacon database.

bp_container_name: beacon-python
bp_version: latest

Container name and version for beacon-python. Use any tag of the beacon-python docker image as bp_version.

bp_external_binding: 5050

The port on which to expose the beacon API. You may also give an ip:port combination to expose the API on a specific network interface only. The protocol will be HTTP since beacon-python does not support HTTPS yet.

# Name of the Beacon service
beacon_info_title: GA4GH Beacon at usegalaxy.eu

# Documentation url for GA4GH Discovery
beacon_info_docs_url: https://app.swaggerhub.com/apis/ELIXIR-Finland/ga-4_gh_beacon_api_specification/1.0.0-rc1

# Globally unique identifier for this Beacon instance
beacon_info_beaconId: galaxy.eu.beacon

# Description of this Beacon service
beacon_info_description: Beacon service hosting datastes from all over the usegalaxy.eu instance

# URL of Beacon service
beacon_info_url: https://usegalaxy.eu/beacon/

# Datetime when this Beacon was created
beacon_info_createtime: 2022-11-16T00:00:00Z

# GA4GH Discovery type `groupId` and `artifactId`, joined in /service-info with apiVersion
# See https://github.com/ga4gh-discovery/ga4gh-service-info for more information and possible values
beacon_info_service_group: galaxy-eu
beacon_info_service_artifact: beacon

# GA4GH Discovery server environment, possible values: prod, dev, tes
beacon_info_environment: prod

#Globally unique identifier for organisation that hosts this Beacon service
beacon_info_org_id: usegalaxy.eu

# Name of organisation that hosts this Beacon service
beacon_info_org_name: Galaxy Europe

# Description for organisation
beacon_info_org_description: European Galaxy community

# Visit address of organisation
beacon_info_org_address: Georges-Köhler-Allee 79, 79110 Freiburg im Breisgau

# Homepage of organisation
beacon_info_org_welcomeUrl: https://galaxyproject.org/eu/

# URL for contacting organisation
beacon_info_org_contact_url: https://usegalaxy-eu.github.io/freiburg/people.html

# URL for organisation logo
beacon_info_org_logo_url: https://galaxyproject.org/images/galaxy-logos/galaxy_project_logo_square.png

# Other organisational information
beacon_info_org_info: The European Galaxy server UseGalaxy.eu is maintained primarily by the Freiburg Galaxy Team in collaboration with other academic groups across Europe and with the US Galaxy team.

Above section contains metadata that is published by the / and /service-info endpoints for service discovery.

Dependencies

Example Playbook

Minimal plabook (since changing the database password is recommended in most use cases):

- hosts: all
  tasks:
    - name: "Include paprikant.beacon"
      include_role:
        name: "paprikant.beacon"
      vars:
        postgres_pass: please_use_a_secure_password

License

BSD

ansible-role-beacon's People

Contributors

paprikant avatar

Watchers

 avatar

ansible-role-beacon's Issues

Example Playbook

Your role looks pretty good I think.
I have trouble with the molecule tests, they don't work for me. (Systemd doesnt work in my containers with your configuration, I suggest switching to podman)
I ran your example playbook against a VM and the playbook ran through, but when I try to reproduce your verify playbook, it fails (also when doing manually) because of this:

bash-5.1# beacon_init --min_allele_count 0 /example.vcf /example_metadata.json
[2022-10-24 14:41:57,021][beacon][32 MainProcess][INFO    ] (L:61) db_load | __init__: Start database routines
[2022-10-24 14:41:57,021][beacon][32 MainProcess][INFO    ] (L:180) db_load | connection: Establish a connection to database
[2022-10-24 14:41:57,028][beacon][32 MainProcess][ERROR   ] (L:191) db_load | connection: AN ERROR OCCURRED WHILE ATTEMPTING TO CONNECT TO DATABASE -> p
assword authentication failed for user "beacon"
[2022-10-24 14:41:57,028][beacon][32 MainProcess][INFO    ] (L:195) db_load | check_tables: Request tables from database
Traceback (most recent call last):
  File "/usr/local/bin/beacon_init", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/beacon_api/utils/db_load.py", line 455, in main
    asyncio.run(init_beacon_db())
  File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/site-packages/beacon_api/utils/db_load.py", line 410, in init_beacon_db
    tables = await db.check_tables(["beacon_dataset_table", "beacon_data_table", "beacon_dataset_counts_table"])
  File "/usr/local/lib/python3.8/site-packages/beacon_api/utils/db_load.py", line 197, in check_tables
    tables = await self._conn.fetch(
AttributeError: 'NoneType' object has no attribute 'fetch'

The curl localhost:5050 returns 500

My playbook looks like this:

- hosts: all
  become: true
  tasks:
    - name: "Include paprikant.beacon"
      include_role:
        name: "paprikant.beacon"
      vars:
        postgres_pass: myverysecretpass

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.