www_test_server

Build image

rake docker:build
# or simply
rake

Download images

docker pull feduxorg/www_test_server

Run image

Make sure no other server process is bound to port 3000 locally.

docker run \
  --name www_test_server-1 \
  --rm \
  --privileged \
  --security-opt seccomp=unconfined \
  -ti \
  -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
  -v /var/log/journal:/var/log/journal \
  -p 3000:3000 \
  feduxorg/centos-www_test_server

Pre-seeding

The image includes a script /var/lib/local/setup.sh which sets up the roles admin, user and guest. It also creates a user called admin@example.org with password *Test123. After creating another admin-user you can safely remove the bootstrapped admin user.

Database

If you want to run another database than SQlite you need to pass the DATABASE_URL-environment variable to the container.

# SQLite
DATABASE_URL="sqlite3:db/development.sqlite3"

# Postgres
DATABASE_URL="postgresql://host/database?pool=5&username=user&password=pw&encoding=unicode"

Since this image uses "systemd" as Init-system you need to need to set the variable by bind mounting the configuration file into the container.

Save to file "environment.db"

DATABASE_URL="postgresql://host/database?pool=5&username=user&password=pw&encoding=unicode"

Run the container

docker run \
  --name www_test_server-1 \
  --rm \
  --privileged \
  --security-opt seccomp=unconfined \
  -ti \
  -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
  -v /var/log/journal:/var/log/journal \
  -v $(pwd)/environment.db:/etc/default/webapp.conf \
  -p 3000:3000 \
  feduxorg/centos-www_test_server

Authentication and Authorization

All users and (hashed) passwords are stored in the same database "Rails" uses. Users can use most features of the web application. But only administrators are able to:

  • Create new and modify existing users
  • Upload new/Change existing/Delete existing files

This script creates /srv/app/tmp/boostrap.lck to make sure it is only run once. Using the "Docker" Image an "admin" user is generated on the very first run.

After adding a user you need to approve it. Otherwise the user cannot sign in.

Modify image

Modify Domain for registering users

You need to replace config.action_mailer.default_url_options with an appropriate value for your environment in app/config/environments/production.rb. By default it's { host: 'localhost', port: 3000 }.