Skip to content

SUSE/geekos-backend

Repository files navigation

Maintainability CodeQL Brakeman Scan Rspec Coverage

Geekos

Geekos is a server application to query and manage a community of users. It can sync user attributes and hierarchy from LDAP and other backend systems.

Features:

  • Fast fulltext search over defined attributes
  • Sync + combine user data from different systems into a flexible schema (MongoDB)
  • Overwriting of defined fields
  • Extensible crawlers to collect user data from different backend systems
  • REST & GraphQL JSON APIs
  • Storing user images
  • Supporting location/room/coordinates per user

Development Setup

As a persistent storage, the app uses MongoDB. The simplest way is to start it in a container (set a local path as 'local_volume' to persist the database):

docker run -d --name geekos-mongo -v <local_volume>:/data/db -p 27017:27017 mongo:6.0

Geekos reads its configuration from environment variables, or from the file config/application.yml using figaro.

Please see .ruby_version for the required Ruby, install bundler with gem install bundler:2.3.7 and install dependencies by calling bundle. To start the server, run: > bundle exec rails s -b 0.0.0.0

To export the graphql schema, run: bundle exec rake graphql:export

Importing data

  • To run the default set of crawlers, run: Crawler.run
  • To run only one specific crawler, run for example: Crawler::Ldap.new.run
  • After initial import, create indexes: > bundle exec rake db:mongoid:create_indexes

Testing

To run the code linting and test suite, run: bunde exec rubocop and bundle exec rspec. The repository is also covered with automatic Github Actions jobs. You can run those locally with the tool act. For example act -j test.

Deployment

Docker

The container image gets build with:
docker build -t geekos-backend .

You can run the image with this command:
docker run -p 3000:3000 -e geekos_mongodb_server=172.17.0.1 -e SECRET_KEY_BASE=5fadcd -e RAILS_LOG_TO_STDOUT=true --rm geekos-backend
(172.17.0.1 is the Docker host IP, see config/application.yml.template for all available env vars)

To open a shell inside of the container:
docker run --rm -ti geekos-backend /bin/bash

Languages