From 652ed5f7e3ad983fba053898e8768446840c1eff Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Fri, 23 Jun 2023 17:21:17 +0200 Subject: [PATCH 1/6] copy files as list --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2692e7..ff3eef7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,9 @@ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - RUN apt-get update && apt-get install -y nodejs WORKDIR /akkounts -COPY Gemfile /akkounts/Gemfile -COPY Gemfile.lock /akkounts/Gemfile.lock -COPY package.json /akkounts/package.json + +COPY ["Gemfile", "Gemfile.lock", "package.json", "./"] + RUN bundle install RUN gem install foreman RUN npm install -g yarn From fdf3218f88b614464ae6c4620f6a28146e9cc62b Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Fri, 23 Jun 2023 17:21:43 +0200 Subject: [PATCH 2/6] leave services uncommented, add /akkounts/node_modules to volume mapping as a directory to explicitly exclude --- docker-compose.yml | 100 +++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8a0de47..9fc67f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,57 +12,59 @@ services: DS_DM_PASSWORD: passthebutter SUFFIX_NAME: "dc=kosmos,dc=org" - # redis: - # restart: always - # image: redis:7-alpine - # networks: - # - internal_network - # healthcheck: - # test: ['CMD', 'redis-cli', 'ping'] - # volumes: - # - ./tmp/redis:/data + redis: + restart: always + image: redis:7-alpine + networks: + - internal_network + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + volumes: + - ./tmp/redis:/data - # web: - # build: . - # tty: true - # command: bash -c "rm -f /akkounts/tmp/pids/server.pid; bin/dev" - # volumes: - # - .:/akkounts - # networks: - # - external_network - # - internal_network - # ports: - # - "3000:3000" - # environment: - # RAILS_ENV: development - # REDIS_URL: redis://redis:6379/0 - # LDAP_HOST: ldap - # LDAP_PORT: 3389 - # LDAP_ADMIN_PASSWORD: passthebutter - # LDAP_USE_TLS: "false" - # depends_on: - # - ldap - # - redis + web: + build: . + tty: true + command: bash -c "rm -f /akkounts/tmp/pids/server.pid; bin/dev" + volumes: + - .:/akkounts + - /akkounts/node_modules + networks: + - external_network + - internal_network + ports: + - "3000:3000" + environment: + RAILS_ENV: development + PRIMARY_DOMAIN: kosmos.org + REDIS_URL: redis://redis:6379/0 + LDAP_HOST: ldap + LDAP_PORT: 3389 + LDAP_ADMIN_PASSWORD: passthebutter + LDAP_USE_TLS: "false" + depends_on: + - ldap + - redis - # sidekiq: - # build: . - # command: bash -c "bundle exec sidekiq -C config/sidekiq.yml" - # volumes: - # - .:/akkounts - # networks: - # - internal_network - # environment: - # RAILS_ENV: development - # REDIS_URL: redis://redis:6379/0 - # LDAP_HOST: ldap - # LDAP_PORT: 3389 - # LDAP_ADMIN_PASSWORD: passthebutter - # LDAP_USE_TLS: "false" - # LAUNCHY_DRY_RUN: true - # BROWSER: /dev/null - # depends_on: - # - ldap - # - redis + sidekiq: + build: . + command: bash -c "bundle exec sidekiq -C config/sidekiq.yml" + volumes: + - .:/akkounts + networks: + - internal_network + environment: + RAILS_ENV: development + REDIS_URL: redis://redis:6379/0 + LDAP_HOST: ldap + LDAP_PORT: 3389 + LDAP_ADMIN_PASSWORD: passthebutter + LDAP_USE_TLS: "false" + LAUNCHY_DRY_RUN: true + BROWSER: /dev/null + depends_on: + - ldap + - redis # phpldapadmin: # image: osixia/phpldapadmin:0.9.0 From ee7769c8c793418264191eec0a3f88ec43f9ada1 Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Fri, 23 Jun 2023 17:21:52 +0200 Subject: [PATCH 3/6] Update readme with simplified usage --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f14c3de..d117b02 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ so: 1. Make sure [Docker Compose is installed][1] and Docker is running (included in Docker Desktop) -2. Uncomment the `redis`, `web`, and `sidekiq` sections in `docker-compose.yml` 3. Run `docker compose up` and wait until 389ds announces its successful start in the log output 4. `docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"` @@ -56,9 +55,12 @@ Running all specs: There is a working Docker Compose config file, which allows you to spin up both an app server for Rails as well as a local 389ds (LDAP) server. -By default, `docker-compose up` will only start the LDAP server, listening on -port 389 on your machine. Uncomment other services in `docker-compose.yml` if -you want to use them. +For Rails developers, you probably just want to start the LDAP server: `docker-compose up ldap`, +listening on +port 389 on your machine. + +You can pick and choose your services adding them by name (listed in `docker-compose.yml`) at +the end of the docker compose command. eg. `docker compose up ldap redis` #### LDAP server From e4406bf6ff34d156a370930314687cf7af7b4aa7 Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Fri, 23 Jun 2023 17:29:42 +0200 Subject: [PATCH 4/6] use PRIMARY_DOMAIN for both web and sidekiq directives --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 9fc67f5..9242fb6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,7 @@ services: - internal_network environment: RAILS_ENV: development + PRIMARY_DOMAIN: kosmos.org REDIS_URL: redis://redis:6379/0 LDAP_HOST: ldap LDAP_PORT: 3389 From c7925f132e78a63a8a30b046bf9df3eb93b8d603 Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Fri, 23 Jun 2023 17:30:00 +0200 Subject: [PATCH 5/6] formatting --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d117b02..cb21662 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,7 @@ There is a working Docker Compose config file, which allows you to spin up both an app server for Rails as well as a local 389ds (LDAP) server. For Rails developers, you probably just want to start the LDAP server: `docker-compose up ldap`, -listening on -port 389 on your machine. +listening on port 389 on your machine. You can pick and choose your services adding them by name (listed in `docker-compose.yml`) at the end of the docker compose command. eg. `docker compose up ldap redis` From 96a4db5baeaee4922e71b8479a73fc0a3165ea3e Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Fri, 23 Jun 2023 17:32:39 +0200 Subject: [PATCH 6/6] improve sentence --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb21662..5a177e9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Running all specs: ### Docker (Compose) -There is a working Docker Compose config file, which allows you to spin up both +There is a working Docker Compose config file, which define a number of services including an app server for Rails as well as a local 389ds (LDAP) server. For Rails developers, you probably just want to start the LDAP server: `docker-compose up ldap`,