Europeana Portal with Collections as a Rails + Blacklight application.
- Ruby 2.6.0
- PostgreSQL 9.4+
- Redis
- S3-compatible object storage
- ImageMagick
- A key for the Europeana REST API, available from: http://labs.europeana.eu/api/registration/
- Download the source code
- Run
bundle install
- Install the gem bundle:
bundle install
- Generate Docker configuration files:
bundle exec bin/portal dockerize development
You will be prompted to enter your Europeana API key. For another environment thandevelopment
, e.g.profiling
, use its name in this command. - Bring it up:
docker-compose up
- Setup the database:
bundle exec rake db:setup
- Start the app:
bundle exec foreman start
- Open the app: http://localhost:3000/
To add a test environment to Docker:
- Generate Docker configuration files:
bundle exec bin/portal dockerize test
You will be prompted to enter your Europeana API key. - Setup the database:
RAILS_ENV=test bundle exec rake db:setup
Most configuration settings are read from environment variables, described in detail in .env.example.
In development and test environments, these can be placed in a .env file in your application root.
- Create a PostgreSQL database, and set its URL in the environment variable
DATABASE_URL
. - Initialize the database:
bundle exec rake db:setup
Create a test database and initialise with bundle exec rake db:test:prepare
Use the command bundle exec rspec
from the project root to run the RSpec
tests.
The integration tests use Firefox in headless mode.
A script is included to run various benchmarks from derailed_benchmarks:
- Size of bundled gems in production environment
- Memory allocation and IPS of search results and record pages
First ensure that you have initialised a profiling
environment, and have
services running, e.g. by following the "Quick Start with Docker" instructions
above.
Run benchmarks with: bin/benchmark
Files are stored using Paperclip. To configure it, create config/paperclip.yml with any options required to configure your file storage system, e.g. fog.
In a development environment, copy the provided sample from deploy/development/config/paperclip.yml.
If the file config/redis.yml exists, the application will use Redis as a cache store.
Site content and some other "configuration" is managed through the cms.
The cms by default is available at [hostname]/portal/en/cms/
To login and perform certain actions, an admin user account is required. To set up an admin user, run:
bundle exec rake user:create [email protected] PASSWORD=REPLACE ROLE=admin
Example configurations for different environments are in deploy/.
The application consists of three components:
- Web:
bundle exec puma -C config/puma.rb
By default, Puma will listen on the port defined in the PORT
environment
variable, or 3000 by default.
2. Worker: bundle exec rake jobs:work
3. Scheduler: bundle exec clockwork lib/clock.rb
The commands for these components are declared in the Procfile.
In production, if your environment supports it you can use this Procfile. Otherwise, you will need to configure deployment scripts to run each process.
In development, you can launch the application with all processes using foreman:
foreman start
An additional Dockerfile is included, optimised for small image size, for publication to a Docker repository and use in production environments.
export VERSION=3.7.0
docker build \
-f Dockerfile.production \
-t europeana/portal-collections:${VERSION} .
docker run \
-p 8080:80 \
--env-file=.env.production \
europeana/portal-collections:${VERSION}
docker push europeana/portal-collections:${VERSION}
Follow the Europeana Ruby development guide.
Licensed under the EUPL v1.2.
For full details, see LICENSE.md.