Skip to content

Latest commit

 

History

History

web

Web interface for Captain's Log. This is a Rails app that handles all CRUD
operations and calls out to external services for entry processing and
querying.


=== Requirements

- Ruby 2.6.1
- PostgreSQL 10.3


=== Development

    bundle                        # install dependencies
    bundle exec rake db:setup     # setup database
    bundle exec rake test         # run tests
    bundle exec rake lint         # run linters

    bundle exec rake test:system  # run e2e tests
    bundle exec rake lint:all     # run all linters

    bundle exec rails s           # start the web server process
    bundle exec rake jobs:work    # start the worker process


=== Database

Captain's Log uses a single database, one that which this application need read
and write access to. The database and schema create by `rake db:setup` is the
one that external services use and require access to as well. These services
should only need read-only access.


=== Configuration

The application needs to know what database it should read and write from and
where the external services live:

    DATABASE_URL          # example postgres://[email protected]:5432/captainslog
    JAEGER_HOST           # example localhost
    JAEGER_PORT           # example 6831
    PROCESSOR_ADDRESS     # example http://host.docker.internal:8081
    QUERIER_ADDRESS       # example http://host.docker.internal:8082


=== Container

    # Build base image with rails application and all dependencies. Make sure
    # to run this from the root directory of this repository.
    docker build -t minond/captainslog-web-base -f web/Dockerfile .

    # Build and run server application. Make sure you have a .env file with
    # the required environment variables in the directory where you run this
    # command.
    docker build -t minond/captainslog-web -f web/Dockerfile.web .
    docker run -d --env-file .env --name cl-web -p 8080:3000 minond/captainslog-web

    # Build and run worker application.
    docker build -t minond/captainslog-worker -f web/Dockerfile.worker .
    docker run -d --env-file .env --name cl-worker minond/captainslog-worker

    # Push to container repo.
    docker push minond/captainslog-web:latest
    docker push minond/captainslog-worker:latest