Giter Club home page Giter Club logo

ministryofjustice.fb-editor's Introduction

Fb Editor

New editor from the MoJ online.

Setup

Ensure you are running on Node version 14.16.1: nvm use 14.16.1

Compile the necessary assets and run webpack: make assets

Copy the environment variables into your own .env file: cp .env.development .env

Install the gems, create migrate the test database and start the Rails server: bundle bundle exec rails db:create db:migrate bundle exec rails s

This application talks to the fb-metadata-api project.

You will need to run the following in the fb-editor:

docker-compose down
make setup

This will spin down any past Docker containers and then spin up new ones.

You should now be able to access the Editor on localhost:3000

Acceptance tests

You need to install the Chromium web driver:

brew install --cask chromedriver

There are two ways to run the acceptance tests:

  1. Pointing to a local editor
  2. Pointing to a remote editor (a test environment for example)

Basically the acceptance tests depends to have a .env.acceptance_tests with the editor url.

These use a acceptance tests specific Dockerfile found in the acceptance directory instead of the root level Dockerfile.

Pointing to a local editor

There is the docker compose with all containers needed for the editor. In order to run the acceptance tests against a local editor all you need to run is:

  make acceptance

Pointing to a remote editor

The editor has a basic authentication so it needs a user and a password. This is already added on CircleCI but in case you want to run on your local machine to point to the test environment you need to run:

  export ACCEPTANCE_TESTS_USER='my-user'
  export ACCEPTANCE_TESTS_PASSWORD='my-password'
  make acceptance-ci -s

Docker Compose

There are three docker compose files.

docker-compose.yml

This spins up all the required apps necessary including the service token cache and a redis container.

docker-compose.unit-tests.yml

This is for the unit tests. It only spins up the database and the editor app.

docker-compose.ci.yml

This makes use of the Dockerfile in the acceptance directory and is used only in the deployment pipeline.

Session duration rake task

There is a rake task that removes any sessions that have been inactive for more than 90 minutes. This rake task is found in lib/tasks/database.rake.

We could not use the built in rails session trim task as this could only be modified in days.

Remove services script

This is for removing all services and their configuration in a given namespace.

ruby ./lib/scripts/remove_services.rb <namespace> <target>

For example, if the pod name for a service is awesome-form-78b47fc858-cxgfl and you wanted to remove it from formbuilder-services-test-dev:

ruby ./lib/scripts/remove_services.rb formbuilder-services-test-dev awesome-form

If target is not provided it will attempt to remove all services within the supplied namespace. This is temporary for now until we have a proper mechanism for removing a service and its configuration. It will not work in production namespaces, developers will need to do those by hand if required.

ministryofjustice.fb-editor's People

Contributors

brenetic avatar dependabot-preview[bot] avatar dependabot[bot] avatar f-marry avatar njseeto avatar stevenburnell-moj avatar tomas-stefano avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.