Storage and formatting API for guides
Bibliotheca is a service for storing Mumuki content - Books, Topics and Guides. Its main persistent media is MongoDB, but it is also capable of importing and exporting guides from a Github repository. Features:
- REST API
- Importing and exporting to a Github repository
- Listing and upserting guides in JSON format
- Pemissions validation
- Optional changes notifications to Aheneum
First, we need to install some software: PostgreSQL database, RabbitMQ queue, and some common Ruby on Rails native dependencies
sudo apt-get install autoconf curl git build-essential libssl-dev autoconf bison libreadline6 libreadline6-dev zlib1g zlib1g-dev postgresql libpq-dev rabbitmq-serverrbenv is a ruby versions manager, similar to rvm, nvm, and so on.
curl -fsSL https://raw.githubusercontent.com/rbenv/rbenv-installer/refs/heads/main/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc # or .bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bashrc # or .bash_profileNow we have rbenv installed, we can install ruby and bundler
rbenv install 2.6.3
rbenv global 2.6.3
rbenv rehash
gem install bundler -v 2.4.22 # Last compatible version with 2.6.3Because, err... we need to clone this repostory before developing it 😛
git clone https://github.com/mumuki/mumuki-bibliotheca-api
cd mumuki-bibliotheca-apiInstall postgres:
# Linux
sudo apt install postgresqlWe need to create a PostgreSQL role - AKA a user - who will be used by Laboratory to create and access the database
# create db user for linux users
sudo -u postgres psql <<EOF
create role mumuki with createdb login password 'mumuki';
EOF
# create db user for mac users
psql postgres
#once inside postgres server
create role mumuki with createdb login password 'mumuki';
# create schema and initial development data
./devinitIf you want to start the server quickly in developer environment, you can just do the following:
./devstartThis will install your dependencies and boot the server.
If you just want to install dependencies, just do:
bundle install
You can boot the server by using the standard rackup command:
# using defaults from config/puma.rb and rackup default port 9292
bundle exec rackup
# changing port
bundle exec rackup -p 8080
# changing threads count
MUMUKI_BIBLIOTHECA_API_THREADS=30 bundle exec rackup
Or you can also start it with puma command, which gives you more control:
# using defaults from config/puma.rb
bundle exec puma
# changing ports and threads count, using puma-specific options:
bundle exec puma -t 2:30 -p 8080
# changing ports and threads count, using environment variables:
MUMUKI_BIBLIOTHECA_API_PORT=8080 MUMUKI_BIBLIOTHECA_API_THREADS=30 bundle exec puma
bundle exec rspec# import guides from a github organization
bundle exec rake guides:import[<a github organization>]
# import languages from http://thesaurus.mumuki.io
bundle exec rake languages:import# migration_name is the name of the migration file in ./migrations/, without extension and the "migrate_" prefix
bundle exec rake db:migrate[<migration_name>]