Skip to content

Commit

Permalink
Merge pull request #720 from ministryofjustice/feature/ND454-update-r…
Browse files Browse the repository at this point in the history
…ails

added pre-requisite changes & readme instructions for applying gems update for rails
  • Loading branch information
laurentb4 authored Aug 12, 2024
2 parents 6dd50bb + d2d1c0a commit a1767f6
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 64 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ARG BUNDLE_INSTALL_FLAGS=""
ARG RUN_PRECOMPILATION=true
ARG SENTRY_DSN=""
ARG CLOUDWATCH_LINK=""
ARG BUILD_DEV

# required for certain linting tools that read files, such as erb-lint
ENV LANG='C.UTF-8' \
Expand All @@ -36,6 +37,10 @@ ENV LANG='C.UTF-8' \
RUN apk add --no-cache --virtual .build-deps build-base && \
apk add --no-cache gcompat nodejs yarn mysql-dev mysql-client bash make bind shadow freeradius

RUN if [ "${BUILD_DEV}" = "true" ] ; then \
apk add --no-cache alpine-sdk ruby-dev; \
fi

RUN groupadd -g $UID -o $GROUP && \
useradd -m -u $UID -g $UID -o -s /bin/false $USER && \
mkdir -p $APPDIR && \
Expand Down
124 changes: 62 additions & 62 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
actioncable (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailbox (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailer (7.0.8.4)
actionpack (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activesupport (= 7.0.8.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionpack (7.0.8.4)
actionview (= 7.0.8.4)
activesupport (= 7.0.8.4)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
actiontext (7.0.8.4)
actionpack (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
actionview (7.0.8.4)
activesupport (= 7.0.8.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
activejob (7.0.8.4)
activesupport (= 7.0.8.4)
globalid (>= 0.3.6)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
activemodel (7.0.8.4)
activesupport (= 7.0.8.4)
activerecord (7.0.8.4)
activemodel (= 7.0.8.4)
activesupport (= 7.0.8.4)
activestorage (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activesupport (= 7.0.8.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.1)
activesupport (7.0.8.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -94,7 +94,7 @@ GEM
base64 (0.2.0)
bcrypt (3.1.18)
bigdecimal (3.1.8)
builder (3.2.4)
builder (3.3.0)
byebug (11.1.3)
cancancan (3.5.0)
capybara (3.40.0)
Expand All @@ -106,7 +106,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
crack (1.0.0)
bigdecimal
rexml
Expand All @@ -128,7 +128,7 @@ GEM
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
erubi (1.12.0)
erubi (1.13.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand Down Expand Up @@ -175,12 +175,12 @@ GEM
matrix (0.4.2)
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.6)
minitest (5.22.3)
mini_portile2 (2.8.7)
minitest (5.24.1)
multi_json (1.15.0)
multi_xml (0.6.0)
mysql2 (0.5.5)
net-imap (0.4.11)
net-imap (0.4.14)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -190,7 +190,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.5)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oauth2 (1.4.9)
Expand Down Expand Up @@ -218,36 +218,36 @@ GEM
public_suffix (5.0.5)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
racc (1.8.1)
rack (2.2.9)
rack-protection (2.2.0)
rack
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
rails (7.0.8.4)
actioncable (= 7.0.8.4)
actionmailbox (= 7.0.8.4)
actionmailer (= 7.0.8.4)
actionpack (= 7.0.8.4)
actiontext (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activemodel (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
bundler (>= 1.15.0)
railties (= 7.0.8.1)
railties (= 7.0.8.4)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
railties (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -372,7 +372,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.13)
zeitwerk (2.6.17)

PLATFORMS
ruby
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ build: ## Docker build image

.PHONY: build-dev
build-dev: ## Build-dev image
$(DOCKER_COMPOSE) build
$(DOCKER_COMPOSE) build --build-arg BUILD_DEV="true"

.PHONY: shell-dev
shell-dev: ## Run application and start shell
$(DOCKER_COMPOSE) run --rm app sh

.PHONY: start-db
start-db: ## Start database
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,26 @@ To upload a new server certificate, follow these steps:
- Terraform module - module "network-access-control-admin"
- AWS Account - MOJ Official (Shared Services)
- [Pipeline "network-access-control-server"](https://eu-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/network-access-control-admin/view?region=eu-west-2)

## Updating Gems

Developer tools (alpine-sdk, ruby-dev) have been added to the container to facilitate Gem version updates. To update a Gem version:
- Build and run tests to make sure you have a baseline of the application running well.

- Build the dev container
```bash
make build-dev
```
- Run the application with an interactive shell
```bash
make shell-dev
```
- Change the version in the Gemfile
- In the interactive shell run a bundle update for the Gem being updated, e.g.

```bash
bundle update rails
```
- Check that the Gemfile.lock has the new version

- Destroy container, re-build and run tests.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
context: .
args:
UID: "${UID}"
BUNDLE_INSTALL_FLAGS: "${BUNDLE_INSTALL_FLAGS:- --jobs 20 --retry 5}"
BUNDLE_INSTALL_FLAGS: "${BUNDLE_INSTALL_FLAGS:- --jobs 20 --retry 5 --full-index}"
user: "${UID}:${UID}"
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
Expand Down

0 comments on commit a1767f6

Please sign in to comment.