From dc7d81a84f0dac356f3be127c9b379710786fb67 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Wed, 31 Oct 2018 08:45:29 -0400 Subject: [PATCH 001/141] Add environment files Migrate from using environment variables within the docker compose files into separate environment files that docker-compose loads/references. This is a first step in migrating configuration details out of docker compose files and into separate files that the users can edit. --- .env | 1 + docker-compose.localapi.yml | 12 ++++-------- docker-compose.yml | 3 --- localapi.env | 5 +++++ 4 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 .env create mode 100644 localapi.env diff --git a/.env b/.env new file mode 100644 index 0000000..5dd45a6 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +PLACK_ENV=development diff --git a/docker-compose.localapi.yml b/docker-compose.localapi.yml index fd32f2f..43c7c76 100644 --- a/docker-compose.localapi.yml +++ b/docker-compose.localapi.yml @@ -3,8 +3,8 @@ services: web: depends_on: - api - environment: - - NET_ASYNC_HTTP_MAXCONNS=1 + env_file: + - localapi.env volumes: - ./configs/metacpan-web/metacpan_web.conf:/metacpan-web/metacpan_web.conf api: @@ -14,12 +14,8 @@ services: image: metacpan-api:latest build: context: ./src/metacpan-api - environment: - - COLUMNS=80 - - ES=elasticsearch:9200 - - ES_TEST=elasticsearch_test:9200 - - MINICPAN=/CPAN - - PLACK_ENV=development + env_file: + - localapi.env volumes: - cpan:/CPAN - api_carton:/carton diff --git a/docker-compose.yml b/docker-compose.yml index 0abe35c..f7bf6de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,9 +4,6 @@ services: image: metacpan-web:latest build: context: ./src/metacpan-web - environment: - - COLUMNS=80 - - PLACK_ENV=development volumes: - web_carton:/carton - ./src/metacpan-web:/metacpan-web diff --git a/localapi.env b/localapi.env new file mode 100644 index 0000000..d67a223 --- /dev/null +++ b/localapi.env @@ -0,0 +1,5 @@ +NET_ASYNC_HTTP_MAXCONNS=1 +COLUMNS=80 +ES=elasticsearch:9200 +ES_TEST=elasticsearch_test:9200 +MINICPAN=/CPAN From a1b9c38c90ff7ef47d37475bc0c43a9cb837002f Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 7 Feb 2019 10:22:15 -0500 Subject: [PATCH 002/141] Add postgres container Define configuration and instantiation of a docker container for PostgreSQL. --- pg/Dockerfile | 5 +++++ pg/docker-entrypoint-initdb.d/100-roles.sql | 5 +++++ pg/docker-entrypoint-initdb.d/200-minion.sql | 1 + pg/healthcheck.sh | 21 ++++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 pg/Dockerfile create mode 100644 pg/docker-entrypoint-initdb.d/100-roles.sql create mode 100644 pg/docker-entrypoint-initdb.d/200-minion.sql create mode 100755 pg/healthcheck.sh diff --git a/pg/Dockerfile b/pg/Dockerfile new file mode 100644 index 0000000..a087e76 --- /dev/null +++ b/pg/Dockerfile @@ -0,0 +1,5 @@ +ARG PG_TAG=9.6-alpine + +FROM postgres:${PG_TAG} + +VOLUME /logs diff --git a/pg/docker-entrypoint-initdb.d/100-roles.sql b/pg/docker-entrypoint-initdb.d/100-roles.sql new file mode 100644 index 0000000..25f715f --- /dev/null +++ b/pg/docker-entrypoint-initdb.d/100-roles.sql @@ -0,0 +1,5 @@ +CREATE ROLE metacpan; +CREATE ROLE "metacpan-api"; + +-- make things easier for when we're poking around from inside the container +CREATE USER root; diff --git a/pg/docker-entrypoint-initdb.d/200-minion.sql b/pg/docker-entrypoint-initdb.d/200-minion.sql new file mode 100644 index 0000000..599486f --- /dev/null +++ b/pg/docker-entrypoint-initdb.d/200-minion.sql @@ -0,0 +1 @@ +CREATE DATABASE minion_queue OWNER metacpan diff --git a/pg/healthcheck.sh b/pg/healthcheck.sh new file mode 100755 index 0000000..cde0ff5 --- /dev/null +++ b/pg/healthcheck.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -eo pipefail + +host="$(hostname || echo '127.0.0.1')" +user="${POSTGRES_USER:-postgres}" +db="${POSTGRES_DB:-$POSTGRES_USER}" +export PGPASSWORD="${POSTGRES_PASSWORD:-}" + +args=( + # force postgres to not use the local unix socket (test "external" connectibility) + --host "$host" + --username "$user" + --dbname "$db" + --quiet --no-align --tuples-only +) + +if select="$(echo 'SELECT 1' | psql "${args[@]}")" && [ "$select" = '1' ]; then + exit 0 +fi + +exit 1 From 770d84817e76075c95260a4249360fcef01d8acd Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 8 Feb 2019 23:02:39 -0500 Subject: [PATCH 003/141] Change version number configuration The version of docker-compose file 3.4 allows for extended notation which allows for additional options to be specified (like readonly for mounts). --- docker-compose.localapi.yml | 3 ++- docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.localapi.yml b/docker-compose.localapi.yml index 43c7c76..9e67030 100644 --- a/docker-compose.localapi.yml +++ b/docker-compose.localapi.yml @@ -1,6 +1,7 @@ -version: '3' +version: '3.4' services: web: + image: metacpan-web:latest depends_on: - api env_file: diff --git a/docker-compose.yml b/docker-compose.yml index f7bf6de..d18f9cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3.4' services: web: image: metacpan-web:latest From c86b0016c0d7b92ae1c0dbc065d805a49e1a2fd8 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 8 Feb 2019 23:19:44 -0500 Subject: [PATCH 004/141] Add pgdb container Now that the postgres container has been defined, create a pgdb container to the compose file to build it. --- docker-compose.localapi.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docker-compose.localapi.yml b/docker-compose.localapi.yml index 9e67030..c4b18a2 100644 --- a/docker-compose.localapi.yml +++ b/docker-compose.localapi.yml @@ -30,6 +30,7 @@ services: networks: - elasticsearch - web + - database elasticsearch: image: elasticsearch:2.4 volumes: @@ -50,12 +51,43 @@ services: - "9900:9200" networks: - elasticsearch + pgdb: + hostname: pgdb + image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" + build: + context: './pg' + args: + PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" + ports: + - "5432:5432" + networks: + - database + healthcheck: + interval: 10s + timeout: 1s + retries: 0 + start_period: 480s + test: ["CMD", "/healthcheck.sh"] + volumes: + - type: volume + source: pgdb-data + target: /var/lib/postgresql/data + - type: bind + source: ./pg/docker-entrypoint-initdb.d + target: /docker-entrypoint-initdb.d + read_only: true + - type: bind + source: ./pg/healthcheck.sh + target: /healthcheck.sh + read_only: true networks: elasticsearch: + database: volumes: api_carton: cpan: elasticsearch: elasticsearch_test: + pgdb-data: From c7aa0263bc746ca6d9f6408a890a8f74f3131ba8 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 8 Feb 2019 23:21:41 -0500 Subject: [PATCH 005/141] Add configuration for minion database Set the api server's `minion_dsn` to connect to the pgdb container and the `minion_queue` database. --- configs/metacpan-api/metacpan_server.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/metacpan-api/metacpan_server.conf b/configs/metacpan-api/metacpan_server.conf index c064146..0fc6895 100644 --- a/configs/metacpan-api/metacpan_server.conf +++ b/configs/metacpan-api/metacpan_server.conf @@ -1,5 +1,6 @@ git /usr/bin/git cpan /CPAN +minion_dsn = postgresql://metacpan@pgdb/minion_queue servers elasticsearch:9200 From 589f3bfe1c36a2a51181e202f43f05802e9c3a0e Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Tue, 5 Mar 2019 17:05:00 -0500 Subject: [PATCH 006/141] Add Mojolicious secret configuration As this is just for development purposes at this point, adding in a secret to allow the Mojolicious application to start within the container. --- configs/metacpan-api/metacpan_server.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/metacpan-api/metacpan_server.conf b/configs/metacpan-api/metacpan_server.conf index 0fc6895..d2a2da8 100644 --- a/configs/metacpan-api/metacpan_server.conf +++ b/configs/metacpan-api/metacpan_server.conf @@ -1,6 +1,7 @@ git /usr/bin/git cpan /CPAN minion_dsn = postgresql://metacpan@pgdb/minion_queue +secret = I wish I had one to keep servers elasticsearch:9200 From eab20dacebce1e33187f80f92c8e9f41a8e80a7c Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Tue, 5 Mar 2019 17:07:19 -0500 Subject: [PATCH 007/141] Add dependency of api container to database The api container needs to have the database up and running in order for Minion to communicate and start running. Ensure that when the api container is being built that the database will also get built. --- docker-compose.localapi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.localapi.yml b/docker-compose.localapi.yml index c4b18a2..d568755 100644 --- a/docker-compose.localapi.yml +++ b/docker-compose.localapi.yml @@ -12,6 +12,7 @@ services: depends_on: - elasticsearch - elasticsearch_test + - pgdb image: metacpan-api:latest build: context: ./src/metacpan-api From f36d11f24c2dad8837d6c3b0bfc1122b7e33f7b7 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Tue, 5 Mar 2019 17:08:24 -0500 Subject: [PATCH 008/141] Add LOGIN permissions to new roles These were missing from the initial commit which causes metacpan and metacpan-api to be unable to log into the database. These statements could have been `CREATE USER` statements and would have avoided the need for `WITH LOGIN`, but the end result is the same now. --- pg/docker-entrypoint-initdb.d/100-roles.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pg/docker-entrypoint-initdb.d/100-roles.sql b/pg/docker-entrypoint-initdb.d/100-roles.sql index 25f715f..91fa225 100644 --- a/pg/docker-entrypoint-initdb.d/100-roles.sql +++ b/pg/docker-entrypoint-initdb.d/100-roles.sql @@ -1,5 +1,5 @@ -CREATE ROLE metacpan; -CREATE ROLE "metacpan-api"; +CREATE ROLE metacpan WITH LOGIN; +CREATE ROLE "metacpan-api" WITH LOGIN; -- make things easier for when we're poking around from inside the container CREATE USER root; From 030d896d0ff9adf921f955ba7e17eff98d7a74d5 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 16 Apr 2019 13:19:19 -0400 Subject: [PATCH 009/141] Update README with instructions to peek inside a container --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index eeac151..436cf4f 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,24 @@ setup, by configuring e.g. a `kibana` service. [12]: https://hub.docker.com/_/kibana/ +## Peeking Inside the Container + +If you run `docker ps` you'll see the containers. You might see something like: + +``` +$ docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +2efb9c475c83 metacpan-web:latest "carton exec plackup…" 12 hours ago Up 12 hours 0.0.0.0:5001->5001/tcp metacpan_web_1 +8850110e06d8 metacpan-api:latest "/wait-for-it.sh db:…" 12 hours ago Up 12 hours 0.0.0.0:5000->5000/tcp metacpan_api_1 +7686d7ea03c6 postgres:9.6-alpine "docker-entrypoint.s…" 12 hours ago Up 12 hours (healthy) 0.0.0.0:5432->5432/tcp metacpan_pgdb_1 +c7de256d29b2 elasticsearch:2.4 "/docker-entrypoint.…" 5 months ago Up 26 hours 0.0.0.0:9200->9200/tcp, 9300/tcp metacpan_elasticsearch_1 +f1e04fe53598 elasticsearch:2.4 "/docker-entrypoint.…" 5 months ago Up 26 hours 9300/tcp, 0.0.0.0:9900->9200/tcp metacpan_elasticsearch_test_1 +``` + +You can then use the container name to get shell access. For instance, to log in to the API container: + +`docker exec -it metacpan_api_1 /bin/bash` + ## To Do * Integrate other MetaCPAN services (e.g. github-meets-cpan) From 68b6e4e2d4937974f2940758b29fe64beaaf067a Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 25 Apr 2019 13:45:06 +0100 Subject: [PATCH 010/141] Add metacpan-base image This is a base level image to be used in the creation of other metacpan images. This image collects the common base perl distributions. --- base/Dockerfile | 15 + base/cpanfile | 3 + base/cpanfile.snapshot | 743 +++++++++++++++++++++++++++++++++++++++++ base/wait-for-it.sh | 202 +++++++++++ 4 files changed, 963 insertions(+) create mode 100644 base/Dockerfile create mode 100644 base/cpanfile create mode 100644 base/cpanfile.snapshot create mode 100755 base/wait-for-it.sh diff --git a/base/Dockerfile b/base/Dockerfile new file mode 100644 index 0000000..953d8a1 --- /dev/null +++ b/base/Dockerfile @@ -0,0 +1,15 @@ +ARG PERL_VERSION=5.28 +FROM perl:${PERL_VERSION} AS build + +WORKDIR /metacpan +COPY cpanfile cpanfile.snapshot /metacpan/ + +RUN apt-get update \ + && apt-get install -y libgmp-dev rsync \ + && cpanm App::cpm \ + && cpm install -g Carton \ + && cpm install -g + +FROM perl:${PERL_VERSION} +COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 +COPY wait-for-it.sh / diff --git a/base/cpanfile b/base/cpanfile new file mode 100644 index 0000000..c3316d4 --- /dev/null +++ b/base/cpanfile @@ -0,0 +1,3 @@ +requires 'Moose'; +requires 'Moo'; +requires 'Gazelle'; diff --git a/base/cpanfile.snapshot b/base/cpanfile.snapshot new file mode 100644 index 0000000..14a9f08 --- /dev/null +++ b/base/cpanfile.snapshot @@ -0,0 +1,743 @@ +# carton snapshot format: version 1.0 +DISTRIBUTIONS + Class-Load-0.25 + pathname: E/ET/ETHER/Class-Load-0.25.tar.gz + provides: + Class::Load 0.25 + Class::Load::PP 0.25 + requirements: + Carp 0 + Data::OptList 0.110 + Exporter 0 + ExtUtils::MakeMaker 0 + Module::Implementation 0.04 + Module::Runtime 0.012 + Package::Stash 0.14 + Scalar::Util 0 + Try::Tiny 0 + base 0 + perl 5.006 + strict 0 + warnings 0 + Class-Load-XS-0.10 + pathname: E/ET/ETHER/Class-Load-XS-0.10.tar.gz + provides: + Class::Load::XS 0.10 + requirements: + Class::Load 0.20 + ExtUtils::MakeMaker 0 + XSLoader 0 + perl 5.006 + strict 0 + warnings 0 + Class-Method-Modifiers-2.12 + pathname: E/ET/ETHER/Class-Method-Modifiers-2.12.tar.gz + provides: + Class::Method::Modifiers 2.12 + requirements: + B 0 + Carp 0 + Exporter 0 + ExtUtils::MakeMaker 0 + base 0 + perl 5.006 + strict 0 + warnings 0 + Data-OptList-0.110 + pathname: R/RJ/RJBS/Data-OptList-0.110.tar.gz + provides: + Data::OptList 0.110 + requirements: + ExtUtils::MakeMaker 0 + List::Util 0 + Params::Util 0 + Sub::Install 0.921 + strict 0 + warnings 0 + Devel-GlobalDestruction-0.14 + pathname: H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz + provides: + Devel::GlobalDestruction 0.14 + requirements: + ExtUtils::MakeMaker 0 + Sub::Exporter::Progressive 0.001011 + perl 5.006 + Devel-OverloadInfo-0.005 + pathname: I/IL/ILMARI/Devel-OverloadInfo-0.005.tar.gz + provides: + Devel::OverloadInfo 0.005 + requirements: + Exporter 5.57 + ExtUtils::MakeMaker 0 + MRO::Compat 0 + Package::Stash 0.14 + Scalar::Util 0 + Sub::Identify 0 + overload 0 + perl 5.006 + strict 0 + warnings 0 + Devel-StackTrace-2.03 + pathname: D/DR/DROLSKY/Devel-StackTrace-2.03.tar.gz + provides: + Devel::StackTrace 2.03 + Devel::StackTrace::Frame 2.03 + requirements: + ExtUtils::MakeMaker 0 + File::Spec 0 + Scalar::Util 0 + overload 0 + perl 5.006 + strict 0 + warnings 0 + Dist-CheckConflicts-0.11 + pathname: D/DO/DOY/Dist-CheckConflicts-0.11.tar.gz + provides: + Dist::CheckConflicts 0.11 + requirements: + Carp 0 + Exporter 0 + ExtUtils::MakeMaker 6.30 + Module::Runtime 0.009 + base 0 + strict 0 + warnings 0 + Eval-Closure-0.14 + pathname: D/DO/DOY/Eval-Closure-0.14.tar.gz + provides: + Eval::Closure 0.14 + requirements: + Carp 0 + Exporter 0 + ExtUtils::MakeMaker 0 + Scalar::Util 0 + constant 0 + overload 0 + strict 0 + warnings 0 + MRO-Compat-0.13 + pathname: H/HA/HAARG/MRO-Compat-0.13.tar.gz + provides: + MRO::Compat 0.13 + requirements: + ExtUtils::MakeMaker 0 + perl 5.006 + Module-Build-0.4229 + pathname: L/LE/LEONT/Module-Build-0.4229.tar.gz + provides: + Module::Build 0.4229 + Module::Build::Base 0.4229 + Module::Build::Compat 0.4229 + Module::Build::Config 0.4229 + Module::Build::Cookbook 0.4229 + Module::Build::Dumper 0.4229 + Module::Build::Notes 0.4229 + Module::Build::PPMMaker 0.4229 + Module::Build::Platform::Default 0.4229 + Module::Build::Platform::MacOS 0.4229 + Module::Build::Platform::Unix 0.4229 + Module::Build::Platform::VMS 0.4229 + Module::Build::Platform::VOS 0.4229 + Module::Build::Platform::Windows 0.4229 + Module::Build::Platform::aix 0.4229 + Module::Build::Platform::cygwin 0.4229 + Module::Build::Platform::darwin 0.4229 + Module::Build::Platform::os2 0.4229 + Module::Build::PodParser 0.4229 + requirements: + CPAN::Meta 2.142060 + Cwd 0 + Data::Dumper 0 + ExtUtils::CBuilder 0.27 + ExtUtils::Install 0 + ExtUtils::Manifest 0 + ExtUtils::Mkbootstrap 0 + ExtUtils::ParseXS 2.21 + File::Basename 0 + File::Compare 0 + File::Copy 0 + File::Find 0 + File::Path 0 + File::Spec 0.82 + Getopt::Long 0 + Module::Metadata 1.000002 + Perl::OSType 1 + Pod::Man 2.17 + TAP::Harness 3.29 + Text::Abbrev 0 + Text::ParseWords 0 + perl 5.006001 + version 0.87 + Module-Implementation-0.09 + pathname: D/DR/DROLSKY/Module-Implementation-0.09.tar.gz + provides: + Module::Implementation 0.09 + requirements: + Carp 0 + ExtUtils::MakeMaker 0 + Module::Runtime 0.012 + Try::Tiny 0 + strict 0 + warnings 0 + Module-Runtime-0.016 + pathname: Z/ZE/ZEFRAM/Module-Runtime-0.016.tar.gz + provides: + Module::Runtime 0.016 + requirements: + Module::Build 0 + Test::More 0.41 + perl 5.006 + strict 0 + warnings 0 + Module-Runtime-Conflicts-0.003 + pathname: E/ET/ETHER/Module-Runtime-Conflicts-0.003.tar.gz + provides: + Module::Runtime::Conflicts 0.003 + requirements: + Dist::CheckConflicts 0 + ExtUtils::MakeMaker 0 + Module::Runtime 0 + perl 5.006 + strict 0 + warnings 0 + Moo-2.003004 + pathname: H/HA/HAARG/Moo-2.003004.tar.gz + provides: + Method::Generate::Accessor undef + Method::Generate::BuildAll undef + Method::Generate::Constructor undef + Method::Generate::DemolishAll undef + Moo 2.003004 + Moo::HandleMoose undef + Moo::HandleMoose::FakeConstructor undef + Moo::HandleMoose::FakeMetaClass undef + Moo::HandleMoose::_TypeMap undef + Moo::Object undef + Moo::Role 2.003004 + Moo::_Utils undef + Moo::_mro undef + Moo::_strictures undef + Moo::sification undef + oo undef + requirements: + Class::Method::Modifiers 1.1 + Devel::GlobalDestruction 0.11 + Exporter 5.57 + ExtUtils::MakeMaker 0 + Module::Runtime 0.014 + Role::Tiny 2.000004 + Scalar::Util 0 + Sub::Defer 2.003001 + Sub::Quote 2.003001 + perl 5.006 + Moose-2.2011 + pathname: E/ET/ETHER/Moose-2.2011.tar.gz + provides: + Class::MOP 2.2011 + Class::MOP::Attribute 2.2011 + Class::MOP::Class 2.2011 + Class::MOP::Instance 2.2011 + Class::MOP::Method 2.2011 + Class::MOP::Method::Accessor 2.2011 + Class::MOP::Method::Constructor 2.2011 + Class::MOP::Method::Generated 2.2011 + Class::MOP::Method::Inlined 2.2011 + Class::MOP::Method::Meta 2.2011 + Class::MOP::Method::Wrapped 2.2011 + Class::MOP::Module 2.2011 + Class::MOP::Object 2.2011 + Class::MOP::Overload 2.2011 + Class::MOP::Package 2.2011 + Moose 2.2011 + Moose::Cookbook 2.2011 + Moose::Cookbook::Basics::BankAccount_MethodModifiersAndSubclassing 2.2011 + Moose::Cookbook::Basics::BinaryTree_AttributeFeatures 2.2011 + Moose::Cookbook::Basics::BinaryTree_BuilderAndLazyBuild 2.2011 + Moose::Cookbook::Basics::Company_Subtypes 2.2011 + Moose::Cookbook::Basics::DateTime_ExtendingNonMooseParent 2.2011 + Moose::Cookbook::Basics::Document_AugmentAndInner 2.2011 + Moose::Cookbook::Basics::Genome_OverloadingSubtypesAndCoercion 2.2011 + Moose::Cookbook::Basics::HTTP_SubtypesAndCoercion 2.2011 + Moose::Cookbook::Basics::Immutable 2.2011 + Moose::Cookbook::Basics::Person_BUILDARGSAndBUILD 2.2011 + Moose::Cookbook::Basics::Point_AttributesAndSubclassing 2.2011 + Moose::Cookbook::Extending::Debugging_BaseClassRole 2.2011 + Moose::Cookbook::Extending::ExtensionOverview 2.2011 + Moose::Cookbook::Extending::Mooseish_MooseSugar 2.2011 + Moose::Cookbook::Legacy::Debugging_BaseClassReplacement 2.2011 + Moose::Cookbook::Legacy::Labeled_AttributeMetaclass 2.2011 + Moose::Cookbook::Legacy::Table_ClassMetaclass 2.2011 + Moose::Cookbook::Meta::GlobRef_InstanceMetaclass 2.2011 + Moose::Cookbook::Meta::Labeled_AttributeTrait 2.2011 + Moose::Cookbook::Meta::PrivateOrPublic_MethodMetaclass 2.2011 + Moose::Cookbook::Meta::Table_MetaclassTrait 2.2011 + Moose::Cookbook::Meta::WhyMeta 2.2011 + Moose::Cookbook::Roles::ApplicationToInstance 2.2011 + Moose::Cookbook::Roles::Comparable_CodeReuse 2.2011 + Moose::Cookbook::Roles::Restartable_AdvancedComposition 2.2011 + Moose::Cookbook::Snack::Keywords 2.2011 + Moose::Cookbook::Snack::Types 2.2011 + Moose::Cookbook::Style 2.2011 + Moose::Exception 2.2011 + Moose::Exception::AccessorMustReadWrite 2.2011 + Moose::Exception::AddParameterizableTypeTakesParameterizableType 2.2011 + Moose::Exception::AddRoleTakesAMooseMetaRoleInstance 2.2011 + Moose::Exception::AddRoleToARoleTakesAMooseMetaRole 2.2011 + Moose::Exception::ApplyTakesABlessedInstance 2.2011 + Moose::Exception::AttachToClassNeedsAClassMOPClassInstanceOrASubclass 2.2011 + Moose::Exception::AttributeConflictInRoles 2.2011 + Moose::Exception::AttributeConflictInSummation 2.2011 + Moose::Exception::AttributeExtensionIsNotSupportedInRoles 2.2011 + Moose::Exception::AttributeIsRequired 2.2011 + Moose::Exception::AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass 2.2011 + Moose::Exception::AttributeNamesDoNotMatch 2.2011 + Moose::Exception::AttributeValueIsNotAnObject 2.2011 + Moose::Exception::AttributeValueIsNotDefined 2.2011 + Moose::Exception::AutoDeRefNeedsArrayRefOrHashRef 2.2011 + Moose::Exception::BadOptionFormat 2.2011 + Moose::Exception::BothBuilderAndDefaultAreNotAllowed 2.2011 + Moose::Exception::BuilderDoesNotExist 2.2011 + Moose::Exception::BuilderMethodNotSupportedForAttribute 2.2011 + Moose::Exception::BuilderMethodNotSupportedForInlineAttribute 2.2011 + Moose::Exception::BuilderMustBeAMethodName 2.2011 + Moose::Exception::CallingMethodOnAnImmutableInstance 2.2011 + Moose::Exception::CallingReadOnlyMethodOnAnImmutableInstance 2.2011 + Moose::Exception::CanExtendOnlyClasses 2.2011 + Moose::Exception::CanOnlyConsumeRole 2.2011 + Moose::Exception::CanOnlyWrapBlessedCode 2.2011 + Moose::Exception::CanReblessOnlyIntoASubclass 2.2011 + Moose::Exception::CanReblessOnlyIntoASuperclass 2.2011 + Moose::Exception::CannotAddAdditionalTypeCoercionsToUnion 2.2011 + Moose::Exception::CannotAddAsAnAttributeToARole 2.2011 + Moose::Exception::CannotApplyBaseClassRolesToRole 2.2011 + Moose::Exception::CannotAssignValueToReadOnlyAccessor 2.2011 + Moose::Exception::CannotAugmentIfLocalMethodPresent 2.2011 + Moose::Exception::CannotAugmentNoSuperMethod 2.2011 + Moose::Exception::CannotAutoDerefWithoutIsa 2.2011 + Moose::Exception::CannotAutoDereferenceTypeConstraint 2.2011 + Moose::Exception::CannotCalculateNativeType 2.2011 + Moose::Exception::CannotCallAnAbstractBaseMethod 2.2011 + Moose::Exception::CannotCallAnAbstractMethod 2.2011 + Moose::Exception::CannotCoerceAWeakRef 2.2011 + Moose::Exception::CannotCoerceAttributeWhichHasNoCoercion 2.2011 + Moose::Exception::CannotCreateHigherOrderTypeWithoutATypeParameter 2.2011 + Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresent 2.2011 + Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresentInClass 2.2011 + Moose::Exception::CannotDelegateLocalMethodIsPresent 2.2011 + Moose::Exception::CannotDelegateWithoutIsa 2.2011 + Moose::Exception::CannotFindDelegateMetaclass 2.2011 + Moose::Exception::CannotFindType 2.2011 + Moose::Exception::CannotFindTypeGivenToMatchOnType 2.2011 + Moose::Exception::CannotFixMetaclassCompatibility 2.2011 + Moose::Exception::CannotGenerateInlineConstraint 2.2011 + Moose::Exception::CannotInitializeMooseMetaRoleComposite 2.2011 + Moose::Exception::CannotInlineTypeConstraintCheck 2.2011 + Moose::Exception::CannotLocatePackageInINC 2.2011 + Moose::Exception::CannotMakeMetaclassCompatible 2.2011 + Moose::Exception::CannotOverrideALocalMethod 2.2011 + Moose::Exception::CannotOverrideBodyOfMetaMethods 2.2011 + Moose::Exception::CannotOverrideLocalMethodIsPresent 2.2011 + Moose::Exception::CannotOverrideNoSuperMethod 2.2011 + Moose::Exception::CannotRegisterUnnamedTypeConstraint 2.2011 + Moose::Exception::CannotUseLazyBuildAndDefaultSimultaneously 2.2011 + Moose::Exception::CircularReferenceInAlso 2.2011 + Moose::Exception::ClassDoesNotHaveInitMeta 2.2011 + Moose::Exception::ClassDoesTheExcludedRole 2.2011 + Moose::Exception::ClassNamesDoNotMatch 2.2011 + Moose::Exception::CloneObjectExpectsAnInstanceOfMetaclass 2.2011 + Moose::Exception::CodeBlockMustBeACodeRef 2.2011 + Moose::Exception::CoercingWithoutCoercions 2.2011 + Moose::Exception::CoercionAlreadyExists 2.2011 + Moose::Exception::CoercionNeedsTypeConstraint 2.2011 + Moose::Exception::ConflictDetectedInCheckRoleExclusions 2.2011 + Moose::Exception::ConflictDetectedInCheckRoleExclusionsInToClass 2.2011 + Moose::Exception::ConstructClassInstanceTakesPackageName 2.2011 + Moose::Exception::CouldNotCreateMethod 2.2011 + Moose::Exception::CouldNotCreateWriter 2.2011 + Moose::Exception::CouldNotEvalConstructor 2.2011 + Moose::Exception::CouldNotEvalDestructor 2.2011 + Moose::Exception::CouldNotFindTypeConstraintToCoerceFrom 2.2011 + Moose::Exception::CouldNotGenerateInlineAttributeMethod 2.2011 + Moose::Exception::CouldNotLocateTypeConstraintForUnion 2.2011 + Moose::Exception::CouldNotParseType 2.2011 + Moose::Exception::CreateMOPClassTakesArrayRefOfAttributes 2.2011 + Moose::Exception::CreateMOPClassTakesArrayRefOfSuperclasses 2.2011 + Moose::Exception::CreateMOPClassTakesHashRefOfMethods 2.2011 + Moose::Exception::CreateTakesArrayRefOfRoles 2.2011 + Moose::Exception::CreateTakesHashRefOfAttributes 2.2011 + Moose::Exception::CreateTakesHashRefOfMethods 2.2011 + Moose::Exception::DefaultToMatchOnTypeMustBeCodeRef 2.2011 + Moose::Exception::DelegationToAClassWhichIsNotLoaded 2.2011 + Moose::Exception::DelegationToARoleWhichIsNotLoaded 2.2011 + Moose::Exception::DelegationToATypeWhichIsNotAClass 2.2011 + Moose::Exception::DoesRequiresRoleName 2.2011 + Moose::Exception::EnumCalledWithAnArrayRefAndAdditionalArgs 2.2011 + Moose::Exception::EnumValuesMustBeString 2.2011 + Moose::Exception::ExtendsMissingArgs 2.2011 + Moose::Exception::HandlesMustBeAHashRef 2.2011 + Moose::Exception::IllegalInheritedOptions 2.2011 + Moose::Exception::IllegalMethodTypeToAddMethodModifier 2.2011 + Moose::Exception::IncompatibleMetaclassOfSuperclass 2.2011 + Moose::Exception::InitMetaRequiresClass 2.2011 + Moose::Exception::InitializeTakesUnBlessedPackageName 2.2011 + Moose::Exception::InstanceBlessedIntoWrongClass 2.2011 + Moose::Exception::InstanceMustBeABlessedReference 2.2011 + Moose::Exception::InvalidArgPassedToMooseUtilMetaRole 2.2011 + Moose::Exception::InvalidArgumentToMethod 2.2011 + Moose::Exception::InvalidArgumentsToTraitAliases 2.2011 + Moose::Exception::InvalidBaseTypeGivenToCreateParameterizedTypeConstraint 2.2011 + Moose::Exception::InvalidHandleValue 2.2011 + Moose::Exception::InvalidHasProvidedInARole 2.2011 + Moose::Exception::InvalidNameForType 2.2011 + Moose::Exception::InvalidOverloadOperator 2.2011 + Moose::Exception::InvalidRoleApplication 2.2011 + Moose::Exception::InvalidTypeConstraint 2.2011 + Moose::Exception::InvalidTypeGivenToCreateParameterizedTypeConstraint 2.2011 + Moose::Exception::InvalidValueForIs 2.2011 + Moose::Exception::IsaDoesNotDoTheRole 2.2011 + Moose::Exception::IsaLacksDoesMethod 2.2011 + Moose::Exception::LazyAttributeNeedsADefault 2.2011 + Moose::Exception::Legacy 2.2011 + Moose::Exception::MOPAttributeNewNeedsAttributeName 2.2011 + Moose::Exception::MatchActionMustBeACodeRef 2.2011 + Moose::Exception::MessageParameterMustBeCodeRef 2.2011 + Moose::Exception::MetaclassIsAClassNotASubclassOfGivenMetaclass 2.2011 + Moose::Exception::MetaclassIsARoleNotASubclassOfGivenMetaclass 2.2011 + Moose::Exception::MetaclassIsNotASubclassOfGivenMetaclass 2.2011 + Moose::Exception::MetaclassMustBeASubclassOfMooseMetaClass 2.2011 + Moose::Exception::MetaclassMustBeASubclassOfMooseMetaRole 2.2011 + Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass 2.2011 + Moose::Exception::MetaclassNotLoaded 2.2011 + Moose::Exception::MetaclassTypeIncompatible 2.2011 + Moose::Exception::MethodExpectedAMetaclassObject 2.2011 + Moose::Exception::MethodExpectsFewerArgs 2.2011 + Moose::Exception::MethodExpectsMoreArgs 2.2011 + Moose::Exception::MethodModifierNeedsMethodName 2.2011 + Moose::Exception::MethodNameConflictInRoles 2.2011 + Moose::Exception::MethodNameNotFoundInInheritanceHierarchy 2.2011 + Moose::Exception::MethodNameNotGiven 2.2011 + Moose::Exception::MustDefineAMethodName 2.2011 + Moose::Exception::MustDefineAnAttributeName 2.2011 + Moose::Exception::MustDefineAnOverloadOperator 2.2011 + Moose::Exception::MustHaveAtLeastOneValueToEnumerate 2.2011 + Moose::Exception::MustPassAHashOfOptions 2.2011 + Moose::Exception::MustPassAMooseMetaRoleInstanceOrSubclass 2.2011 + Moose::Exception::MustPassAPackageNameOrAnExistingClassMOPPackageInstance 2.2011 + Moose::Exception::MustPassEvenNumberOfArguments 2.2011 + Moose::Exception::MustPassEvenNumberOfAttributeOptions 2.2011 + Moose::Exception::MustProvideANameForTheAttribute 2.2011 + Moose::Exception::MustSpecifyAtleastOneMethod 2.2011 + Moose::Exception::MustSpecifyAtleastOneRole 2.2011 + Moose::Exception::MustSpecifyAtleastOneRoleToApplicant 2.2011 + Moose::Exception::MustSupplyAClassMOPAttributeInstance 2.2011 + Moose::Exception::MustSupplyADelegateToMethod 2.2011 + Moose::Exception::MustSupplyAMetaclass 2.2011 + Moose::Exception::MustSupplyAMooseMetaAttributeInstance 2.2011 + Moose::Exception::MustSupplyAnAccessorTypeToConstructWith 2.2011 + Moose::Exception::MustSupplyAnAttributeToConstructWith 2.2011 + Moose::Exception::MustSupplyArrayRefAsCurriedArguments 2.2011 + Moose::Exception::MustSupplyPackageNameAndName 2.2011 + Moose::Exception::NeedsTypeConstraintUnionForTypeCoercionUnion 2.2011 + Moose::Exception::NeitherAttributeNorAttributeNameIsGiven 2.2011 + Moose::Exception::NeitherClassNorClassNameIsGiven 2.2011 + Moose::Exception::NeitherRoleNorRoleNameIsGiven 2.2011 + Moose::Exception::NeitherTypeNorTypeNameIsGiven 2.2011 + Moose::Exception::NoAttributeFoundInSuperClass 2.2011 + Moose::Exception::NoBodyToInitializeInAnAbstractBaseClass 2.2011 + Moose::Exception::NoCasesMatched 2.2011 + Moose::Exception::NoConstraintCheckForTypeConstraint 2.2011 + Moose::Exception::NoDestructorClassSpecified 2.2011 + Moose::Exception::NoImmutableTraitSpecifiedForClass 2.2011 + Moose::Exception::NoParentGivenToSubtype 2.2011 + Moose::Exception::OnlyInstancesCanBeCloned 2.2011 + Moose::Exception::OperatorIsRequired 2.2011 + Moose::Exception::OverloadConflictInSummation 2.2011 + Moose::Exception::OverloadRequiresAMetaClass 2.2011 + Moose::Exception::OverloadRequiresAMetaMethod 2.2011 + Moose::Exception::OverloadRequiresAMetaOverload 2.2011 + Moose::Exception::OverloadRequiresAMethodNameOrCoderef 2.2011 + Moose::Exception::OverloadRequiresAnOperator 2.2011 + Moose::Exception::OverloadRequiresNamesForCoderef 2.2011 + Moose::Exception::OverrideConflictInComposition 2.2011 + Moose::Exception::OverrideConflictInSummation 2.2011 + Moose::Exception::PackageDoesNotUseMooseExporter 2.2011 + Moose::Exception::PackageNameAndNameParamsNotGivenToWrap 2.2011 + Moose::Exception::PackagesAndModulesAreNotCachable 2.2011 + Moose::Exception::ParameterIsNotSubtypeOfParent 2.2011 + Moose::Exception::ReferencesAreNotAllowedAsDefault 2.2011 + Moose::Exception::RequiredAttributeLacksInitialization 2.2011 + Moose::Exception::RequiredAttributeNeedsADefault 2.2011 + Moose::Exception::RequiredMethodsImportedByClass 2.2011 + Moose::Exception::RequiredMethodsNotImplementedByClass 2.2011 + Moose::Exception::Role::Attribute 2.2011 + Moose::Exception::Role::AttributeName 2.2011 + Moose::Exception::Role::Class 2.2011 + Moose::Exception::Role::EitherAttributeOrAttributeName 2.2011 + Moose::Exception::Role::Instance 2.2011 + Moose::Exception::Role::InstanceClass 2.2011 + Moose::Exception::Role::InvalidAttributeOptions 2.2011 + Moose::Exception::Role::Method 2.2011 + Moose::Exception::Role::ParamsHash 2.2011 + Moose::Exception::Role::Role 2.2011 + Moose::Exception::Role::RoleForCreate 2.2011 + Moose::Exception::Role::RoleForCreateMOPClass 2.2011 + Moose::Exception::Role::TypeConstraint 2.2011 + Moose::Exception::RoleDoesTheExcludedRole 2.2011 + Moose::Exception::RoleExclusionConflict 2.2011 + Moose::Exception::RoleNameRequired 2.2011 + Moose::Exception::RoleNameRequiredForMooseMetaRole 2.2011 + Moose::Exception::RolesDoNotSupportAugment 2.2011 + Moose::Exception::RolesDoNotSupportExtends 2.2011 + Moose::Exception::RolesDoNotSupportInner 2.2011 + Moose::Exception::RolesDoNotSupportRegexReferencesForMethodModifiers 2.2011 + Moose::Exception::RolesInCreateTakesAnArrayRef 2.2011 + Moose::Exception::RolesListMustBeInstancesOfMooseMetaRole 2.2011 + Moose::Exception::SingleParamsToNewMustBeHashRef 2.2011 + Moose::Exception::TriggerMustBeACodeRef 2.2011 + Moose::Exception::TypeConstraintCannotBeUsedForAParameterizableType 2.2011 + Moose::Exception::TypeConstraintIsAlreadyCreated 2.2011 + Moose::Exception::TypeParameterMustBeMooseMetaType 2.2011 + Moose::Exception::UnableToCanonicalizeHandles 2.2011 + Moose::Exception::UnableToCanonicalizeNonRolePackage 2.2011 + Moose::Exception::UnableToRecognizeDelegateMetaclass 2.2011 + Moose::Exception::UndefinedHashKeysPassedToMethod 2.2011 + Moose::Exception::UnionCalledWithAnArrayRefAndAdditionalArgs 2.2011 + Moose::Exception::UnionTakesAtleastTwoTypeNames 2.2011 + Moose::Exception::ValidationFailedForInlineTypeConstraint 2.2011 + Moose::Exception::ValidationFailedForTypeConstraint 2.2011 + Moose::Exception::WrapTakesACodeRefToBless 2.2011 + Moose::Exception::WrongTypeConstraintGiven 2.2011 + Moose::Exporter 2.2011 + Moose::Intro 2.2011 + Moose::Manual 2.2011 + Moose::Manual::Attributes 2.2011 + Moose::Manual::BestPractices 2.2011 + Moose::Manual::Classes 2.2011 + Moose::Manual::Concepts 2.2011 + Moose::Manual::Construction 2.2011 + Moose::Manual::Contributing 2.2011 + Moose::Manual::Delegation 2.2011 + Moose::Manual::Delta 2.2011 + Moose::Manual::Exceptions 2.2011 + Moose::Manual::Exceptions::Manifest 2.2011 + Moose::Manual::FAQ 2.2011 + Moose::Manual::MOP 2.2011 + Moose::Manual::MethodModifiers 2.2011 + Moose::Manual::MooseX 2.2011 + Moose::Manual::Resources 2.2011 + Moose::Manual::Roles 2.2011 + Moose::Manual::Support 2.2011 + Moose::Manual::Types 2.2011 + Moose::Manual::Unsweetened 2.2011 + Moose::Meta::Attribute 2.2011 + Moose::Meta::Attribute::Native 2.2011 + Moose::Meta::Attribute::Native::Trait::Array 2.2011 + Moose::Meta::Attribute::Native::Trait::Bool 2.2011 + Moose::Meta::Attribute::Native::Trait::Code 2.2011 + Moose::Meta::Attribute::Native::Trait::Counter 2.2011 + Moose::Meta::Attribute::Native::Trait::Hash 2.2011 + Moose::Meta::Attribute::Native::Trait::Number 2.2011 + Moose::Meta::Attribute::Native::Trait::String 2.2011 + Moose::Meta::Class 2.2011 + Moose::Meta::Instance 2.2011 + Moose::Meta::Method 2.2011 + Moose::Meta::Method::Accessor 2.2011 + Moose::Meta::Method::Augmented 2.2011 + Moose::Meta::Method::Constructor 2.2011 + Moose::Meta::Method::Delegation 2.2011 + Moose::Meta::Method::Destructor 2.2011 + Moose::Meta::Method::Meta 2.2011 + Moose::Meta::Method::Overridden 2.2011 + Moose::Meta::Role 2.2011 + Moose::Meta::Role::Application 2.2011 + Moose::Meta::Role::Application::RoleSummation 2.2011 + Moose::Meta::Role::Application::ToClass 2.2011 + Moose::Meta::Role::Application::ToInstance 2.2011 + Moose::Meta::Role::Application::ToRole 2.2011 + Moose::Meta::Role::Attribute 2.2011 + Moose::Meta::Role::Composite 2.2011 + Moose::Meta::Role::Method 2.2011 + Moose::Meta::Role::Method::Conflicting 2.2011 + Moose::Meta::Role::Method::Required 2.2011 + Moose::Meta::TypeCoercion 2.2011 + Moose::Meta::TypeCoercion::Union 2.2011 + Moose::Meta::TypeConstraint 2.2011 + Moose::Meta::TypeConstraint::Class 2.2011 + Moose::Meta::TypeConstraint::DuckType 2.2011 + Moose::Meta::TypeConstraint::Enum 2.2011 + Moose::Meta::TypeConstraint::Parameterizable 2.2011 + Moose::Meta::TypeConstraint::Parameterized 2.2011 + Moose::Meta::TypeConstraint::Registry 2.2011 + Moose::Meta::TypeConstraint::Role 2.2011 + Moose::Meta::TypeConstraint::Union 2.2011 + Moose::Object 2.2011 + Moose::Role 2.2011 + Moose::Spec::Role 2.2011 + Moose::Unsweetened 2.2011 + Moose::Util 2.2011 + Moose::Util::MetaRole 2.2011 + Moose::Util::TypeConstraints 2.2011 + Test::Moose 2.2011 + metaclass 2.2011 + oose 2.2011 + requirements: + Carp 1.22 + Class::Load 0.09 + Class::Load::XS 0.01 + Data::OptList 0.107 + Devel::GlobalDestruction 0 + Devel::OverloadInfo 0.005 + Devel::StackTrace 2.03 + Dist::CheckConflicts 0.02 + Eval::Closure 0.04 + ExtUtils::MakeMaker 0 + List::Util 1.45 + MRO::Compat 0.05 + Module::Runtime 0.014 + Module::Runtime::Conflicts 0.002 + Package::DeprecationManager 0.11 + Package::Stash 0.32 + Package::Stash::XS 0.24 + Params::Util 1.00 + Scalar::Util 1.19 + Sub::Exporter 0.980 + Sub::Identify 0 + Sub::Name 0.20 + Try::Tiny 0.17 + parent 0.223 + strict 1.03 + warnings 1.03 + Package-DeprecationManager-0.17 + pathname: D/DR/DROLSKY/Package-DeprecationManager-0.17.tar.gz + provides: + Package::DeprecationManager 0.17 + requirements: + Carp 0 + ExtUtils::MakeMaker 0 + List::Util 1.33 + Package::Stash 0 + Params::Util 0 + Sub::Install 0 + Sub::Name 0 + strict 0 + warnings 0 + Package-Stash-0.38 + pathname: E/ET/ETHER/Package-Stash-0.38.tar.gz + provides: + Package::Stash 0.38 + Package::Stash::PP 0.38 + requirements: + B 0 + Carp 0 + Config 0 + Dist::CheckConflicts 0.02 + ExtUtils::MakeMaker 0 + File::Spec 0 + Getopt::Long 0 + Module::Implementation 0.06 + Package::Stash::XS 0.26 + Scalar::Util 0 + Symbol 0 + Text::ParseWords 0 + constant 0 + perl 5.008001 + strict 0 + warnings 0 + Package-Stash-XS-0.29 + pathname: E/ET/ETHER/Package-Stash-XS-0.29.tar.gz + provides: + Package::Stash::XS 0.29 + requirements: + ExtUtils::MakeMaker 0 + XSLoader 0 + perl 5.008001 + strict 0 + warnings 0 + Params-Util-1.07 + pathname: A/AD/ADAMK/Params-Util-1.07.tar.gz + provides: + Params::Util 1.07 + requirements: + ExtUtils::CBuilder 0.27 + ExtUtils::MakeMaker 6.52 + File::Spec 0.80 + Scalar::Util 1.18 + Test::More 0.42 + perl 5.00503 + Role-Tiny-2.000006 + pathname: H/HA/HAARG/Role-Tiny-2.000006.tar.gz + provides: + Role::Tiny 2.000006 + Role::Tiny::With 2.000006 + requirements: + Exporter 5.57 + perl 5.006 + Sub-Exporter-0.987 + pathname: R/RJ/RJBS/Sub-Exporter-0.987.tar.gz + provides: + Sub::Exporter 0.987 + Sub::Exporter::Util 0.987 + requirements: + Carp 0 + Data::OptList 0.100 + ExtUtils::MakeMaker 6.30 + Params::Util 0.14 + Sub::Install 0.92 + strict 0 + warnings 0 + Sub-Exporter-Progressive-0.001013 + pathname: F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz + provides: + Sub::Exporter::Progressive 0.001013 + requirements: + ExtUtils::MakeMaker 0 + Sub-Identify-0.14 + pathname: R/RG/RGARCIA/Sub-Identify-0.14.tar.gz + provides: + Sub::Identify 0.14 + requirements: + ExtUtils::MakeMaker 0 + Test::More 0 + Sub-Install-0.928 + pathname: R/RJ/RJBS/Sub-Install-0.928.tar.gz + provides: + Sub::Install 0.928 + requirements: + B 0 + Carp 0 + ExtUtils::MakeMaker 6.30 + Scalar::Util 0 + strict 0 + warnings 0 + Sub-Name-0.21 + pathname: E/ET/ETHER/Sub-Name-0.21.tar.gz + provides: + Sub::Name 0.21 + requirements: + Exporter 5.57 + ExtUtils::MakeMaker 0 + XSLoader 0 + perl 5.006 + strict 0 + warnings 0 + Sub-Quote-2.006003 + pathname: H/HA/HAARG/Sub-Quote-2.006003.tar.gz + provides: + Sub::Defer 2.006003 + Sub::Quote 2.006003 + requirements: + ExtUtils::MakeMaker 0 + Scalar::Util 0 + perl 5.006 + Try-Tiny-0.30 + pathname: E/ET/ETHER/Try-Tiny-0.30.tar.gz + provides: + Try::Tiny 0.30 + requirements: + Carp 0 + Exporter 5.57 + ExtUtils::MakeMaker 0 + constant 0 + perl 5.006 + strict 0 + warnings 0 diff --git a/base/wait-for-it.sh b/base/wait-for-it.sh new file mode 100755 index 0000000..33e0d0e --- /dev/null +++ b/base/wait-for-it.sh @@ -0,0 +1,202 @@ +#!/bin/bash +# +# See https://github.com/vishnubob/wait-for-it +# +# The MIT License (MIT) +# Copyright (c) 2016 Giles Hall + +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +# of the Software, and to permit persons to whom the Software is furnished to do +# so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +cmdname=$(basename $0) + +echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } + +usage() +{ + cat << USAGE >&2 +Usage: + $cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() +{ + if [[ $TIMEOUT -gt 0 ]]; then + echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" + else + echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" + fi + start_ts=$(date +%s) + while : + do + if [[ $ISBUSY -eq 1 ]]; then + nc -z $HOST $PORT + result=$? + else + (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 + result=$? + fi + if [[ $result -eq 0 ]]; then + end_ts=$(date +%s) + echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" + break + fi + sleep 1 + done + return $result +} + +wait_for_wrapper() +{ + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $QUIET -eq 1 ]]; then + timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & + else + timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & + fi + PID=$! + trap "kill -INT -$PID" INT + wait $PID + RESULT=$? + if [[ $RESULT -ne 0 ]]; then + echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" + fi + return $RESULT +} + +# process arguments +while [[ $# -gt 0 ]] +do + case "$1" in + *:* ) + hostport=(${1//:/ }) + HOST=${hostport[0]} + PORT=${hostport[1]} + shift 1 + ;; + --child) + CHILD=1 + shift 1 + ;; + -q | --quiet) + QUIET=1 + shift 1 + ;; + -s | --strict) + STRICT=1 + shift 1 + ;; + -h) + HOST="$2" + if [[ $HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + HOST="${1#*=}" + shift 1 + ;; + -p) + PORT="$2" + if [[ $PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + PORT="${1#*=}" + shift 1 + ;; + -t) + TIMEOUT="$2" + if [[ $TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + CLI=("$@") + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$HOST" == "" || "$PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +TIMEOUT=${TIMEOUT:-15} +STRICT=${STRICT:-0} +CHILD=${CHILD:-0} +QUIET=${QUIET:-0} + +# check to see if timeout is from busybox? +# check to see if timeout is from busybox? +TIMEOUT_PATH=$(realpath $(which timeout)) +if [[ $TIMEOUT_PATH =~ "busybox" ]]; then + ISBUSY=1 + BUSYTIMEFLAG="-t" +else + ISBUSY=0 + BUSYTIMEFLAG="" +fi + +if [[ $CHILD -gt 0 ]]; then + wait_for + RESULT=$? + exit $RESULT +else + if [[ $TIMEOUT -gt 0 ]]; then + wait_for_wrapper + RESULT=$? + else + wait_for + RESULT=$? + fi +fi + +if [[ $CLI != "" ]]; then + if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then + echoerr "$cmdname: strict mode, refusing to execute subprocess" + exit $RESULT + fi + exec "${CLI[@]}" +else + exit $RESULT +fi From 434cadf9128729fd27850176f0ec699df0573f37 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Thu, 25 Apr 2019 15:01:38 +0100 Subject: [PATCH 011/141] Create a travis file to run the docker build of the base image --- .travis.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6fcd25b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +notifications: + email: + recipients: + - leo@Wcuckoo.org + on_success: always + on_failure: always + irc: "irc.perl.org#metacpan-travis" + +script: + - cd base && docker build --tag metacpan-base . + +services: + - docker From 11216c62b8e272fba218f6892dc9352c10200f39 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 25 Apr 2019 15:24:02 +0100 Subject: [PATCH 012/141] Add bin directory All the perl tools are installed in `/usr/local/bin`, copy it into the new image so that the tools are executable. --- base/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/base/Dockerfile b/base/Dockerfile index 953d8a1..503d16c 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -12,4 +12,5 @@ RUN apt-get update \ FROM perl:${PERL_VERSION} COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 +COPY --from=build /usr/local/bin /usr/local/bin COPY wait-for-it.sh / From d936bc18903ba9b5b18a5cf7c30c6040d7c605f2 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 25 Apr 2019 15:24:38 +0100 Subject: [PATCH 013/141] Add setting of the project name The current way for setting the project name for docker-compose is through the COMPOSE_PROJECT_NAME environment variable. --- .env | 1 + 1 file changed, 1 insertion(+) diff --git a/.env b/.env index 5dd45a6..54bea79 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ +COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development From 0051c3c9955a5b5c50c9c00cdd486ec5ca45ac6a Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Thu, 25 Apr 2019 17:23:54 +0100 Subject: [PATCH 014/141] Deploy image to docker hub --- .travis.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fcd25b..f75f7d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,27 @@ +services: + - docker + notifications: email: recipients: - - leo@Wcuckoo.org - on_success: always + - leo@cuckoo.org + on_success: never on_failure: always irc: "irc.perl.org#metacpan-travis" +before_script: + - docker pull metacpan/metacpan-base || true + script: - - cd base && docker build --tag metacpan-base . + - cd base + - docker build --pull --cache-from metacpan/metacpan-base --tag metacpan/metacpan-base . + +before_deploy: + - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASS" + +deploy: + provider: script + script: docker push metacpan/metacpan-base + on: + branch: master -services: - - docker From 46474b3444c5fa33bbc41211cbd5dba18a7db3ca Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Thu, 25 Apr 2019 17:55:33 +0100 Subject: [PATCH 015/141] real env var --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f75f7d0..1867ef4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ script: - docker build --pull --cache-from metacpan/metacpan-base --tag metacpan/metacpan-base . before_deploy: - - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASS" + - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWD" deploy: provider: script From 910d067c9018aad65112bc1e2666d949031db599 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 10:15:22 +0100 Subject: [PATCH 016/141] adding version number to images --- .travis.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1867ef4..6e442af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ services: - docker +env: + global: + - DOCKER_HUB_NAME: metacpan/metacpan-base + - VERSION: "${TRAVIS_BUILD_NUMBER}" + - TAG: "${DOCKER_HUB_NAME}:${VERSION}" + notifications: email: recipients: @@ -9,19 +15,21 @@ notifications: on_failure: always irc: "irc.perl.org#metacpan-travis" +# Pull from docker hub so can use as cache for initial steps before_script: - - docker pull metacpan/metacpan-base || true + - docker pull "$DOCKER_HUB_NAME" || true +# Perform build, make sure to pull image deps and build from the fetched version as cache script: - cd base - - docker build --pull --cache-from metacpan/metacpan-base --tag metacpan/metacpan-base . + - docker build --pull --cache-from "$DOCKER_HUB_NAME" --tag "$TAG" . before_deploy: - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWD" deploy: provider: script - script: docker push metacpan/metacpan-base + script: docker push "$TAG" on: branch: master From 3adef4d8d1d6555223376fd5a4beaa154e77ad16 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 11:10:41 +0100 Subject: [PATCH 017/141] push as latest and as verison --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6e442af..a5a2718 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,9 +27,12 @@ script: before_deploy: - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWD" +# Deploy this build as a version AND as latest deploy: provider: script - script: docker push "$TAG" + script: + - docker push "$TAG" + - docker push "${DOCKER_HUB_NAME}:latest" on: branch: master From 4b39c16bfc77a46e21f528dc8c3a79de88d2e048 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 11:20:21 +0100 Subject: [PATCH 018/141] just test one line on script for deploy --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a5a2718..22200d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,6 @@ deploy: provider: script script: - docker push "$TAG" - - docker push "${DOCKER_HUB_NAME}:latest" on: branch: master From da92aac92f8b961f240149d8d2d49a5c367165c1 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 11:29:19 +0100 Subject: [PATCH 019/141] deploy latest without tag and see what happens --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 22200d0..70fcfee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ deploy: provider: script script: - docker push "$TAG" + - docker push "$DOCKER_HUB_NAME" on: branch: master From 6bcf20b34f22c18da4482fea88cf4194bf091215 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 11:40:29 +0100 Subject: [PATCH 020/141] split out the push commands for travis --- .travis.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 70fcfee..c829a77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,13 @@ before_deploy: # Deploy this build as a version AND as latest deploy: - provider: script - script: - - docker push "$TAG" - - docker push "$DOCKER_HUB_NAME" - on: - branch: master - + - provider: script + script: + - docker push "$TAG" + on: + branch: master + - provider: script + script: + - docker push "$DOCKER_HUB_NAME" + on: + branch: master From 8f16b0f7f7619f4e1ff425e6bcd2173739cce52c Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 11:50:53 +0100 Subject: [PATCH 021/141] try build without tag to help with push --- .travis.yml | 2 +- base/Dockerfile | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c829a77..7fddb01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_script: # Perform build, make sure to pull image deps and build from the fetched version as cache script: - cd base - - docker build --pull --cache-from "$DOCKER_HUB_NAME" --tag "$TAG" . + - docker build --pull --cache-from "$DOCKER_HUB_NAME" . before_deploy: - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWD" diff --git a/base/Dockerfile b/base/Dockerfile index 503d16c..73df11c 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -6,9 +6,7 @@ COPY cpanfile cpanfile.snapshot /metacpan/ RUN apt-get update \ && apt-get install -y libgmp-dev rsync \ - && cpanm App::cpm \ - && cpm install -g Carton \ - && cpm install -g + && cpanm App::cpm FROM perl:${PERL_VERSION} COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 From 4757deede8ff161f3f363a1769d442e0cf91a010 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 12:01:06 +0100 Subject: [PATCH 022/141] try another syntax for version + latest --- .travis.yml | 12 ++++-------- base/Dockerfile | 4 ---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7fddb01..5cdb88c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,10 @@ services: env: global: - - DOCKER_HUB_NAME: metacpan/metacpan-base + - IMAGE_NAME: metacpan-base + - DOCKER_HUB_NAME: "metacpan/${IMAGE_NAME}" - VERSION: "${TRAVIS_BUILD_NUMBER}" - - TAG: "${DOCKER_HUB_NAME}:${VERSION}" + - VERSION_TAG: "${DOCKER_HUB_NAME}:${VERSION}" notifications: email: @@ -22,18 +23,13 @@ before_script: # Perform build, make sure to pull image deps and build from the fetched version as cache script: - cd base - - docker build --pull --cache-from "$DOCKER_HUB_NAME" . + - docker build --pull --cache-from "$DOCKER_HUB_NAME" --tag $DOCKER_HUB_NAME --tag $VERSION_TAG . before_deploy: - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWD" # Deploy this build as a version AND as latest deploy: - - provider: script - script: - - docker push "$TAG" - on: - branch: master - provider: script script: - docker push "$DOCKER_HUB_NAME" diff --git a/base/Dockerfile b/base/Dockerfile index 73df11c..0389aa9 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -4,10 +4,6 @@ FROM perl:${PERL_VERSION} AS build WORKDIR /metacpan COPY cpanfile cpanfile.snapshot /metacpan/ -RUN apt-get update \ - && apt-get install -y libgmp-dev rsync \ - && cpanm App::cpm - FROM perl:${PERL_VERSION} COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 COPY --from=build /usr/local/bin /usr/local/bin From d0947409e414c75dad9600507c4c4f53f8b10dc3 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 12:05:07 +0100 Subject: [PATCH 023/141] set langage as generic and put back build steps --- .travis.yml | 2 ++ base/Dockerfile | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5cdb88c..8b1a4ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +language: generic + services: - docker diff --git a/base/Dockerfile b/base/Dockerfile index 0389aa9..503d16c 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -4,6 +4,12 @@ FROM perl:${PERL_VERSION} AS build WORKDIR /metacpan COPY cpanfile cpanfile.snapshot /metacpan/ +RUN apt-get update \ + && apt-get install -y libgmp-dev rsync \ + && cpanm App::cpm \ + && cpm install -g Carton \ + && cpm install -g + FROM perl:${PERL_VERSION} COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 COPY --from=build /usr/local/bin /usr/local/bin From 758f20c1db8d9850f9bde891ca12ae20936dfce1 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 26 Apr 2019 15:21:27 +0100 Subject: [PATCH 024/141] Remove localapi compose file Splitting the compose file in two has issues with using the docker-compose management tools. Removing this file in prep to integrate the settings into the docker-compose.yml file. --- docker-compose.localapi.yml | 94 ------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 docker-compose.localapi.yml diff --git a/docker-compose.localapi.yml b/docker-compose.localapi.yml deleted file mode 100644 index d568755..0000000 --- a/docker-compose.localapi.yml +++ /dev/null @@ -1,94 +0,0 @@ -version: '3.4' -services: - web: - image: metacpan-web:latest - depends_on: - - api - env_file: - - localapi.env - volumes: - - ./configs/metacpan-web/metacpan_web.conf:/metacpan-web/metacpan_web.conf - api: - depends_on: - - elasticsearch - - elasticsearch_test - - pgdb - image: metacpan-api:latest - build: - context: ./src/metacpan-api - env_file: - - localapi.env - volumes: - - cpan:/CPAN - - api_carton:/carton - - ./src/metacpan-api:/metacpan-api - - ./configs/metacpan-api/metacpan_server.conf:/metacpan-api/metacpan_server.conf - - ./configs/metacpan-api/metacpan.pl:/metacpan-api/etc/metacpan.pl - - ./bin/index-cpan.sh:/bin/index-cpan.sh - - ./bin/partial-cpan-mirror.sh:/bin/partial-cpan-mirror.sh - ports: - - "5000:5000" - networks: - - elasticsearch - - web - - database - elasticsearch: - image: elasticsearch:2.4 - volumes: - - elasticsearch:/usr/share/elasticsearch/data - - ./elasticsearch/metacpan.yml:/usr/share/elasticsearch/config/metacpan.yml - - ./elasticsearch/scripts:/usr/share/elasticsearch/config/scripts - ports: - - "9200:9200" - networks: - - elasticsearch - elasticsearch_test: - image: elasticsearch:2.4 - volumes: - - elasticsearch_test:/usr/share/elasticsearch/data - - ./elasticsearch/test.yml:/usr/share/elasticsearch/config/test.yml - - ./elasticsearch/scripts:/usr/share/elasticsearch/config/scripts - ports: - - "9900:9200" - networks: - - elasticsearch - pgdb: - hostname: pgdb - image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" - build: - context: './pg' - args: - PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" - ports: - - "5432:5432" - networks: - - database - healthcheck: - interval: 10s - timeout: 1s - retries: 0 - start_period: 480s - test: ["CMD", "/healthcheck.sh"] - volumes: - - type: volume - source: pgdb-data - target: /var/lib/postgresql/data - - type: bind - source: ./pg/docker-entrypoint-initdb.d - target: /docker-entrypoint-initdb.d - read_only: true - - type: bind - source: ./pg/healthcheck.sh - target: /healthcheck.sh - read_only: true - -networks: - elasticsearch: - database: - -volumes: - api_carton: - cpan: - elasticsearch: - elasticsearch_test: - pgdb-data: From e7eecfd3b0075f560c31bdeda0bdeb081b9ac69e Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 26 Apr 2019 16:05:39 +0100 Subject: [PATCH 025/141] Add localapi compose configuration Integrate what used to be the docker-compose.localapi.yml file. There are some rewrites to change the way that volumes are mounted, and making some read only. --- docker-compose.yml | 128 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d18f9cc..82f277f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,15 +5,139 @@ services: build: context: ./src/metacpan-web volumes: - - web_carton:/carton - - ./src/metacpan-web:/metacpan-web + - type: volume + source: web_carton + target: /carton + - type: bind + source: ./configs/metacpan-web/metacpan_web.conf + target: /metacpan-web/metacpan_web.conf + read_only: true + - type: bind + source: ./src/metacpan-web + target: /metacpan-web + read_only: true ports: - "5001:5001" networks: - web + api: + depends_on: + - elasticsearch + - elasticsearch_test + - pgdb + image: metacpan-api:latest + build: + context: ./src/metacpan-api + env_file: + - localapi.env + command: "/wait-for-it.sh ${PGDB} -- carton exec ${API_SERVER} ./bin/api.pl" + volumes: + - type: volume + source: cpan + target: /CPAN + - type: volume + source: api_carton + target: /carton + - type: bind + source: ./src/metacpan-api + target: /metacpan-api + - type: bind + source: ./configs/metacpan-api/metacpan_server.conf + target: /metacpan-api/metacpan_server.conf + read_only: true + - type: bind + source: ./configs/metacpan-api/metacpan.pl + target: /metacpan-api/etc/metacpan.pl + read_only: true + - type: bind + source: ./bin/index-cpan.sh + target: /bin/index-cpan.sh + read_only: true + - type: bind + source: ./bin/partial-cpan-mirror.sh + target: /bin/partial-cpan-mirror.sh + read_only: true + ports: + - "5000:5000" + networks: + - elasticsearch + - web + - database + elasticsearch: + image: elasticsearch:2.4 + volumes: + - type: volume + source: elasticsearch + target: /usr/share/elasticsearch/data + - type: bind + source: ./elasticsearch/metacpan.yml + target: /usr/share/elasticsearch/config/metacpan.yml + read_only: true + - type: bind + source: ./elasticsearch/scripts + target: /usr/share/elasticsearch/config/scripts + read_only: true + ports: + - "9200:9200" + networks: + - elasticsearch + elasticsearch_test: + image: elasticsearch:2.4 + volumes: + - type: volume + source: elasticsearch_test + target: /usr/share/elasticsearch/data + - type: bind + source: ./elasticsearch/test.yml + target: /usr/share/elasticsearch/config/test.yml + read_only: true + - type: bind + source: ./elasticsearch/scripts + target: /usr/share/elasticsearch/config/scripts + read_only: true + ports: + - "9900:9200" + networks: + - elasticsearch + pgdb: + hostname: pgdb + image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" + build: + context: './pg' + args: + PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" + ports: + - "5432:5432" + networks: + - database + healthcheck: + interval: 10s + timeout: 1s + retries: 0 + start_period: 480s + test: ["CMD", "/healthcheck.sh"] + volumes: + - type: volume + source: pgdb-data + target: /var/lib/postgresql/data + - type: bind + source: ./pg/docker-entrypoint-initdb.d + target: /docker-entrypoint-initdb.d + read_only: true + - type: bind + source: ./pg/healthcheck.sh + target: /healthcheck.sh + read_only: true networks: + elasticsearch: + database: web: volumes: web_carton: + api_carton: + cpan: + elasticsearch: + elasticsearch_test: + pgdb-data: From 815aadfe5bab18c927789702df760654c4896840 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 26 Apr 2019 16:47:03 +0100 Subject: [PATCH 026/141] Add environment variables for CMD settings Add the PGDB and API_SERVER environment variables in order to adjust the server and database connection that are used in the metacpan-api container's command execution. --- .env | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env b/.env index 54bea79..10c96b0 100644 --- a/.env +++ b/.env @@ -1,2 +1,4 @@ COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development +PGDB=db:5432 +API_SERVER='morbo -l http://*:5000 -w /metacpan-api --verbose' From d4eced39ddbc7736c9a9aac5258d7ff12657b129 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 26 Apr 2019 16:50:52 +0100 Subject: [PATCH 027/141] Remove environment settings As there is only 1 docker-compose file now, the environment variable doesn't need to be set. Also removing the setting of the project name as that's set in the `.env` file --- bin/metacpan-docker | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index 700b440..d3454ff 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -35,13 +35,10 @@ case "x$1" in exit ;; 'xlocalapi') - export COMPOSE_FILE="docker-compose.yml:docker-compose.localapi.yml" shift ;; *) ;; esac -export COMPOSE_PROJECT_NAME="metacpan" - exec docker-compose "$@" From bf7fff67403309bab36412366a08e97364cb760b Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 26 Apr 2019 16:52:28 +0100 Subject: [PATCH 028/141] Additional environment settings for perl These values are used to set where carton is looking for its files and how ModuleMaker works. --- localapi.env | 2 ++ 1 file changed, 2 insertions(+) diff --git a/localapi.env b/localapi.env index d67a223..6ef8aa8 100644 --- a/localapi.env +++ b/localapi.env @@ -3,3 +3,5 @@ COLUMNS=80 ES=elasticsearch:9200 ES_TEST=elasticsearch_test:9200 MINICPAN=/CPAN +PERL_MM_USE_DEFAULT=1 +PERL_CARTON_PATH=/carton From 43f490af1e70a707850b5bc0bfb87fce03743e38 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 26 Apr 2019 16:53:42 +0100 Subject: [PATCH 029/141] Add installation without tests for cpm The tests for the modules that are being installed aren't required in the image, don't install them by default. --- base/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base/Dockerfile b/base/Dockerfile index 503d16c..854376d 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -4,11 +4,15 @@ FROM perl:${PERL_VERSION} AS build WORKDIR /metacpan COPY cpanfile cpanfile.snapshot /metacpan/ +# CPM installations of dependencies does not install or run tests. This is +# because the modules themselves have been tested, and the metacpan use of the +# modules is tested by the test suite. Removing the tests, reduces the overall +# size of the images. RUN apt-get update \ && apt-get install -y libgmp-dev rsync \ && cpanm App::cpm \ - && cpm install -g Carton \ - && cpm install -g + && cpm install -g --without-test Carton \ + && cpm install -g --without-test FROM perl:${PERL_VERSION} COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 From 41211d97ee9f1303416bc5941bf89b6b3cf3d900 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 26 Apr 2019 18:15:06 +0100 Subject: [PATCH 030/141] Remove quotes from .env file --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 10c96b0..7d7b27d 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development PGDB=db:5432 -API_SERVER='morbo -l http://*:5000 -w /metacpan-api --verbose' +API_SERVER=morbo -l http://*:5000 -w . --verbose From 0dd793210e668e7734513a2be48b7fab705eb4f4 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 26 Apr 2019 18:15:22 +0100 Subject: [PATCH 031/141] Remove carton from API compose file --- docker-compose.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 82f277f..36a3daf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,14 +30,11 @@ services: context: ./src/metacpan-api env_file: - localapi.env - command: "/wait-for-it.sh ${PGDB} -- carton exec ${API_SERVER} ./bin/api.pl" + command: "/wait-for-it.sh ${PGDB} -- ${API_SERVER} ./bin/api.pl" volumes: - type: volume source: cpan target: /CPAN - - type: volume - source: api_carton - target: /carton - type: bind source: ./src/metacpan-api target: /metacpan-api From 65f46211e89229320588b7ab80e72a74d718827e Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Fri, 26 Apr 2019 23:22:10 +0100 Subject: [PATCH 032/141] remove the base image setup into seperate repo metacpan/metacpan-base --- .travis.yml | 39 --- base/Dockerfile | 20 -- base/cpanfile | 3 - base/cpanfile.snapshot | 743 ----------------------------------------- base/wait-for-it.sh | 202 ----------- 5 files changed, 1007 deletions(-) delete mode 100644 .travis.yml delete mode 100644 base/Dockerfile delete mode 100644 base/cpanfile delete mode 100644 base/cpanfile.snapshot delete mode 100755 base/wait-for-it.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8b1a4ed..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: generic - -services: - - docker - -env: - global: - - IMAGE_NAME: metacpan-base - - DOCKER_HUB_NAME: "metacpan/${IMAGE_NAME}" - - VERSION: "${TRAVIS_BUILD_NUMBER}" - - VERSION_TAG: "${DOCKER_HUB_NAME}:${VERSION}" - -notifications: - email: - recipients: - - leo@cuckoo.org - on_success: never - on_failure: always - irc: "irc.perl.org#metacpan-travis" - -# Pull from docker hub so can use as cache for initial steps -before_script: - - docker pull "$DOCKER_HUB_NAME" || true - -# Perform build, make sure to pull image deps and build from the fetched version as cache -script: - - cd base - - docker build --pull --cache-from "$DOCKER_HUB_NAME" --tag $DOCKER_HUB_NAME --tag $VERSION_TAG . - -before_deploy: - - docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWD" - -# Deploy this build as a version AND as latest -deploy: - - provider: script - script: - - docker push "$DOCKER_HUB_NAME" - on: - branch: master diff --git a/base/Dockerfile b/base/Dockerfile deleted file mode 100644 index 854376d..0000000 --- a/base/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -ARG PERL_VERSION=5.28 -FROM perl:${PERL_VERSION} AS build - -WORKDIR /metacpan -COPY cpanfile cpanfile.snapshot /metacpan/ - -# CPM installations of dependencies does not install or run tests. This is -# because the modules themselves have been tested, and the metacpan use of the -# modules is tested by the test suite. Removing the tests, reduces the overall -# size of the images. -RUN apt-get update \ - && apt-get install -y libgmp-dev rsync \ - && cpanm App::cpm \ - && cpm install -g --without-test Carton \ - && cpm install -g --without-test - -FROM perl:${PERL_VERSION} -COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 -COPY --from=build /usr/local/bin /usr/local/bin -COPY wait-for-it.sh / diff --git a/base/cpanfile b/base/cpanfile deleted file mode 100644 index c3316d4..0000000 --- a/base/cpanfile +++ /dev/null @@ -1,3 +0,0 @@ -requires 'Moose'; -requires 'Moo'; -requires 'Gazelle'; diff --git a/base/cpanfile.snapshot b/base/cpanfile.snapshot deleted file mode 100644 index 14a9f08..0000000 --- a/base/cpanfile.snapshot +++ /dev/null @@ -1,743 +0,0 @@ -# carton snapshot format: version 1.0 -DISTRIBUTIONS - Class-Load-0.25 - pathname: E/ET/ETHER/Class-Load-0.25.tar.gz - provides: - Class::Load 0.25 - Class::Load::PP 0.25 - requirements: - Carp 0 - Data::OptList 0.110 - Exporter 0 - ExtUtils::MakeMaker 0 - Module::Implementation 0.04 - Module::Runtime 0.012 - Package::Stash 0.14 - Scalar::Util 0 - Try::Tiny 0 - base 0 - perl 5.006 - strict 0 - warnings 0 - Class-Load-XS-0.10 - pathname: E/ET/ETHER/Class-Load-XS-0.10.tar.gz - provides: - Class::Load::XS 0.10 - requirements: - Class::Load 0.20 - ExtUtils::MakeMaker 0 - XSLoader 0 - perl 5.006 - strict 0 - warnings 0 - Class-Method-Modifiers-2.12 - pathname: E/ET/ETHER/Class-Method-Modifiers-2.12.tar.gz - provides: - Class::Method::Modifiers 2.12 - requirements: - B 0 - Carp 0 - Exporter 0 - ExtUtils::MakeMaker 0 - base 0 - perl 5.006 - strict 0 - warnings 0 - Data-OptList-0.110 - pathname: R/RJ/RJBS/Data-OptList-0.110.tar.gz - provides: - Data::OptList 0.110 - requirements: - ExtUtils::MakeMaker 0 - List::Util 0 - Params::Util 0 - Sub::Install 0.921 - strict 0 - warnings 0 - Devel-GlobalDestruction-0.14 - pathname: H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz - provides: - Devel::GlobalDestruction 0.14 - requirements: - ExtUtils::MakeMaker 0 - Sub::Exporter::Progressive 0.001011 - perl 5.006 - Devel-OverloadInfo-0.005 - pathname: I/IL/ILMARI/Devel-OverloadInfo-0.005.tar.gz - provides: - Devel::OverloadInfo 0.005 - requirements: - Exporter 5.57 - ExtUtils::MakeMaker 0 - MRO::Compat 0 - Package::Stash 0.14 - Scalar::Util 0 - Sub::Identify 0 - overload 0 - perl 5.006 - strict 0 - warnings 0 - Devel-StackTrace-2.03 - pathname: D/DR/DROLSKY/Devel-StackTrace-2.03.tar.gz - provides: - Devel::StackTrace 2.03 - Devel::StackTrace::Frame 2.03 - requirements: - ExtUtils::MakeMaker 0 - File::Spec 0 - Scalar::Util 0 - overload 0 - perl 5.006 - strict 0 - warnings 0 - Dist-CheckConflicts-0.11 - pathname: D/DO/DOY/Dist-CheckConflicts-0.11.tar.gz - provides: - Dist::CheckConflicts 0.11 - requirements: - Carp 0 - Exporter 0 - ExtUtils::MakeMaker 6.30 - Module::Runtime 0.009 - base 0 - strict 0 - warnings 0 - Eval-Closure-0.14 - pathname: D/DO/DOY/Eval-Closure-0.14.tar.gz - provides: - Eval::Closure 0.14 - requirements: - Carp 0 - Exporter 0 - ExtUtils::MakeMaker 0 - Scalar::Util 0 - constant 0 - overload 0 - strict 0 - warnings 0 - MRO-Compat-0.13 - pathname: H/HA/HAARG/MRO-Compat-0.13.tar.gz - provides: - MRO::Compat 0.13 - requirements: - ExtUtils::MakeMaker 0 - perl 5.006 - Module-Build-0.4229 - pathname: L/LE/LEONT/Module-Build-0.4229.tar.gz - provides: - Module::Build 0.4229 - Module::Build::Base 0.4229 - Module::Build::Compat 0.4229 - Module::Build::Config 0.4229 - Module::Build::Cookbook 0.4229 - Module::Build::Dumper 0.4229 - Module::Build::Notes 0.4229 - Module::Build::PPMMaker 0.4229 - Module::Build::Platform::Default 0.4229 - Module::Build::Platform::MacOS 0.4229 - Module::Build::Platform::Unix 0.4229 - Module::Build::Platform::VMS 0.4229 - Module::Build::Platform::VOS 0.4229 - Module::Build::Platform::Windows 0.4229 - Module::Build::Platform::aix 0.4229 - Module::Build::Platform::cygwin 0.4229 - Module::Build::Platform::darwin 0.4229 - Module::Build::Platform::os2 0.4229 - Module::Build::PodParser 0.4229 - requirements: - CPAN::Meta 2.142060 - Cwd 0 - Data::Dumper 0 - ExtUtils::CBuilder 0.27 - ExtUtils::Install 0 - ExtUtils::Manifest 0 - ExtUtils::Mkbootstrap 0 - ExtUtils::ParseXS 2.21 - File::Basename 0 - File::Compare 0 - File::Copy 0 - File::Find 0 - File::Path 0 - File::Spec 0.82 - Getopt::Long 0 - Module::Metadata 1.000002 - Perl::OSType 1 - Pod::Man 2.17 - TAP::Harness 3.29 - Text::Abbrev 0 - Text::ParseWords 0 - perl 5.006001 - version 0.87 - Module-Implementation-0.09 - pathname: D/DR/DROLSKY/Module-Implementation-0.09.tar.gz - provides: - Module::Implementation 0.09 - requirements: - Carp 0 - ExtUtils::MakeMaker 0 - Module::Runtime 0.012 - Try::Tiny 0 - strict 0 - warnings 0 - Module-Runtime-0.016 - pathname: Z/ZE/ZEFRAM/Module-Runtime-0.016.tar.gz - provides: - Module::Runtime 0.016 - requirements: - Module::Build 0 - Test::More 0.41 - perl 5.006 - strict 0 - warnings 0 - Module-Runtime-Conflicts-0.003 - pathname: E/ET/ETHER/Module-Runtime-Conflicts-0.003.tar.gz - provides: - Module::Runtime::Conflicts 0.003 - requirements: - Dist::CheckConflicts 0 - ExtUtils::MakeMaker 0 - Module::Runtime 0 - perl 5.006 - strict 0 - warnings 0 - Moo-2.003004 - pathname: H/HA/HAARG/Moo-2.003004.tar.gz - provides: - Method::Generate::Accessor undef - Method::Generate::BuildAll undef - Method::Generate::Constructor undef - Method::Generate::DemolishAll undef - Moo 2.003004 - Moo::HandleMoose undef - Moo::HandleMoose::FakeConstructor undef - Moo::HandleMoose::FakeMetaClass undef - Moo::HandleMoose::_TypeMap undef - Moo::Object undef - Moo::Role 2.003004 - Moo::_Utils undef - Moo::_mro undef - Moo::_strictures undef - Moo::sification undef - oo undef - requirements: - Class::Method::Modifiers 1.1 - Devel::GlobalDestruction 0.11 - Exporter 5.57 - ExtUtils::MakeMaker 0 - Module::Runtime 0.014 - Role::Tiny 2.000004 - Scalar::Util 0 - Sub::Defer 2.003001 - Sub::Quote 2.003001 - perl 5.006 - Moose-2.2011 - pathname: E/ET/ETHER/Moose-2.2011.tar.gz - provides: - Class::MOP 2.2011 - Class::MOP::Attribute 2.2011 - Class::MOP::Class 2.2011 - Class::MOP::Instance 2.2011 - Class::MOP::Method 2.2011 - Class::MOP::Method::Accessor 2.2011 - Class::MOP::Method::Constructor 2.2011 - Class::MOP::Method::Generated 2.2011 - Class::MOP::Method::Inlined 2.2011 - Class::MOP::Method::Meta 2.2011 - Class::MOP::Method::Wrapped 2.2011 - Class::MOP::Module 2.2011 - Class::MOP::Object 2.2011 - Class::MOP::Overload 2.2011 - Class::MOP::Package 2.2011 - Moose 2.2011 - Moose::Cookbook 2.2011 - Moose::Cookbook::Basics::BankAccount_MethodModifiersAndSubclassing 2.2011 - Moose::Cookbook::Basics::BinaryTree_AttributeFeatures 2.2011 - Moose::Cookbook::Basics::BinaryTree_BuilderAndLazyBuild 2.2011 - Moose::Cookbook::Basics::Company_Subtypes 2.2011 - Moose::Cookbook::Basics::DateTime_ExtendingNonMooseParent 2.2011 - Moose::Cookbook::Basics::Document_AugmentAndInner 2.2011 - Moose::Cookbook::Basics::Genome_OverloadingSubtypesAndCoercion 2.2011 - Moose::Cookbook::Basics::HTTP_SubtypesAndCoercion 2.2011 - Moose::Cookbook::Basics::Immutable 2.2011 - Moose::Cookbook::Basics::Person_BUILDARGSAndBUILD 2.2011 - Moose::Cookbook::Basics::Point_AttributesAndSubclassing 2.2011 - Moose::Cookbook::Extending::Debugging_BaseClassRole 2.2011 - Moose::Cookbook::Extending::ExtensionOverview 2.2011 - Moose::Cookbook::Extending::Mooseish_MooseSugar 2.2011 - Moose::Cookbook::Legacy::Debugging_BaseClassReplacement 2.2011 - Moose::Cookbook::Legacy::Labeled_AttributeMetaclass 2.2011 - Moose::Cookbook::Legacy::Table_ClassMetaclass 2.2011 - Moose::Cookbook::Meta::GlobRef_InstanceMetaclass 2.2011 - Moose::Cookbook::Meta::Labeled_AttributeTrait 2.2011 - Moose::Cookbook::Meta::PrivateOrPublic_MethodMetaclass 2.2011 - Moose::Cookbook::Meta::Table_MetaclassTrait 2.2011 - Moose::Cookbook::Meta::WhyMeta 2.2011 - Moose::Cookbook::Roles::ApplicationToInstance 2.2011 - Moose::Cookbook::Roles::Comparable_CodeReuse 2.2011 - Moose::Cookbook::Roles::Restartable_AdvancedComposition 2.2011 - Moose::Cookbook::Snack::Keywords 2.2011 - Moose::Cookbook::Snack::Types 2.2011 - Moose::Cookbook::Style 2.2011 - Moose::Exception 2.2011 - Moose::Exception::AccessorMustReadWrite 2.2011 - Moose::Exception::AddParameterizableTypeTakesParameterizableType 2.2011 - Moose::Exception::AddRoleTakesAMooseMetaRoleInstance 2.2011 - Moose::Exception::AddRoleToARoleTakesAMooseMetaRole 2.2011 - Moose::Exception::ApplyTakesABlessedInstance 2.2011 - Moose::Exception::AttachToClassNeedsAClassMOPClassInstanceOrASubclass 2.2011 - Moose::Exception::AttributeConflictInRoles 2.2011 - Moose::Exception::AttributeConflictInSummation 2.2011 - Moose::Exception::AttributeExtensionIsNotSupportedInRoles 2.2011 - Moose::Exception::AttributeIsRequired 2.2011 - Moose::Exception::AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass 2.2011 - Moose::Exception::AttributeNamesDoNotMatch 2.2011 - Moose::Exception::AttributeValueIsNotAnObject 2.2011 - Moose::Exception::AttributeValueIsNotDefined 2.2011 - Moose::Exception::AutoDeRefNeedsArrayRefOrHashRef 2.2011 - Moose::Exception::BadOptionFormat 2.2011 - Moose::Exception::BothBuilderAndDefaultAreNotAllowed 2.2011 - Moose::Exception::BuilderDoesNotExist 2.2011 - Moose::Exception::BuilderMethodNotSupportedForAttribute 2.2011 - Moose::Exception::BuilderMethodNotSupportedForInlineAttribute 2.2011 - Moose::Exception::BuilderMustBeAMethodName 2.2011 - Moose::Exception::CallingMethodOnAnImmutableInstance 2.2011 - Moose::Exception::CallingReadOnlyMethodOnAnImmutableInstance 2.2011 - Moose::Exception::CanExtendOnlyClasses 2.2011 - Moose::Exception::CanOnlyConsumeRole 2.2011 - Moose::Exception::CanOnlyWrapBlessedCode 2.2011 - Moose::Exception::CanReblessOnlyIntoASubclass 2.2011 - Moose::Exception::CanReblessOnlyIntoASuperclass 2.2011 - Moose::Exception::CannotAddAdditionalTypeCoercionsToUnion 2.2011 - Moose::Exception::CannotAddAsAnAttributeToARole 2.2011 - Moose::Exception::CannotApplyBaseClassRolesToRole 2.2011 - Moose::Exception::CannotAssignValueToReadOnlyAccessor 2.2011 - Moose::Exception::CannotAugmentIfLocalMethodPresent 2.2011 - Moose::Exception::CannotAugmentNoSuperMethod 2.2011 - Moose::Exception::CannotAutoDerefWithoutIsa 2.2011 - Moose::Exception::CannotAutoDereferenceTypeConstraint 2.2011 - Moose::Exception::CannotCalculateNativeType 2.2011 - Moose::Exception::CannotCallAnAbstractBaseMethod 2.2011 - Moose::Exception::CannotCallAnAbstractMethod 2.2011 - Moose::Exception::CannotCoerceAWeakRef 2.2011 - Moose::Exception::CannotCoerceAttributeWhichHasNoCoercion 2.2011 - Moose::Exception::CannotCreateHigherOrderTypeWithoutATypeParameter 2.2011 - Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresent 2.2011 - Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresentInClass 2.2011 - Moose::Exception::CannotDelegateLocalMethodIsPresent 2.2011 - Moose::Exception::CannotDelegateWithoutIsa 2.2011 - Moose::Exception::CannotFindDelegateMetaclass 2.2011 - Moose::Exception::CannotFindType 2.2011 - Moose::Exception::CannotFindTypeGivenToMatchOnType 2.2011 - Moose::Exception::CannotFixMetaclassCompatibility 2.2011 - Moose::Exception::CannotGenerateInlineConstraint 2.2011 - Moose::Exception::CannotInitializeMooseMetaRoleComposite 2.2011 - Moose::Exception::CannotInlineTypeConstraintCheck 2.2011 - Moose::Exception::CannotLocatePackageInINC 2.2011 - Moose::Exception::CannotMakeMetaclassCompatible 2.2011 - Moose::Exception::CannotOverrideALocalMethod 2.2011 - Moose::Exception::CannotOverrideBodyOfMetaMethods 2.2011 - Moose::Exception::CannotOverrideLocalMethodIsPresent 2.2011 - Moose::Exception::CannotOverrideNoSuperMethod 2.2011 - Moose::Exception::CannotRegisterUnnamedTypeConstraint 2.2011 - Moose::Exception::CannotUseLazyBuildAndDefaultSimultaneously 2.2011 - Moose::Exception::CircularReferenceInAlso 2.2011 - Moose::Exception::ClassDoesNotHaveInitMeta 2.2011 - Moose::Exception::ClassDoesTheExcludedRole 2.2011 - Moose::Exception::ClassNamesDoNotMatch 2.2011 - Moose::Exception::CloneObjectExpectsAnInstanceOfMetaclass 2.2011 - Moose::Exception::CodeBlockMustBeACodeRef 2.2011 - Moose::Exception::CoercingWithoutCoercions 2.2011 - Moose::Exception::CoercionAlreadyExists 2.2011 - Moose::Exception::CoercionNeedsTypeConstraint 2.2011 - Moose::Exception::ConflictDetectedInCheckRoleExclusions 2.2011 - Moose::Exception::ConflictDetectedInCheckRoleExclusionsInToClass 2.2011 - Moose::Exception::ConstructClassInstanceTakesPackageName 2.2011 - Moose::Exception::CouldNotCreateMethod 2.2011 - Moose::Exception::CouldNotCreateWriter 2.2011 - Moose::Exception::CouldNotEvalConstructor 2.2011 - Moose::Exception::CouldNotEvalDestructor 2.2011 - Moose::Exception::CouldNotFindTypeConstraintToCoerceFrom 2.2011 - Moose::Exception::CouldNotGenerateInlineAttributeMethod 2.2011 - Moose::Exception::CouldNotLocateTypeConstraintForUnion 2.2011 - Moose::Exception::CouldNotParseType 2.2011 - Moose::Exception::CreateMOPClassTakesArrayRefOfAttributes 2.2011 - Moose::Exception::CreateMOPClassTakesArrayRefOfSuperclasses 2.2011 - Moose::Exception::CreateMOPClassTakesHashRefOfMethods 2.2011 - Moose::Exception::CreateTakesArrayRefOfRoles 2.2011 - Moose::Exception::CreateTakesHashRefOfAttributes 2.2011 - Moose::Exception::CreateTakesHashRefOfMethods 2.2011 - Moose::Exception::DefaultToMatchOnTypeMustBeCodeRef 2.2011 - Moose::Exception::DelegationToAClassWhichIsNotLoaded 2.2011 - Moose::Exception::DelegationToARoleWhichIsNotLoaded 2.2011 - Moose::Exception::DelegationToATypeWhichIsNotAClass 2.2011 - Moose::Exception::DoesRequiresRoleName 2.2011 - Moose::Exception::EnumCalledWithAnArrayRefAndAdditionalArgs 2.2011 - Moose::Exception::EnumValuesMustBeString 2.2011 - Moose::Exception::ExtendsMissingArgs 2.2011 - Moose::Exception::HandlesMustBeAHashRef 2.2011 - Moose::Exception::IllegalInheritedOptions 2.2011 - Moose::Exception::IllegalMethodTypeToAddMethodModifier 2.2011 - Moose::Exception::IncompatibleMetaclassOfSuperclass 2.2011 - Moose::Exception::InitMetaRequiresClass 2.2011 - Moose::Exception::InitializeTakesUnBlessedPackageName 2.2011 - Moose::Exception::InstanceBlessedIntoWrongClass 2.2011 - Moose::Exception::InstanceMustBeABlessedReference 2.2011 - Moose::Exception::InvalidArgPassedToMooseUtilMetaRole 2.2011 - Moose::Exception::InvalidArgumentToMethod 2.2011 - Moose::Exception::InvalidArgumentsToTraitAliases 2.2011 - Moose::Exception::InvalidBaseTypeGivenToCreateParameterizedTypeConstraint 2.2011 - Moose::Exception::InvalidHandleValue 2.2011 - Moose::Exception::InvalidHasProvidedInARole 2.2011 - Moose::Exception::InvalidNameForType 2.2011 - Moose::Exception::InvalidOverloadOperator 2.2011 - Moose::Exception::InvalidRoleApplication 2.2011 - Moose::Exception::InvalidTypeConstraint 2.2011 - Moose::Exception::InvalidTypeGivenToCreateParameterizedTypeConstraint 2.2011 - Moose::Exception::InvalidValueForIs 2.2011 - Moose::Exception::IsaDoesNotDoTheRole 2.2011 - Moose::Exception::IsaLacksDoesMethod 2.2011 - Moose::Exception::LazyAttributeNeedsADefault 2.2011 - Moose::Exception::Legacy 2.2011 - Moose::Exception::MOPAttributeNewNeedsAttributeName 2.2011 - Moose::Exception::MatchActionMustBeACodeRef 2.2011 - Moose::Exception::MessageParameterMustBeCodeRef 2.2011 - Moose::Exception::MetaclassIsAClassNotASubclassOfGivenMetaclass 2.2011 - Moose::Exception::MetaclassIsARoleNotASubclassOfGivenMetaclass 2.2011 - Moose::Exception::MetaclassIsNotASubclassOfGivenMetaclass 2.2011 - Moose::Exception::MetaclassMustBeASubclassOfMooseMetaClass 2.2011 - Moose::Exception::MetaclassMustBeASubclassOfMooseMetaRole 2.2011 - Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass 2.2011 - Moose::Exception::MetaclassNotLoaded 2.2011 - Moose::Exception::MetaclassTypeIncompatible 2.2011 - Moose::Exception::MethodExpectedAMetaclassObject 2.2011 - Moose::Exception::MethodExpectsFewerArgs 2.2011 - Moose::Exception::MethodExpectsMoreArgs 2.2011 - Moose::Exception::MethodModifierNeedsMethodName 2.2011 - Moose::Exception::MethodNameConflictInRoles 2.2011 - Moose::Exception::MethodNameNotFoundInInheritanceHierarchy 2.2011 - Moose::Exception::MethodNameNotGiven 2.2011 - Moose::Exception::MustDefineAMethodName 2.2011 - Moose::Exception::MustDefineAnAttributeName 2.2011 - Moose::Exception::MustDefineAnOverloadOperator 2.2011 - Moose::Exception::MustHaveAtLeastOneValueToEnumerate 2.2011 - Moose::Exception::MustPassAHashOfOptions 2.2011 - Moose::Exception::MustPassAMooseMetaRoleInstanceOrSubclass 2.2011 - Moose::Exception::MustPassAPackageNameOrAnExistingClassMOPPackageInstance 2.2011 - Moose::Exception::MustPassEvenNumberOfArguments 2.2011 - Moose::Exception::MustPassEvenNumberOfAttributeOptions 2.2011 - Moose::Exception::MustProvideANameForTheAttribute 2.2011 - Moose::Exception::MustSpecifyAtleastOneMethod 2.2011 - Moose::Exception::MustSpecifyAtleastOneRole 2.2011 - Moose::Exception::MustSpecifyAtleastOneRoleToApplicant 2.2011 - Moose::Exception::MustSupplyAClassMOPAttributeInstance 2.2011 - Moose::Exception::MustSupplyADelegateToMethod 2.2011 - Moose::Exception::MustSupplyAMetaclass 2.2011 - Moose::Exception::MustSupplyAMooseMetaAttributeInstance 2.2011 - Moose::Exception::MustSupplyAnAccessorTypeToConstructWith 2.2011 - Moose::Exception::MustSupplyAnAttributeToConstructWith 2.2011 - Moose::Exception::MustSupplyArrayRefAsCurriedArguments 2.2011 - Moose::Exception::MustSupplyPackageNameAndName 2.2011 - Moose::Exception::NeedsTypeConstraintUnionForTypeCoercionUnion 2.2011 - Moose::Exception::NeitherAttributeNorAttributeNameIsGiven 2.2011 - Moose::Exception::NeitherClassNorClassNameIsGiven 2.2011 - Moose::Exception::NeitherRoleNorRoleNameIsGiven 2.2011 - Moose::Exception::NeitherTypeNorTypeNameIsGiven 2.2011 - Moose::Exception::NoAttributeFoundInSuperClass 2.2011 - Moose::Exception::NoBodyToInitializeInAnAbstractBaseClass 2.2011 - Moose::Exception::NoCasesMatched 2.2011 - Moose::Exception::NoConstraintCheckForTypeConstraint 2.2011 - Moose::Exception::NoDestructorClassSpecified 2.2011 - Moose::Exception::NoImmutableTraitSpecifiedForClass 2.2011 - Moose::Exception::NoParentGivenToSubtype 2.2011 - Moose::Exception::OnlyInstancesCanBeCloned 2.2011 - Moose::Exception::OperatorIsRequired 2.2011 - Moose::Exception::OverloadConflictInSummation 2.2011 - Moose::Exception::OverloadRequiresAMetaClass 2.2011 - Moose::Exception::OverloadRequiresAMetaMethod 2.2011 - Moose::Exception::OverloadRequiresAMetaOverload 2.2011 - Moose::Exception::OverloadRequiresAMethodNameOrCoderef 2.2011 - Moose::Exception::OverloadRequiresAnOperator 2.2011 - Moose::Exception::OverloadRequiresNamesForCoderef 2.2011 - Moose::Exception::OverrideConflictInComposition 2.2011 - Moose::Exception::OverrideConflictInSummation 2.2011 - Moose::Exception::PackageDoesNotUseMooseExporter 2.2011 - Moose::Exception::PackageNameAndNameParamsNotGivenToWrap 2.2011 - Moose::Exception::PackagesAndModulesAreNotCachable 2.2011 - Moose::Exception::ParameterIsNotSubtypeOfParent 2.2011 - Moose::Exception::ReferencesAreNotAllowedAsDefault 2.2011 - Moose::Exception::RequiredAttributeLacksInitialization 2.2011 - Moose::Exception::RequiredAttributeNeedsADefault 2.2011 - Moose::Exception::RequiredMethodsImportedByClass 2.2011 - Moose::Exception::RequiredMethodsNotImplementedByClass 2.2011 - Moose::Exception::Role::Attribute 2.2011 - Moose::Exception::Role::AttributeName 2.2011 - Moose::Exception::Role::Class 2.2011 - Moose::Exception::Role::EitherAttributeOrAttributeName 2.2011 - Moose::Exception::Role::Instance 2.2011 - Moose::Exception::Role::InstanceClass 2.2011 - Moose::Exception::Role::InvalidAttributeOptions 2.2011 - Moose::Exception::Role::Method 2.2011 - Moose::Exception::Role::ParamsHash 2.2011 - Moose::Exception::Role::Role 2.2011 - Moose::Exception::Role::RoleForCreate 2.2011 - Moose::Exception::Role::RoleForCreateMOPClass 2.2011 - Moose::Exception::Role::TypeConstraint 2.2011 - Moose::Exception::RoleDoesTheExcludedRole 2.2011 - Moose::Exception::RoleExclusionConflict 2.2011 - Moose::Exception::RoleNameRequired 2.2011 - Moose::Exception::RoleNameRequiredForMooseMetaRole 2.2011 - Moose::Exception::RolesDoNotSupportAugment 2.2011 - Moose::Exception::RolesDoNotSupportExtends 2.2011 - Moose::Exception::RolesDoNotSupportInner 2.2011 - Moose::Exception::RolesDoNotSupportRegexReferencesForMethodModifiers 2.2011 - Moose::Exception::RolesInCreateTakesAnArrayRef 2.2011 - Moose::Exception::RolesListMustBeInstancesOfMooseMetaRole 2.2011 - Moose::Exception::SingleParamsToNewMustBeHashRef 2.2011 - Moose::Exception::TriggerMustBeACodeRef 2.2011 - Moose::Exception::TypeConstraintCannotBeUsedForAParameterizableType 2.2011 - Moose::Exception::TypeConstraintIsAlreadyCreated 2.2011 - Moose::Exception::TypeParameterMustBeMooseMetaType 2.2011 - Moose::Exception::UnableToCanonicalizeHandles 2.2011 - Moose::Exception::UnableToCanonicalizeNonRolePackage 2.2011 - Moose::Exception::UnableToRecognizeDelegateMetaclass 2.2011 - Moose::Exception::UndefinedHashKeysPassedToMethod 2.2011 - Moose::Exception::UnionCalledWithAnArrayRefAndAdditionalArgs 2.2011 - Moose::Exception::UnionTakesAtleastTwoTypeNames 2.2011 - Moose::Exception::ValidationFailedForInlineTypeConstraint 2.2011 - Moose::Exception::ValidationFailedForTypeConstraint 2.2011 - Moose::Exception::WrapTakesACodeRefToBless 2.2011 - Moose::Exception::WrongTypeConstraintGiven 2.2011 - Moose::Exporter 2.2011 - Moose::Intro 2.2011 - Moose::Manual 2.2011 - Moose::Manual::Attributes 2.2011 - Moose::Manual::BestPractices 2.2011 - Moose::Manual::Classes 2.2011 - Moose::Manual::Concepts 2.2011 - Moose::Manual::Construction 2.2011 - Moose::Manual::Contributing 2.2011 - Moose::Manual::Delegation 2.2011 - Moose::Manual::Delta 2.2011 - Moose::Manual::Exceptions 2.2011 - Moose::Manual::Exceptions::Manifest 2.2011 - Moose::Manual::FAQ 2.2011 - Moose::Manual::MOP 2.2011 - Moose::Manual::MethodModifiers 2.2011 - Moose::Manual::MooseX 2.2011 - Moose::Manual::Resources 2.2011 - Moose::Manual::Roles 2.2011 - Moose::Manual::Support 2.2011 - Moose::Manual::Types 2.2011 - Moose::Manual::Unsweetened 2.2011 - Moose::Meta::Attribute 2.2011 - Moose::Meta::Attribute::Native 2.2011 - Moose::Meta::Attribute::Native::Trait::Array 2.2011 - Moose::Meta::Attribute::Native::Trait::Bool 2.2011 - Moose::Meta::Attribute::Native::Trait::Code 2.2011 - Moose::Meta::Attribute::Native::Trait::Counter 2.2011 - Moose::Meta::Attribute::Native::Trait::Hash 2.2011 - Moose::Meta::Attribute::Native::Trait::Number 2.2011 - Moose::Meta::Attribute::Native::Trait::String 2.2011 - Moose::Meta::Class 2.2011 - Moose::Meta::Instance 2.2011 - Moose::Meta::Method 2.2011 - Moose::Meta::Method::Accessor 2.2011 - Moose::Meta::Method::Augmented 2.2011 - Moose::Meta::Method::Constructor 2.2011 - Moose::Meta::Method::Delegation 2.2011 - Moose::Meta::Method::Destructor 2.2011 - Moose::Meta::Method::Meta 2.2011 - Moose::Meta::Method::Overridden 2.2011 - Moose::Meta::Role 2.2011 - Moose::Meta::Role::Application 2.2011 - Moose::Meta::Role::Application::RoleSummation 2.2011 - Moose::Meta::Role::Application::ToClass 2.2011 - Moose::Meta::Role::Application::ToInstance 2.2011 - Moose::Meta::Role::Application::ToRole 2.2011 - Moose::Meta::Role::Attribute 2.2011 - Moose::Meta::Role::Composite 2.2011 - Moose::Meta::Role::Method 2.2011 - Moose::Meta::Role::Method::Conflicting 2.2011 - Moose::Meta::Role::Method::Required 2.2011 - Moose::Meta::TypeCoercion 2.2011 - Moose::Meta::TypeCoercion::Union 2.2011 - Moose::Meta::TypeConstraint 2.2011 - Moose::Meta::TypeConstraint::Class 2.2011 - Moose::Meta::TypeConstraint::DuckType 2.2011 - Moose::Meta::TypeConstraint::Enum 2.2011 - Moose::Meta::TypeConstraint::Parameterizable 2.2011 - Moose::Meta::TypeConstraint::Parameterized 2.2011 - Moose::Meta::TypeConstraint::Registry 2.2011 - Moose::Meta::TypeConstraint::Role 2.2011 - Moose::Meta::TypeConstraint::Union 2.2011 - Moose::Object 2.2011 - Moose::Role 2.2011 - Moose::Spec::Role 2.2011 - Moose::Unsweetened 2.2011 - Moose::Util 2.2011 - Moose::Util::MetaRole 2.2011 - Moose::Util::TypeConstraints 2.2011 - Test::Moose 2.2011 - metaclass 2.2011 - oose 2.2011 - requirements: - Carp 1.22 - Class::Load 0.09 - Class::Load::XS 0.01 - Data::OptList 0.107 - Devel::GlobalDestruction 0 - Devel::OverloadInfo 0.005 - Devel::StackTrace 2.03 - Dist::CheckConflicts 0.02 - Eval::Closure 0.04 - ExtUtils::MakeMaker 0 - List::Util 1.45 - MRO::Compat 0.05 - Module::Runtime 0.014 - Module::Runtime::Conflicts 0.002 - Package::DeprecationManager 0.11 - Package::Stash 0.32 - Package::Stash::XS 0.24 - Params::Util 1.00 - Scalar::Util 1.19 - Sub::Exporter 0.980 - Sub::Identify 0 - Sub::Name 0.20 - Try::Tiny 0.17 - parent 0.223 - strict 1.03 - warnings 1.03 - Package-DeprecationManager-0.17 - pathname: D/DR/DROLSKY/Package-DeprecationManager-0.17.tar.gz - provides: - Package::DeprecationManager 0.17 - requirements: - Carp 0 - ExtUtils::MakeMaker 0 - List::Util 1.33 - Package::Stash 0 - Params::Util 0 - Sub::Install 0 - Sub::Name 0 - strict 0 - warnings 0 - Package-Stash-0.38 - pathname: E/ET/ETHER/Package-Stash-0.38.tar.gz - provides: - Package::Stash 0.38 - Package::Stash::PP 0.38 - requirements: - B 0 - Carp 0 - Config 0 - Dist::CheckConflicts 0.02 - ExtUtils::MakeMaker 0 - File::Spec 0 - Getopt::Long 0 - Module::Implementation 0.06 - Package::Stash::XS 0.26 - Scalar::Util 0 - Symbol 0 - Text::ParseWords 0 - constant 0 - perl 5.008001 - strict 0 - warnings 0 - Package-Stash-XS-0.29 - pathname: E/ET/ETHER/Package-Stash-XS-0.29.tar.gz - provides: - Package::Stash::XS 0.29 - requirements: - ExtUtils::MakeMaker 0 - XSLoader 0 - perl 5.008001 - strict 0 - warnings 0 - Params-Util-1.07 - pathname: A/AD/ADAMK/Params-Util-1.07.tar.gz - provides: - Params::Util 1.07 - requirements: - ExtUtils::CBuilder 0.27 - ExtUtils::MakeMaker 6.52 - File::Spec 0.80 - Scalar::Util 1.18 - Test::More 0.42 - perl 5.00503 - Role-Tiny-2.000006 - pathname: H/HA/HAARG/Role-Tiny-2.000006.tar.gz - provides: - Role::Tiny 2.000006 - Role::Tiny::With 2.000006 - requirements: - Exporter 5.57 - perl 5.006 - Sub-Exporter-0.987 - pathname: R/RJ/RJBS/Sub-Exporter-0.987.tar.gz - provides: - Sub::Exporter 0.987 - Sub::Exporter::Util 0.987 - requirements: - Carp 0 - Data::OptList 0.100 - ExtUtils::MakeMaker 6.30 - Params::Util 0.14 - Sub::Install 0.92 - strict 0 - warnings 0 - Sub-Exporter-Progressive-0.001013 - pathname: F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz - provides: - Sub::Exporter::Progressive 0.001013 - requirements: - ExtUtils::MakeMaker 0 - Sub-Identify-0.14 - pathname: R/RG/RGARCIA/Sub-Identify-0.14.tar.gz - provides: - Sub::Identify 0.14 - requirements: - ExtUtils::MakeMaker 0 - Test::More 0 - Sub-Install-0.928 - pathname: R/RJ/RJBS/Sub-Install-0.928.tar.gz - provides: - Sub::Install 0.928 - requirements: - B 0 - Carp 0 - ExtUtils::MakeMaker 6.30 - Scalar::Util 0 - strict 0 - warnings 0 - Sub-Name-0.21 - pathname: E/ET/ETHER/Sub-Name-0.21.tar.gz - provides: - Sub::Name 0.21 - requirements: - Exporter 5.57 - ExtUtils::MakeMaker 0 - XSLoader 0 - perl 5.006 - strict 0 - warnings 0 - Sub-Quote-2.006003 - pathname: H/HA/HAARG/Sub-Quote-2.006003.tar.gz - provides: - Sub::Defer 2.006003 - Sub::Quote 2.006003 - requirements: - ExtUtils::MakeMaker 0 - Scalar::Util 0 - perl 5.006 - Try-Tiny-0.30 - pathname: E/ET/ETHER/Try-Tiny-0.30.tar.gz - provides: - Try::Tiny 0.30 - requirements: - Carp 0 - Exporter 5.57 - ExtUtils::MakeMaker 0 - constant 0 - perl 5.006 - strict 0 - warnings 0 diff --git a/base/wait-for-it.sh b/base/wait-for-it.sh deleted file mode 100755 index 33e0d0e..0000000 --- a/base/wait-for-it.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/bash -# -# See https://github.com/vishnubob/wait-for-it -# -# The MIT License (MIT) -# Copyright (c) 2016 Giles Hall - -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is furnished to do -# so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -cmdname=$(basename $0) - -echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $TIMEOUT -gt 0 ]]; then - echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" - else - echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" - fi - start_ts=$(date +%s) - while : - do - if [[ $ISBUSY -eq 1 ]]; then - nc -z $HOST $PORT - result=$? - else - (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 - result=$? - fi - if [[ $result -eq 0 ]]; then - end_ts=$(date +%s) - echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" - break - fi - sleep 1 - done - return $result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $QUIET -eq 1 ]]; then - timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & - else - timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & - fi - PID=$! - trap "kill -INT -$PID" INT - wait $PID - RESULT=$? - if [[ $RESULT -ne 0 ]]; then - echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" - fi - return $RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - hostport=(${1//:/ }) - HOST=${hostport[0]} - PORT=${hostport[1]} - shift 1 - ;; - --child) - CHILD=1 - shift 1 - ;; - -q | --quiet) - QUIET=1 - shift 1 - ;; - -s | --strict) - STRICT=1 - shift 1 - ;; - -h) - HOST="$2" - if [[ $HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - HOST="${1#*=}" - shift 1 - ;; - -p) - PORT="$2" - if [[ $PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - PORT="${1#*=}" - shift 1 - ;; - -t) - TIMEOUT="$2" - if [[ $TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$HOST" == "" || "$PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -TIMEOUT=${TIMEOUT:-15} -STRICT=${STRICT:-0} -CHILD=${CHILD:-0} -QUIET=${QUIET:-0} - -# check to see if timeout is from busybox? -# check to see if timeout is from busybox? -TIMEOUT_PATH=$(realpath $(which timeout)) -if [[ $TIMEOUT_PATH =~ "busybox" ]]; then - ISBUSY=1 - BUSYTIMEFLAG="-t" -else - ISBUSY=0 - BUSYTIMEFLAG="" -fi - -if [[ $CHILD -gt 0 ]]; then - wait_for - RESULT=$? - exit $RESULT -else - if [[ $TIMEOUT -gt 0 ]]; then - wait_for_wrapper - RESULT=$? - else - wait_for - RESULT=$? - fi -fi - -if [[ $CLI != "" ]]; then - if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then - echoerr "$cmdname: strict mode, refusing to execute subprocess" - exit $RESULT - fi - exec "${CLI[@]}" -else - exit $RESULT -fi From 2d9a0d82d54dcff6683334e6b86ee2b5670bd915 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Sat, 27 Apr 2019 11:29:15 +0100 Subject: [PATCH 033/141] Add logging and a config file for it, also make dependency on other services --- docker-compose.yml | 21 +++++++++++++++++++-- logging.env | 8 ++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 logging.env diff --git a/docker-compose.yml b/docker-compose.yml index 36a3daf..68f68c1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,15 @@ -version: '3.4' +version: "3.4" services: + logspout: + image: honeycombio/logspout-honeycomb:1.13 + volumes: + - type: bind + source: /var/run/docker.sock + target: /var/run/docker.sock + env_file: + - logging.env + ports: + - "8100:80" web: image: metacpan-web:latest build: @@ -25,6 +35,7 @@ services: - elasticsearch - elasticsearch_test - pgdb + - logspout image: metacpan-api:latest build: context: ./src/metacpan-api @@ -62,6 +73,8 @@ services: - database elasticsearch: image: elasticsearch:2.4 + depends_on: + - logspout volumes: - type: volume source: elasticsearch @@ -80,6 +93,8 @@ services: - elasticsearch elasticsearch_test: image: elasticsearch:2.4 + depends_on: + - logspout volumes: - type: volume source: elasticsearch_test @@ -99,8 +114,10 @@ services: pgdb: hostname: pgdb image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" + depends_on: + - logspout build: - context: './pg' + context: "./pg" args: PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" ports: diff --git a/logging.env b/logging.env new file mode 100644 index 0000000..0958881 --- /dev/null +++ b/logging.env @@ -0,0 +1,8 @@ +## The API KEY +HONEYCOMB_WRITE_KEY=XXX + +## HONEYCOMB_DATASET: 'dev' or 'production' +HONEYCOMB_DATASET=YYY + +## This is honeycomb magic +ROUTE_URIS=honeycomb://localhost \ No newline at end of file From a72d31ad31ce34912b4cba7bcc0ef51572c04931 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 27 Apr 2019 12:26:30 +0100 Subject: [PATCH 034/141] Add configuration for github-meets-cpan This is the integration of the docker-compose file from the github-meets-cpan repository. --- docker-compose.yml | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 68f68c1..f0bc572 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -71,6 +71,58 @@ services: - elasticsearch - web - database + +# _ _ _ _ _ +# __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ +# / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| +# | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ +# \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ +# |___/ +# _ +# ___ _ __ __ _ _ __ __ _____| |__ +# / __| '_ \ / _` | '_ \ \ \ /\ / / _ \ '_ \ +# | (__| |_) | (_| | | | | \ V V / __/ |_) | +# \___| .__/ \__,_|_| |_| \_/\_/ \___|_.__/ +# |_| +# + + github-meets-cpan-web: + image: metacpan/github-meets-cpan:latest + command: "/wait-for-it.sh mongodb:27017 -- morbo script/app.pl" + depends_on: + - mongodb + - logspout + networks: + - mongo + ports: + - "127.0.0.1:${GH_CPAN_SITE_PORT:-3000}:3000" + +# _ _ _ _ _ +# __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ +# / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| +# | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ +# \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ +# |___/ +# _ +# ___ _ __ __ _ _ __ __ _____| |__ ___ _ __ ___ _ __ +# / __| '_ \ / _` | '_ \ \ \ /\ / / _ \ '_ \ / __| '__/ _ \| '_ \ +# | (__| |_) | (_| | | | | \ V V / __/ |_) | | (__| | | (_) | | | | +# \___| .__/ \__,_|_| |_| \_/\_/ \___|_.__/ \___|_| \___/|_| |_| +# |_| +# + github-meets-cpan-web-cron: + image: metacpan/github-meets-cpan:latest + command: "/wait-for-it.sh mongodb:27017 -- perl cron/update.pl" + depends_on: + - mongodb + volumes: + - type: bind + source: ${MC_CONF_PRIVATE_DIR:-.}/github-meets-cpan/environment.json + target: /code/environment.json + read_only: true + networks: + - mongo + elasticsearch: image: elasticsearch:2.4 depends_on: @@ -143,10 +195,24 @@ services: target: /healthcheck.sh read_only: true +# _ _ +# _ __ ___ ___ _ __ __ _ ___ __| | |__ +# | '_ ` _ \ / _ \| '_ \ / _` |/ _ \ / _` | '_ \ +# | | | | | | (_) | | | | (_| | (_) | (_| | |_) | +# |_| |_| |_|\___/|_| |_|\__, |\___/ \__,_|_.__/ +# |___/ +# + + mongodb: + image: mvertes/alpine-mongo:latest + networks: + - mongo + networks: elasticsearch: database: web: + mongo: volumes: web_carton: From e9109cb0930fc7a319fa8114c944d06d9893bab2 Mon Sep 17 00:00:00 2001 From: Leo Lapworth Date: Sat, 27 Apr 2019 13:30:49 +0100 Subject: [PATCH 035/141] Add a travis test for compose NOTE: at the moment this is also building the images from src, until we work out about environments and images etc --- .travis.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..df5434b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: generic + +services: + - docker + +notifications: + irc: "irc.perl.org#metacpan-travis" + +## FIXME: this is just until local repo's build their own images +before_script: + - bin/metacpan-docker init + +# Perform build, make sure to pull image deps and build from the fetched version as cache +script: + - docker-compose up -d + - docker-compose ps + From da1cbec5d0b5423de8e23cb0bbe557040b81e54a Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 27 Apr 2019 14:08:20 +0100 Subject: [PATCH 036/141] Add section definitions Used figlet to create a pretty header for each of the sections. --- docker-compose.yml | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index f0bc572..1bba600 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,22 @@ version: "3.4" + +# ____ _____ ______ _____ ____ _____ ____ +# / ___|| ____| _ \ \ / /_ _/ ___| ____/ ___| +# \___ \| _| | |_) \ \ / / | | | | _| \___ \ +# ___) | |___| _ < \ V / | | |___| |___ ___) | +# |____/|_____|_| \_\ \_/ |___\____|_____|____/ +# + services: + +# _ _ +# | | ___ __ _ ___ _ __ ___ _ _| |_ +# | |/ _ \ / _` / __| '_ \ / _ \| | | | __| +# | | (_) | (_| \__ \ |_) | (_) | |_| | |_ +# |_|\___/ \__, |___/ .__/ \___/ \__,_|\__| +# |___/ |_| +# + logspout: image: honeycombio/logspout-honeycomb:1.13 volumes: @@ -10,6 +27,14 @@ services: - logging.env ports: - "8100:80" + +# _ +# __ _____| |__ +# \ \ /\ / / _ \ '_ \ +# \ V V / __/ |_) | +# \_/\_/ \___|_.__/ +# + web: image: metacpan-web:latest build: @@ -30,6 +55,15 @@ services: - "5001:5001" networks: - web + +# _ +# __ _ _ __ (_) +# / _` | '_ \| | +# | (_| | |_) | | +# \__,_| .__/|_| +# |_| +# + api: depends_on: - elasticsearch @@ -123,6 +157,20 @@ services: networks: - mongo +# ____ _ _____ _ ____ _ ____ _____ ____ +# | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| +# | | | |/ _ \ | | / _ \ | _ \ / _ \ \___ \| _| \___ \ +# | |_| / ___ \| |/ ___ \| |_) / ___ \ ___) | |___ ___) | +# |____/_/ \_\_/_/ \_\____/_/ \_\____/|_____|____/ +# + +# _ _ _ _ +# ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ +# / _ \ |/ _` / __| __| |/ __/ __|/ _ \/ _` | '__/ __| '_ \ +# | __/ | (_| \__ \ |_| | (__\__ \ __/ (_| | | | (__| | | | +# \___|_|\__,_|___/\__|_|\___|___/\___|\__,_|_| \___|_| |_| +# + elasticsearch: image: elasticsearch:2.4 depends_on: @@ -143,6 +191,20 @@ services: - "9200:9200" networks: - elasticsearch + +# _ _ _ _ +# ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ +# / _ \ |/ _` / __| __| |/ __/ __|/ _ \/ _` | '__/ __| '_ \ +# | __/ | (_| \__ \ |_| | (__\__ \ __/ (_| | | | (__| | | | +# \___|_|\__,_|___/\__|_|\___|___/\___|\__,_|_| \___|_| |_| +# +# _ _ +# | |_ ___ ___| |_ +# | __/ _ \/ __| __| +# | || __/\__ \ |_ +# \__\___||___/\__| +# + elasticsearch_test: image: elasticsearch:2.4 depends_on: @@ -163,6 +225,15 @@ services: - "9900:9200" networks: - elasticsearch + +# _ _ +# _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | +# | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | +# | |_) | (_) \__ \ || (_| | | | __/\__ \ (_| | | +# | .__/ \___/|___/\__\__, |_| \___||___/\__, |_| +# |_| |___/ |_| +# + pgdb: hostname: pgdb image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" @@ -208,12 +279,26 @@ services: networks: - mongo +# _ _ _____ _______ _____ ____ _ ______ +# | \ | | ____|_ _\ \ / / _ \| _ \| |/ / ___| +# | \| | _| | | \ \ /\ / / | | | |_) | ' /\___ \ +# | |\ | |___ | | \ V V /| |_| | _ <| . \ ___) | +# |_| \_|_____| |_| \_/\_/ \___/|_| \_\_|\_\____/ +# + networks: elasticsearch: database: web: mongo: +# __ _____ _ _ _ __ __ _____ ____ +# \ \ / / _ \| | | | | | \/ | ____/ ___| +# \ \ / / | | | | | | | | |\/| | _| \___ \ +# \ V /| |_| | |__| |_| | | | | |___ ___) | +# \_/ \___/|_____\___/|_| |_|_____|____/ +# + volumes: web_carton: api_carton: From db5f926fa62241bd03d505596b2281649ed19dbd Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 27 Apr 2019 14:13:06 +0100 Subject: [PATCH 037/141] Change language to python The hope is that python is going to create a smaller footprint and docker-compose requires python anyway. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index df5434b..d202e53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: generic +language: python services: - docker From e1246cdee5df715e89f0752213903bcb68075805 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 27 Apr 2019 14:25:35 +0100 Subject: [PATCH 038/141] Add docker-compose to environment Use a newer docker-compose directly from github. --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index d202e53..9cdf634 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,16 @@ services: notifications: irc: "irc.perl.org#metacpan-travis" +env: + - DOCKER_COMPOSE_VERSION=1.24.0 + +# Install an up to date (ish) docker-compose +before_install: + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin + ## FIXME: this is just until local repo's build their own images before_script: - bin/metacpan-docker init From c0ccb4effd0b0950a0512e6a921dce307eee9b6b Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 27 Apr 2019 14:39:58 +0100 Subject: [PATCH 039/141] Remove postgresql local port mapping PostgreSQL doesn't need to communicate on localhost, as the containers can all communicate within the docker networking. --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f0bc572..f1ec074 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -172,8 +172,6 @@ services: context: "./pg" args: PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" - ports: - - "5432:5432" networks: - database healthcheck: From aa9da345e0d43ae3ef3923600828d91dfcf54550 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 27 Apr 2019 15:00:13 +0100 Subject: [PATCH 040/141] Add "secrets" for github-meets-cpan These really aren't secrets but the file is here to satisfy the mount points. --- github-meets-cpan/environment.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 github-meets-cpan/environment.json diff --git a/github-meets-cpan/environment.json b/github-meets-cpan/environment.json new file mode 100644 index 0000000..e69de29 From c661063cc8d801454af9a3dd8b26366f94db7c15 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 27 Apr 2019 15:57:19 +0100 Subject: [PATCH 041/141] Use images from dockerhub for web and api --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6b440c5..2a084a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: # web: - image: metacpan-web:latest + image: metacpan/metacpan-web:latest build: context: ./src/metacpan-web volumes: @@ -70,7 +70,7 @@ services: - elasticsearch_test - pgdb - logspout - image: metacpan-api:latest + image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api env_file: From da82a301606a1d30681506462fc9909c0b66d71f Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 2 May 2019 13:59:03 -0400 Subject: [PATCH 042/141] Change name of github-meets-cpan services The `-web` suffix only kind of made sense, but the name is going to be used during the site deployment and having it there makes no sense, so removing it all together. --- docker-compose.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2a084a9..8177a16 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -112,15 +112,14 @@ services: # | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ # \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ # |___/ -# _ -# ___ _ __ __ _ _ __ __ _____| |__ -# / __| '_ \ / _` | '_ \ \ \ /\ / / _ \ '_ \ -# | (__| |_) | (_| | | | | \ V V / __/ |_) | -# \___| .__/ \__,_|_| |_| \_/\_/ \___|_.__/ +# +# ___ _ __ __ _ _ __ +# / __| '_ \ / _` | '_ \ +# | (__| |_) | (_| | | | | +# \___| .__/ \__,_|_| |_| # |_| # - - github-meets-cpan-web: + github-meets-cpan: image: metacpan/github-meets-cpan:latest command: "/wait-for-it.sh mongodb:27017 -- morbo script/app.pl" depends_on: @@ -137,14 +136,15 @@ services: # | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ # \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ # |___/ -# _ -# ___ _ __ __ _ _ __ __ _____| |__ ___ _ __ ___ _ __ -# / __| '_ \ / _` | '_ \ \ \ /\ / / _ \ '_ \ / __| '__/ _ \| '_ \ -# | (__| |_) | (_| | | | | \ V V / __/ |_) | | (__| | | (_) | | | | -# \___| .__/ \__,_|_| |_| \_/\_/ \___|_.__/ \___|_| \___/|_| |_| +# +# ___ _ __ __ _ _ __ ___ _ __ ___ _ __ +# / __| '_ \ / _` | '_ \ / __| '__/ _ \| '_ \ +# | (__| |_) | (_| | | | | | (__| | | (_) | | | | +# \___| .__/ \__,_|_| |_| \___|_| \___/|_| |_| # |_| # - github-meets-cpan-web-cron: + + github-meets-cpan-cron: image: metacpan/github-meets-cpan:latest command: "/wait-for-it.sh mongodb:27017 -- perl cron/update.pl" depends_on: From 88b48ebb2290b6ccdc4163c063f68b3dbc4da1a4 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Fri, 10 May 2019 13:56:02 -0400 Subject: [PATCH 043/141] Change mongodb image Use the official mongodb image even though it's xenial and not small alpine. For some reason the alpine image kept network disconnecting causing github-meets-cpan to go down. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8177a16..3394d29 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -273,7 +273,7 @@ services: # mongodb: - image: mvertes/alpine-mongo:latest + image: mongo:latest networks: - mongo From 18663ebbec4fff2e8e0d5d1ae3e497b813def285 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Mon, 13 May 2019 10:47:19 -0400 Subject: [PATCH 044/141] Add healthcheck option for mongodb This will have docker check the health of the container using the simple MongoDB ping command and checking for an `ok` status. --- docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3394d29..57e5869 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -276,6 +276,12 @@ services: image: mongo:latest networks: - mongo + healthcheck: + interval: 10s + timeout: 10s + retries: 0 + start_period: 40s + test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet # _ _ _____ _______ _____ ____ _ ______ # | \ | | ____|_ _\ \ / / _ \| _ \| |/ / ___| From 9271bee19057df308837359e2fe635884e30eed0 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 16 May 2019 14:45:11 -0400 Subject: [PATCH 045/141] Update documentation to include docker-compose With all the work that's been done on getting the containers up and running, time to update the documentation to reflect those changes. There is more documentation changes to come, this however does get the quick start handled, and should allow other people to run the containers. --- README.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 436cf4f..2284c68 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,34 @@ -# Running the MetaCPAN stack with Docker (via Docker Compose) +# MetaCPAN Docker + + + + +* [Running the MetaCPAN stack with Docker (via Docker Compose)](#running-the-metacpan-stack-with-docker-via-docker-compose) +* [Quick Start](#quick-start) +* [System architecture](#system-architecture) + * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) + * [`bin/metacpan init`](#binmetacpan-init) + * [`bin/metacpan localapi`](#binmetacpan-localapi) + * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) + * [Services](#services) + * [`web`](#web) + * [`api`](#api) + * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) + * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) + * [Putting the above all together](#putting-the-above-all-together) + * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) +* [Tips and tricks](#tips-and-tricks) + * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) + * [Running tests](#running-tests) + * [Updating Carton dependencies](#updating-carton-dependencies) + * [Running Kibana to peek into ElasticSearch data](#running-kibana-to-peek-into-elasticsearch-data) +* [Peeking Inside the Container](#peeking-inside-the-container) +* [To Do](#to-do) +* [See also](#see-also) + + + +## Running the MetaCPAN stack with Docker (via Docker Compose) **Notice**: This project is in experimental stage. It works, but there are a lot of things to be done better. Please use it and create Issues @@ -17,17 +47,33 @@ support, and less issues overall. [2]: https://docs.docker.com/docker-for-mac/ [3]: https://docs.docker.com/docker-for-windows/ +It is recommended that you alias `docker-compose` to `fig` (the rest of the +document assumes you have done so). You are going to have to type this command +a lot. + Then, clone this repo and setup the environment: git clone https://github.com/metacpan/metacpan-docker.git cd metacpan-docker bin/metacpan-docker init -After this, you can run both the `metacpan-web` frontend on +The `bin/metacpan-docker init` command clones the source repositories for: +- `metacpan-web` +- `metacpan-api` + +These repositories are automatically mounted in to the appropriate docker +containers allowing the developer to use their preferred tools to work with the +source code. + +The `fig up` command on its own will bring up the entire stack. + +After issuing `fig up`, you can run both the `metacpan-web` frontend on http://localhost:5001 and the `metacpan-api` backend on http://localhost:5000, with ElasticSearch on http://localhost:9200, via - bin/metacpan-docker localapi up +The `fig up` command will fetch the official container images from +[MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) +repositories. This will build the Docker images for the MetaCPAN and ElasticSearch services (which will take a while, especially on a fresh first time @@ -37,19 +83,20 @@ ready when the services start listening on the ports listed above. Don't forget to seed the local `metacpan-api` with a partial CPAN; run the following command in a separate terminal to get you up to speed: - bin/metacpan-docker localapi exec api index-cpan.sh + fig exec api index-cpan.sh This will prompt you to confirm removing old indices and setting up mappings on the ElasticSearch service (say `YES`) then proceed to rsync a partial CPAN in `/CPAN` for its metadata to be imported. -Once the above is done, you should be able to see your local partial -CPAN data in e.g. http://localhost:5001/recent and elsewhere. +Once the above is done, you should be able to see your local partial CPAN data +in e.g. [http://localhost:5001/recent](http://localhost:5001/recent) and +elsewhere. Alternatively, if you just want to hack on the web frontend, you can run this instead of all the above: - docker-compose up + fig up web From here, you can proceed and hack on the MetaCPAN code at `src/metacpan-api` and/or `src/metacpan-web` directories, and saving @@ -58,9 +105,7 @@ edits will reload the corresponding apps automatically! When done hacking (or, more likely, when you need to rebuild/refresh your Docker environment) you can then run - bin/metacpan-docker localapi down - # or, if running the metacpan-web service only - docker-compose down + fig down in another terminal to stop all MetaCPAN services and remove the containers. @@ -75,7 +120,10 @@ The system consists of several services that live in docker containers: * `api` — the main server on http://localhost:5000 * `elasticsearch` — database on http://localhost:9200 * `elasticsearch_test` — test database on http://localhost:9300 - + * `pgdb` - PostgreSQL database container + * `logspout` - Docker log interface to honeycomb.io + * `github-meets-cpan` - Containerized version of `gh.metacpan.org` + These services use one or more Docker volumes: * `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` From 30279ecf1b770605ff044f7f04ac94365749f582 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 16 May 2019 15:57:04 -0400 Subject: [PATCH 046/141] Add docker as non-root user documentation The documentation assumes that the developer has taken these steps and does not include the `sudo` required for each command when it hasn't been done. Including a link to the Docker post-installation steps that explain how to set it up. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 2284c68..df9963c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,13 @@ support, and less issues overall. [2]: https://docs.docker.com/docker-for-mac/ [3]: https://docs.docker.com/docker-for-windows/ +On Linux, Docker's default implementation allows only `root` user to access +docker commands and control containers. In order to allow a regular user to +access docker follow the +[post-installation instructions](https://docs.docker.com/install/linux/linux-postinstall/). +This document assumes the post-installation steps have been followed for the +current user. + It is recommended that you alias `docker-compose` to `fig` (the rest of the document assumes you have done so). You are going to have to type this command a lot. From 0e39ce2e799facb0bdb8b7045e543f6c3104dcea Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Mon, 17 Jun 2019 10:41:58 -0400 Subject: [PATCH 047/141] Documentation clarifications Updated documentation to use `docker-compose` mainly and reference the use of a `fig` alias. Further document the use of containers and what the containers are. --- README.md | 330 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 189 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index df9963c..ed7c709 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,24 @@ # MetaCPAN Docker - * [Running the MetaCPAN stack with Docker (via Docker Compose)](#running-the-metacpan-stack-with-docker-via-docker-compose) * [Quick Start](#quick-start) +* [Working with Containers](#working-with-containers) + * [Accessing Containers](#accessing-containers) + * [Accessing Services](#accessing-services) + * [`web`](#web) + * [`api`](#api) + * [`github-meets-cpan`](#github-meets-cpan) + * [`ElasticSearch`](#elasticsearch) * [System architecture](#system-architecture) * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) * [`bin/metacpan init`](#binmetacpan-init) * [`bin/metacpan localapi`](#binmetacpan-localapi) * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) * [Services](#services) - * [`web`](#web) - * [`api`](#api) + * [`web`](#web-1) + * [`api`](#api-1) * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) * [Putting the above all together](#putting-the-above-all-together) @@ -30,17 +36,14 @@ ## Running the MetaCPAN stack with Docker (via Docker Compose) -**Notice**: This project is in experimental stage. It works, but there -are a lot of things to be done better. Please use it and create Issues -with your problems. +**Notice**: This project is in experimental stage. It works, but there are a lot +of things to be done better. Please use it and create Issues with your problems. ## Quick Start -Install [Docker][0] and [Docker Compose][1] for your -platform. [Docker for Mac][2] or [Docker for Windows][3] will install -both tools for you, if you are on either of these environments. It is -however, recommended to run directly on Linux, for native container -support, and less issues overall. +Install [Docker][0] and [Docker Compose][1] for your platform. [Docker for +Mac][2] or [Docker for Windows][3] will install both tools for you, if you are +on either of these environments. [0]: https://docs.docker.com/installation [1]: https://docs.docker.com/compose/install @@ -54,9 +57,9 @@ access docker follow the This document assumes the post-installation steps have been followed for the current user. -It is recommended that you alias `docker-compose` to `fig` (the rest of the -document assumes you have done so). You are going to have to type this command -a lot. +It is highly recommended that you alias `docker-compose` to `fig` (its original +name) and use it wherever `docker-compose` is used. You are going to have to +type this command a lot. Then, clone this repo and setup the environment: @@ -65,6 +68,7 @@ Then, clone this repo and setup the environment: bin/metacpan-docker init The `bin/metacpan-docker init` command clones the source repositories for: + - `metacpan-web` - `metacpan-api` @@ -72,95 +76,139 @@ These repositories are automatically mounted in to the appropriate docker containers allowing the developer to use their preferred tools to work with the source code. -The `fig up` command on its own will bring up the entire stack. - -After issuing `fig up`, you can run both the `metacpan-web` frontend on -http://localhost:5001 and the `metacpan-api` backend on -http://localhost:5000, with ElasticSearch on http://localhost:9200, via +The `docker-compose up` command on its own will bring up the entire stack in the +foreground (logs will be displayed). -The `fig up` command will fetch the official container images from +The `docker-compose up` command will fetch the official container images from [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) repositories. -This will build the Docker images for the MetaCPAN and ElasticSearch -services (which will take a while, especially on a fresh first time -install of Docker,) and run the services. You'll know when they're -ready when the services start listening on the ports listed above. +This will build the Docker containers for MetaCPAN, PostgreSQL and ElasticSearch +services (which will take a while, especially on a fresh first time install of +Docker,) and run the services. -Don't forget to seed the local `metacpan-api` with a partial CPAN; run -the following command in a separate terminal to get you up to speed: +Don't forget to seed the local `metacpan-api` with a partial CPAN; run the +following command in a separate terminal to get you up to speed: - fig exec api index-cpan.sh + docker-compose exec api index-cpan.sh -This will prompt you to confirm removing old indices and setting up -mappings on the ElasticSearch service (say `YES`) then proceed to rsync -a partial CPAN in `/CPAN` for its metadata to be imported. +This will prompt you to confirm removing old indices and setting up mappings on +the ElasticSearch service (say `YES`) then proceed to rsync a partial CPAN in +`/CPAN` for its metadata to be imported. Once the above is done, you should be able to see your local partial CPAN data in e.g. [http://localhost:5001/recent](http://localhost:5001/recent) and elsewhere. -Alternatively, if you just want to hack on the web frontend, you can run -this instead of all the above: +Alternatively, if you just want to hack on the web frontend, you can run this +instead of all the above: - fig up web + docker-compose up web -From here, you can proceed and hack on the MetaCPAN code at -`src/metacpan-api` and/or `src/metacpan-web` directories, and saving -edits will reload the corresponding apps automatically! +From here, you can proceed and hack on the MetaCPAN code at `src/metacpan-api` +and/or `src/metacpan-web` directories, and saving edits will reload the +corresponding apps automatically! -When done hacking (or, more likely, when you need to rebuild/refresh -your Docker environment) you can then run +When done hacking (or, more likely, when you need to rebuild/refresh your Docker +environment) you can then run - fig down + docker-compose down -in another terminal to stop all MetaCPAN services and remove the -containers. +in another terminal to stop all MetaCPAN services and remove the containers. For further details, read on! +## Working with Containers + +### Accessing Containers + +Containers are accessible via the `docker-compose exec` command followed by the +container and then the command to execute. For example, to start a shell prompt +in the `api` container: + + docker-compose exec api /bin/bash + +Executing tests via `prove` inside the API container: + + docker-compose exec api prove -lvr \ + t/00_setup.t \ + t/01_darkpan.t \ + t/api/controller/cover.t + +To access the `psql` command line client in the PostgreSQL container: + + docker-compose exec pgdb psql + +Similarly the `mongodb` command line client in the MongoDB container is accessed +via: + + docker-compose exec mongodb mongo --host mongodb test + +### Accessing Services + +Each container is responsible for a different service. Some of these services +are available in the developer enviornment via ports on the host system. + +#### `web` + +The local instance of the web front end is accessiable via +[http://localhost:5001](http://localhost:5001). + +#### `api` + +[http://localhost:5000](http://localhost:5000) + +#### `github-meets-cpan` + +[http://localhost:3000](http://localhost:3000) + +#### `ElasticSearch` + +[http://localhost:9200](http://localhost:9200) + +The PostgreSQL and MongoDB services by default are only accessible from other +containers. + ## System architecture The system consists of several services that live in docker containers: - * `web` — the web interface on http://localhost:5001 - * `api` — the main server on http://localhost:5000 - * `elasticsearch` — database on http://localhost:9200 - * `elasticsearch_test` — test database on http://localhost:9300 - * `pgdb` - PostgreSQL database container - * `logspout` - Docker log interface to honeycomb.io - * `github-meets-cpan` - Containerized version of `gh.metacpan.org` +- `web` — the web interface on http://localhost:5001 +- `api` — the main server on http://localhost:5000 +- `elasticsearch` — database on http://localhost:9200 +- `elasticsearch_test` — test database on http://localhost:9300 +- `pgdb` - PostgreSQL database container +- `logspout` - Docker log interface to honeycomb.io +- `github-meets-cpan` - Containerized version of `gh.metacpan.org` These services use one or more Docker volumes: - * `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` - * `metacpan_elasticsearch`: holds the ElasticSearch database files - * `metacpan_elasticsearch_test`: holds the ElasticSearch test database - files - * `metacpan_api_carton` and `metacpan_web_carton`: holds the - dependencies installed by [Carton][4] for the `api` and `web` - services, respectively; mounted on `/carton` instead of `local`, to - prevent clashing with the host user's Carton - +- `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` +- `metacpan_elasticsearch`: holds the ElasticSearch database files +- `metacpan_elasticsearch_test`: holds the ElasticSearch test database files +- `metacpan_api_carton` and `metacpan_web_carton`: holds the dependencies + installed by [Carton][4] for the `api` and `web` services, respectively; + mounted on `/carton` instead of `local`, to prevent clashing with the host + user's Carton + [4]: https://metacpan.org/pod/Carton - -Docker Compose is used to, uh, _compose_ them all together into one -system. Using `docker-compose` directly is a mouthful, however, so -putting this all together is done via the `bin/metacpan-docker` script -to simplify setup and usage (and to get you started hacking on the -MetaCPAN sooner!) + +Docker Compose is used to, uh, _compose_ them all together into one system. +Using `docker-compose` directly is a mouthful, however, so putting this all +together is done via the `bin/metacpan-docker` script to simplify setup and +usage (and to get you started hacking on the MetaCPAN sooner!) ### The `bin/metacpan-docker` script -`bin/metacpan-docker` is a thin wrapper for the `docker-compose` -command, providing the environment variables necessary to run a basic -MetaCPAN environment. It provides these subcommands: +`bin/metacpan-docker` is a thin wrapper for the `docker-compose` command, +providing the environment variables necessary to run a basic MetaCPAN +environment. It provides these subcommands: #### `bin/metacpan init` -The `init` subcommand basically clones the [metacpan-api][5] -and [metacpan-web][6] repositories, and sets up the git commit hooks for -each of them, in preparation for future `docker-compose` or +The `init` subcommand basically clones the [metacpan-api][5] and +[metacpan-web][6] repositories, and sets up the git commit hooks for each of +them, in preparation for future `docker-compose` or `bin/metacpan-docker localapi` commands. [5]: https://github.com/metacpan/metacpan-api @@ -168,40 +216,41 @@ each of them, in preparation for future `docker-compose` or #### `bin/metacpan localapi` -The `localapi` subcommand adds the necessary configuration for -`docker-compose` to run both the `metacpan-web` and `metacpan-api` -services, along with `elasticsearch` and Docker volumes. Under the -hood, it customizes the `COMPOSE_FILE` and `COMPOSE_PROJECT_NAME` -environment variables used by `docker-compose` to use additional YAML -configuration files aside from the default `docker-compose.yml`. +The `localapi` subcommand adds the necessary configuration for `docker-compose` +to run both the `metacpan-web` and `metacpan-api` services, along with +`elasticsearch` and Docker volumes. Under the hood, it customizes the +`COMPOSE_FILE` and `COMPOSE_PROJECT_NAME` environment variables used by +`docker-compose` to use additional YAML configuration files aside from the +default `docker-compose.yml`. #### `bin/metacpan-docker` build/up/down/start/stop/run/ps/top... -As noted earlier, `bin/metacpan-docker` is a thin wrapper to -`docker-compose`, so commands like `up`, `down`, and `run` will work as -expected from `docker-compose`. See the [docker-compose docs][7] for an -overview of available commands. +As noted earlier, `bin/metacpan-docker` is a thin wrapper to `docker-compose`, +so commands like `up`, `down`, and `run` will work as expected from +`docker-compose`. See the [docker-compose docs][7] for an overview of available +commands. -[7]: https://docs.docker.com/compose/reference/overview/#command-options-overview-and-help +[7]: + https://docs.docker.com/compose/reference/overview/#command-options-overview-and-help ### Services #### `web` -The `web` service is a checkout of `metacpan-web`, built as a Docker -image. Running this service alone is enough if you want to just hack on -the frontend, since by default the service is configured to talk to -https://fastapi.metacpan.org for its backend; if this is what you want, -then you can simply invoke `docker-compose up`. +The `web` service is a checkout of `metacpan-web`, built as a Docker image. +Running this service alone is enough if you want to just hack on the frontend, +since by default the service is configured to talk to +https://fastapi.metacpan.org for its backend; if this is what you want, then you +can simply invoke `docker-compose up`. #### `api` -The `api` service is a checkout of `metacpan-api`, built as a Docker -image, just like the `web` service. +The `api` service is a checkout of `metacpan-api`, built as a Docker image, just +like the `web` service. If using this service to run a local backend, you will need to run some -additional commands in a separate terminal once `bin/metacpan-docker -localapi up` runs: +additional commands in a separate terminal once +`bin/metacpan-docker localapi up` runs: ##### Setting up a partial CPAN in the `api` service @@ -209,10 +258,9 @@ Running bin/metacpan-docker localapi exec api partial-cpan-mirror.sh -will `rsync` modules selected CPAN authors, plus the package and author -indices, into the `api` service's `/CPAN` directory. This is nearly -equivalent to the same script in the [metacpan-developer][8] repository. - +will `rsync` modules selected CPAN authors, plus the package and author indices, +into the `api` service's `/CPAN` directory. This is nearly equivalent to the +same script in the [metacpan-developer][8] repository. [8]: https://github.com/metacpan/metacpan-developer ##### Bootstrapping the `elasticsearch` indices @@ -224,23 +272,22 @@ Running bin/metacpan-docker localapi exec api bin/run bin/metacpan latest bin/metacpan-docker localapi exec api bin/run bin/metacpan author -in sequence will create the indices and mappings in the `elasticsearch` -service, and import the `/CPAN` data into `elasticsearch`. +in sequence will create the indices and mappings in the `elasticsearch` service, +and import the `/CPAN` data into `elasticsearch`. ##### Putting the above all together If you're impatient or lazy to do all the above, just running bin/metacpan-docker localapi exec api index-cpan.sh - + instead will set it all up for you. #### elasticsearch and elasticsearch_test -The `elasticsearch` and `elasticsearch_test` services uses the -official [ElasticSearch Docker image][9], configured with settings and -scripts taken from the [metacpan-puppet][10] repository. It is depended -on by the `api` service. +The `elasticsearch` and `elasticsearch_test` services uses the official +[ElasticSearch Docker image][9], configured with settings and scripts taken from +the [metacpan-puppet][10] repository. It is depended on by the `api` service. [9]: https://store.docker.com/images/elasticsearch [10]: https://github.com/metacpan/metacpan-puppet @@ -249,10 +296,10 @@ on by the `api` service. ### Running your own miniCPAN inside metacpan-docker -Suppose you have a local minicpan in `/home/ftp/pub/CPAN`. If you would -like to use this in metacpan-docker, then edit the -`docker-compose.localapi.yml` to change the `api` service's volume -mounts to use your local minicpan as `/CPAN`, e.g.: +Suppose you have a local minicpan in `/home/ftp/pub/CPAN`. If you would like to +use this in metacpan-docker, then edit the `docker-compose.localapi.yml` to +change the `api` service's volume mounts to use your local minicpan as `/CPAN`, +e.g.: ```yaml services: @@ -262,9 +309,9 @@ services: ... ``` -Note that if you want CPAN author data indexed into ElasticSearch, your -minicpan should include `authors/00whois.xml`. Full indexing would take -a better part of a day or two, depending on your hardware. +Note that if you want CPAN author data indexed into ElasticSearch, your minicpan +should include `authors/00whois.xml`. Full indexing would take a better part of +a day or two, depending on your hardware. ### Running tests @@ -272,7 +319,7 @@ Use `bin/metacpan-docker run` and similar: # Run tests for metacpan-web against fastapi.metacpan.org bin/metacpan-docker exec web bin/prove - + # Run tests for metacpan-web against local api bin/metacpan-docker localapi exec web bin/prove @@ -281,45 +328,45 @@ Use `bin/metacpan-docker run` and similar: ### Updating Carton dependencies -Because both the `api` and `web` services are running inside -clean [Perl][11] containers, it is possible to maintain a clean set of -Carton dependencies independent of your host machine's perl. Just -update the `cpanfile` of the project, and run +Because both the `api` and `web` services are running inside clean [Perl][11] +containers, it is possible to maintain a clean set of Carton dependencies +independent of your host machine's perl. Just update the `cpanfile` of the +project, and run bin/metacpan-docker exec web carton install # or - bin/metacpan-docker exec api carton install - -Due to the way the Compose services are configured, these commands will -update the corresponding `cpanfile.snapshot` safely, even if you do _or_ -don't have a `local` directory (internally, the containers' `local` -directory is placed in `/carton` instead, to prevent interfering with -the host user's own `local` Carton directory.) + bin/metacpan-docker exec api carton install + +Due to the way the Compose services are configured, these commands will update +the corresponding `cpanfile.snapshot` safely, even if you do _or_ don't have a +`local` directory (internally, the containers' `local` directory is placed in +`/carton` instead, to prevent interfering with the host user's own `local` +Carton directory.) [11]: https://github.com/Perl/docker-perl - + ### Running Kibana to peek into ElasticSearch data -By default, the `docker-compose.localapi.yml` configures the -`elasticsearch` service to listen on the Docker host at -http://localhost:9200, and is also accessible via the Docker `default` -network address of http://172.17.0.1:9200; you can inspect it via simple -`curl` or `wget` requests, or use a [Kibana][12] container, e.g. +By default, the `docker-compose.localapi.yml` configures the `elasticsearch` +service to listen on the Docker host at http://localhost:9200, and is also +accessible via the Docker `default` network address of http://172.17.0.1:9200; +you can inspect it via simple `curl` or `wget` requests, or use a [Kibana][12] +container, e.g. docker run --rm -p 5601:5601 -e ELASTICSEARCH_URL=http://172.17.0.1:9200 -it kibana:4.6 -Running the above will provide a Kibana container at -http://localhost:5601, which you can configure to have it read the -`cpan*` index in the `elasticsearch` service. +Running the above will provide a Kibana container at http://localhost:5601, +which you can configure to have it read the `cpan*` index in the `elasticsearch` +service. -It is also certainly possible to run Kibana as part of the compose -setup, by configuring e.g. a `kibana` service. +It is also certainly possible to run Kibana as part of the compose setup, by +configuring e.g. a `kibana` service. [12]: https://hub.docker.com/_/kibana/ ## Peeking Inside the Container -If you run `docker ps` you'll see the containers. You might see something like: +If you run `docker ps` you'll see the containers. You might see something like: ``` $ docker ps @@ -331,21 +378,22 @@ c7de256d29b2 elasticsearch:2.4 "/docker-entrypoint.…" 5 months ag f1e04fe53598 elasticsearch:2.4 "/docker-entrypoint.…" 5 months ago Up 26 hours 9300/tcp, 0.0.0.0:9900->9200/tcp metacpan_elasticsearch_test_1 ``` -You can then use the container name to get shell access. For instance, to log in to the API container: +You can then use the container name to get shell access. For instance, to log in +to the API container: `docker exec -it metacpan_api_1 /bin/bash` ## To Do - * Integrate other MetaCPAN services (e.g. github-meets-cpan) - * Add more Tips and tricks (as we continue hacking MetaCPAN in Docker) - * Provide a "near-production" Docker Compose configuration, suitable - for Docker Swarm, and/or - * Refactor configuration to be suitable for Kubernetes (Google Cloud) - deployments +- Integrate other MetaCPAN services (e.g. github-meets-cpan) +- Add more Tips and tricks (as we continue hacking MetaCPAN in Docker) +- Provide a "near-production" Docker Compose configuration, suitable for Docker + Swarm, and/or +- Refactor configuration to be suitable for Kubernetes (Google Cloud) + deployments ## See also - * [Docker Compose documentation](https://docs.docker.com/compose/overview) - * [metacpan-developer][7] and [metacpan-puppet][9] from which much - information about the architecture is based on +- [Docker Compose documentation](https://docs.docker.com/compose/overview) +- [metacpan-developer][7] and [metacpan-puppet][9] from which much information + about the architecture is based on From 579b99317b91f2cb59bd2570bf9749686f150280 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Mon, 17 Jun 2019 10:58:29 -0400 Subject: [PATCH 048/141] Remove requirement for logspout During development all logging is available through `docker-compose logs`. This change removes the automatic starting of a logspout container, it is still available for manually starting. --- docker-compose.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 57e5869..cfc1bab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,7 +69,6 @@ services: - elasticsearch - elasticsearch_test - pgdb - - logspout image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -173,8 +172,6 @@ services: elasticsearch: image: elasticsearch:2.4 - depends_on: - - logspout volumes: - type: volume source: elasticsearch @@ -207,8 +204,6 @@ services: elasticsearch_test: image: elasticsearch:2.4 - depends_on: - - logspout volumes: - type: volume source: elasticsearch_test @@ -237,8 +232,6 @@ services: pgdb: hostname: pgdb image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" - depends_on: - - logspout build: context: "./pg" args: From 4dc6eb9161a6215be686a4fb78529f3fe5d2ce68 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Mon, 17 Jun 2019 11:00:43 -0400 Subject: [PATCH 049/141] Add bind of api configuration into the container Automatically bind a configuration file into the api container for development purposes. --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index cfc1bab..2aeb689 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,6 +86,10 @@ services: source: ./configs/metacpan-api/metacpan_server.conf target: /metacpan-api/metacpan_server.conf read_only: true + - type: bind + source: ./configs/metacpan-api/metacpan_server.conf + target: /metacpan-api/metacpan_server_testing.conf + read_only: true - type: bind source: ./configs/metacpan-api/metacpan.pl target: /metacpan-api/etc/metacpan.pl From 919219a97bf24ac38bebbdd0d44aaddcae9b2d5f Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Thu, 5 Dec 2019 11:54:56 -0500 Subject: [PATCH 050/141] Do not refresh morbo app when log is updated Fixes #49 We do not need to restart the webapp every time there is a log entry in var/log/metacpan.log otherwise we will end up always restarting in development. --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 7d7b27d..27def18 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development PGDB=db:5432 -API_SERVER=morbo -l http://*:5000 -w . --verbose +API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose From 4f64fc3ab9de9b398069793b596926c807217f6a Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Thu, 5 Dec 2019 12:07:12 -0500 Subject: [PATCH 051/141] Run init as default action for bin/metacpan-docker bin/metacpan-docker when run from the command line should try to run the default 'init' action. --- bin/metacpan-docker | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index d3454ff..b3f08be 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -37,6 +37,10 @@ case "x$1" in 'xlocalapi') shift ;; + 'x') + init + exit + ;; *) ;; esac From 592c17a14cef24330b27612b60781d1516946ead Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Thu, 5 Dec 2019 14:28:41 -0500 Subject: [PATCH 052/141] Basic update and reset methods to keep repo up to date Fixes GH #53 This can clearly be improved but this is a starting point and if you have any local change uncommited when doing a reset it will abort as we are usign 'set -e' which is a good thing --- .gitignore | 1 + bin/metacpan-docker | 57 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f0cd683..27e238f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ nytprof.out *.o *.bs src/ +.DS_Store diff --git a/bin/metacpan-docker b/bin/metacpan-docker index b3f08be..efd46d1 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -1,8 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash # metacpan-docker: simple wrapper for docker-compose running MetaCPAN set -e +GitRepos=("metacpan-api" "metacpan-web") + # sanity check type "docker" > /dev/null type "docker-compose" > /dev/null @@ -23,22 +25,73 @@ git_clone_and_setup_hooks() { init() { echo "Initializing metacpan-docker repositories:" mkdir -p src - for repo in metacpan-api metacpan-web; do + for repo in ${GitRepos[@]}; do git_clone_and_setup_hooks $repo done echo "metacpan-docker ready! Run 'bin/metacpan-docker localapi up' to start." } +git_update_repo() { + local repo=$1 + ( + cd src/$repo + git fetch origin + git pull origin master + ) + echo "Repository $repo updated." +} + +git_reset_repo() { + local repo=$1 + echo "Updating repository $repo" + ( + cd src/$repo + git fetch origin + git checkout master + git pull origin master + ) + echo "Repository $repo updated." +} + +update() { + echo "Updating metacpan-docker repositories from upstream" + + git fetch origin + git pull origin master + + for repo in ${GitRepos[@]}; do + git_update_repo $repo + done +} + +reset_repo() { + echo "Resetting metacpan-docker repositories:" + + for repo in ${GitRepos[@]}; do + git_reset_repo $repo + done +} + + case "x$1" in 'xinit') init exit ;; + 'xreset') + reset_repo + exit + ;; + 'xpull') + update + exit + ;; 'xlocalapi') shift ;; 'x') init + update exit ;; *) From 4ae61fa2174e2be3db5906f487851b8540855e30 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Fri, 6 Dec 2019 10:31:44 -0500 Subject: [PATCH 053/141] Add grep.metacpan development environment This is adding metacpan/metacpan-grep-front-end to docker-compose using a local volume for git. The volume 'metacpan_git_shared' could also be used by other docker containers. In development we are going to use a smaller & frozen version. --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ bin/metacpan-docker | 11 ++++++++++- docker-compose.yml | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed7c709..c1d634f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ * [`web`](#web) * [`api`](#api) * [`github-meets-cpan`](#github-meets-cpan) + * [`grep`](#grep) * [`ElasticSearch`](#elasticsearch) * [System architecture](#system-architecture) * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) @@ -23,6 +24,7 @@ * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) * [Putting the above all together](#putting-the-above-all-together) * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) + * [`grep`](#grep-1) * [Tips and tricks](#tips-and-tricks) * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) * [Running tests](#running-tests) @@ -71,6 +73,8 @@ The `bin/metacpan-docker init` command clones the source repositories for: - `metacpan-web` - `metacpan-api` +- `metacpan-grep-front-end` +- `metacpan-cpan-extracted-lite` These repositories are automatically mounted in to the appropriate docker containers allowing the developer to use their preferred tools to work with the @@ -169,6 +173,14 @@ The local instance of the web front end is accessiable via The PostgreSQL and MongoDB services by default are only accessible from other containers. +#### `grep` + +The grep metacpan front end is accessible via +[http://localhost:3001](http://localhost:3001). + +Note: this is using smaller & frozen version of `metacpan-cpan-extracted` using +[metacpan-cpan-extracted-lite](https://github.com/metacpan/metacpan-cpan-extracted-lite). + ## System architecture The system consists of several services that live in docker containers: @@ -180,6 +192,7 @@ The system consists of several services that live in docker containers: - `pgdb` - PostgreSQL database container - `logspout` - Docker log interface to honeycomb.io - `github-meets-cpan` - Containerized version of `gh.metacpan.org` +- `grep` - the web interface for grep.metacpan on http://localhost:3001 These services use one or more Docker volumes: @@ -190,6 +203,10 @@ These services use one or more Docker volumes: installed by [Carton][4] for the `api` and `web` services, respectively; mounted on `/carton` instead of `local`, to prevent clashing with the host user's Carton +- `metacpan_git_shared`: points to the git repo containing all extracted CPAN + versions. This is mounted in `/shared/metacpan_git`. + This can be either `metacpan-cpan-extracted` or `metacpan-cpan-extracted-lite`. + The volume is bind to the local repo at `${METACPAN_ROOT}/src/metacpan-cpan-extracted`. [4]: https://metacpan.org/pod/Carton @@ -223,6 +240,18 @@ to run both the `metacpan-web` and `metacpan-api` services, along with `docker-compose` to use additional YAML configuration files aside from the default `docker-compose.yml`. +#### `bin/metacpan-docker pull` + +This is used to update all the git repository in `src/*`. +This will stay on your current local branch. + +#### `bin/metacpan-docker reset` + +This is used to reset all the git repository in `src/*` to their +last version on `upstream/master`. +This will fail if you have some uncommited local changes. +You should then commit or cancel your changes before re-running the command. + #### `bin/metacpan-docker` build/up/down/start/stop/run/ps/top... As noted earlier, `bin/metacpan-docker` is a thin wrapper to `docker-compose`, @@ -252,6 +281,16 @@ If using this service to run a local backend, you will need to run some additional commands in a separate terminal once `bin/metacpan-docker localapi up` runs: +#### `grep` + +The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker image. +Note that this is using `metacpan_git_shared` volume which required the `METACPAN_ROOT` +environment variable to be set. + +By running `./bin/metacpan-docker init` you will be able to see the recommended value +for METACPAN_ROOT or you can simply set it to your `metacpan-docker` current location +by running `export METACPAN_ROOT=$(pwd)` from the 'metacpan-docker' root directory. + ##### Setting up a partial CPAN in the `api` service Running @@ -343,6 +382,10 @@ the corresponding `cpanfile.snapshot` safely, even if you do _or_ don't have a `/carton` instead, to prevent interfering with the host user's own `local` Carton directory.) +### Updating the git repositories + +You can use `bin/metacpan-docker pull` to update all `src/*` directories. + [11]: https://github.com/Perl/docker-perl ### Running Kibana to peek into ElasticSearch data diff --git a/bin/metacpan-docker b/bin/metacpan-docker index efd46d1..21536c9 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -3,12 +3,18 @@ set -e -GitRepos=("metacpan-api" "metacpan-web") +GitRepos=("metacpan-api" "metacpan-web" "metacpan-grep-front-end" "metacpan-cpan-extracted-lite") # sanity check type "docker" > /dev/null type "docker-compose" > /dev/null +if [[ "x${METACPAN_ROOT}" -eq "x" ]]; then + export METACPAN_ROOT=$(pwd) + echo "Consider adding the following export to your .bashrc file:" + echo "export METACPAN_ROOT=${METACPAN_ROOT}" +fi + git_clone_and_setup_hooks() { local repo=$1 ( @@ -28,6 +34,9 @@ init() { for repo in ${GitRepos[@]}; do git_clone_and_setup_hooks $repo done + + [ -e src/metacpan-cpan-extracted ] || ln -s metacpan-cpan-extracted-lite src/metacpan-cpan-extracted + echo "metacpan-docker ready! Run 'bin/metacpan-docker localapi up' to start." } diff --git a/docker-compose.yml b/docker-compose.yml index 2aeb689..547d5a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -160,6 +160,34 @@ services: networks: - mongo +# __ _ _ __ ___ _ __ +# / _` | '__/ _ \ '_ \ +# | (_| | | | __/ |_) | +# \__, |_| \___| .__/ +# __/ | | | +# |___/ |_| + + grep: + image: metacpan/metacpan-grep-front-end:latest + build: + context: ./src/metacpan-grep-front-end + volumes: + - type: volume + source: grep_carton + target: /carton + - type: volume + source: metacpan_git_shared + target: /shared/metacpan_git + read_only: true + - type: bind + source: ./src/metacpan-grep-front-end + target: /metacpan-grep-front-end + read_only: true + ports: + - "127.0.0.1:${GREP_SITE_PORT:-3001}:3000" + networks: + - grep + # ____ _ _____ _ ____ _ ____ _____ ____ # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| # | | | |/ _ \ | | / _ \ | _ \ / _ \ \___ \| _| \___ \ @@ -292,6 +320,7 @@ networks: database: web: mongo: + grep: # __ _____ _ _ _ __ __ _____ ____ # \ \ / / _ \| | | | | | \/ | ____/ ___| @@ -303,7 +332,14 @@ networks: volumes: web_carton: api_carton: + grep_carton: cpan: elasticsearch: elasticsearch_test: pgdb-data: + metacpan_git_shared: + driver_opts: + type: none + device: ${METACPAN_ROOT}/src/metacpan-cpan-extracted + o: bind + From 9009d205ff803d95960412cbbed7ff98b1579835 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Fri, 6 Dec 2019 12:11:12 -0500 Subject: [PATCH 054/141] Add grep.env with development setting --- docker-compose.yml | 6 ++---- grep.env | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 grep.env diff --git a/docker-compose.yml b/docker-compose.yml index 547d5a1..f7a0267 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -172,9 +172,6 @@ services: build: context: ./src/metacpan-grep-front-end volumes: - - type: volume - source: grep_carton - target: /carton - type: volume source: metacpan_git_shared target: /shared/metacpan_git @@ -183,6 +180,8 @@ services: source: ./src/metacpan-grep-front-end target: /metacpan-grep-front-end read_only: true + env_file: + - grep.env ports: - "127.0.0.1:${GREP_SITE_PORT:-3001}:3000" networks: @@ -332,7 +331,6 @@ networks: volumes: web_carton: api_carton: - grep_carton: cpan: elasticsearch: elasticsearch_test: diff --git a/grep.env b/grep.env new file mode 100644 index 0000000..6b03c65 --- /dev/null +++ b/grep.env @@ -0,0 +1,4 @@ +# grep service - development environment + +GREP_SITE_PORT=3001 +GREP_PLACKUP_SERVER_ARGS=-E development -R lib,bin \ No newline at end of file From 945a479eafbaefed38d908d699c20cfd311b551b Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Fri, 6 Dec 2019 14:34:19 -0500 Subject: [PATCH 055/141] Fixup docker image creation --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9cdf634..7d7a455 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ notifications: irc: "irc.perl.org#metacpan-travis" env: - - DOCKER_COMPOSE_VERSION=1.24.0 + global: + - DOCKER_COMPOSE_VERSION=1.24.0 + - METACPAN_ROOT=$HOME # Install an up to date (ish) docker-compose before_install: @@ -15,6 +17,7 @@ before_install: - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin + - mkdir -p ${METACPAN_ROOT}/src/metacpan-cpan-extracted ## FIXME: this is just until local repo's build their own images before_script: From de6435baa42a15916ed556b7c60f31e202827228 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Sat, 7 Dec 2019 09:59:08 -0500 Subject: [PATCH 056/141] Use PWD instead of METACPAN_ROOT PWD is already set and we can use it to avoid pain in personal configurations. --- README.md | 10 ++++------ bin/metacpan-docker | 6 ------ docker-compose.yml | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c1d634f..1ec0777 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ These services use one or more Docker volumes: - `metacpan_git_shared`: points to the git repo containing all extracted CPAN versions. This is mounted in `/shared/metacpan_git`. This can be either `metacpan-cpan-extracted` or `metacpan-cpan-extracted-lite`. - The volume is bind to the local repo at `${METACPAN_ROOT}/src/metacpan-cpan-extracted`. + The volume is bind to the local repo at `${PWD}/src/metacpan-cpan-extracted`. [4]: https://metacpan.org/pod/Carton @@ -284,12 +284,10 @@ additional commands in a separate terminal once #### `grep` The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker image. -Note that this is using `metacpan_git_shared` volume which required the `METACPAN_ROOT` -environment variable to be set. +Note that this is using `metacpan_git_shared` volume which requires the git repo for +`metacpan-cpan-extracted` which can be initialized by running: -By running `./bin/metacpan-docker init` you will be able to see the recommended value -for METACPAN_ROOT or you can simply set it to your `metacpan-docker` current location -by running `export METACPAN_ROOT=$(pwd)` from the 'metacpan-docker' root directory. + ./bin/metacpan-docker init ##### Setting up a partial CPAN in the `api` service diff --git a/bin/metacpan-docker b/bin/metacpan-docker index 21536c9..25351fb 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -9,12 +9,6 @@ GitRepos=("metacpan-api" "metacpan-web" "metacpan-grep-front-end" "metacpan-cpan type "docker" > /dev/null type "docker-compose" > /dev/null -if [[ "x${METACPAN_ROOT}" -eq "x" ]]; then - export METACPAN_ROOT=$(pwd) - echo "Consider adding the following export to your .bashrc file:" - echo "export METACPAN_ROOT=${METACPAN_ROOT}" -fi - git_clone_and_setup_hooks() { local repo=$1 ( diff --git a/docker-compose.yml b/docker-compose.yml index f7a0267..e7231a2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -338,6 +338,6 @@ volumes: metacpan_git_shared: driver_opts: type: none - device: ${METACPAN_ROOT}/src/metacpan-cpan-extracted + device: ${PWD}/src/metacpan-cpan-extracted o: bind From 769e18506c471baba7e1191b9904ab1fb3b7ec77 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 7 Dec 2019 10:56:33 -0500 Subject: [PATCH 057/141] Fix mapping of testing config file --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e7231a2..acac22e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -87,7 +87,7 @@ services: target: /metacpan-api/metacpan_server.conf read_only: true - type: bind - source: ./configs/metacpan-api/metacpan_server.conf + source: ./configs/metacpan-api/metacpan_server_testing.conf target: /metacpan-api/metacpan_server_testing.conf read_only: true - type: bind From 9ac04b23300c1ea15b0ef2fa7ef0719121b1ae71 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 7 Dec 2019 11:28:25 -0500 Subject: [PATCH 058/141] Add missing config file for api --- .../metacpan-api/metacpan_server_testing.conf | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 configs/metacpan-api/metacpan_server_testing.conf diff --git a/configs/metacpan-api/metacpan_server_testing.conf b/configs/metacpan-api/metacpan_server_testing.conf new file mode 100644 index 0000000..1600860 --- /dev/null +++ b/configs/metacpan-api/metacpan_server_testing.conf @@ -0,0 +1,31 @@ +cpan var/t/tmp/fakecpan +source_base var/t/tmp/source + + + servers __ENV(ES)__ + + + + servers __ENV(ES)__ + + + + servers __ENV(ES)__ + + + + captcha_class Captcha::Mock + private_key testing + + +github_key = foo +github_secret = bar + +secret weak + + + host smtp.fastmail.com + port 465 + username foo@metacpan.org + password seekrit + From bc597cc9bd22ce80b5fd51fb1d443a1c3e942b70 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 7 Dec 2019 12:26:22 -0500 Subject: [PATCH 059/141] Update README.md --- README.md | 74 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 1ec0777..70f7333 100644 --- a/README.md +++ b/README.md @@ -83,21 +83,21 @@ source code. The `docker-compose up` command on its own will bring up the entire stack in the foreground (logs will be displayed). -The `docker-compose up` command will fetch the official container images from +The `docker-compose up` command will also fetch the official container images from [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) repositories. This will build the Docker containers for MetaCPAN, PostgreSQL and ElasticSearch services (which will take a while, especially on a fresh first time install of -Docker,) and run the services. +Docker) and run the services. Don't forget to seed the local `metacpan-api` with a partial CPAN; run the -following command in a separate terminal to get you up to speed: +following command in a separate terminal to get yourself up to speed: docker-compose exec api index-cpan.sh This will prompt you to confirm removing old indices and setting up mappings on -the ElasticSearch service (say `YES`) then proceed to rsync a partial CPAN in +the ElasticSearch service (say `YES`). It will then proceed to rsync a partial CPAN in `/CPAN` for its metadata to be imported. Once the above is done, you should be able to see your local partial CPAN data @@ -151,7 +151,7 @@ via: ### Accessing Services Each container is responsible for a different service. Some of these services -are available in the developer enviornment via ports on the host system. +are available in the developer environment via ports on the host system. #### `web` @@ -178,21 +178,21 @@ containers. The grep metacpan front end is accessible via [http://localhost:3001](http://localhost:3001). -Note: this is using smaller & frozen version of `metacpan-cpan-extracted` using +Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via [metacpan-cpan-extracted-lite](https://github.com/metacpan/metacpan-cpan-extracted-lite). ## System architecture The system consists of several services that live in docker containers: -- `web` — the web interface on http://localhost:5001 -- `api` — the main server on http://localhost:5000 -- `elasticsearch` — database on http://localhost:9200 -- `elasticsearch_test` — test database on http://localhost:9300 +- `web` — the web interface on [http://localhost:5001](http://localhost:5001) +- `api` — the main server on [http://localhost:5000](http://localhost:5000) +- `elasticsearch` — database on [http://localhost:9200](http://localhost:9200) +- `elasticsearch_test` — test database on [http://localhost:9300](http://localhost:9300) - `pgdb` - PostgreSQL database container -- `logspout` - Docker log interface to honeycomb.io -- `github-meets-cpan` - Containerized version of `gh.metacpan.org` -- `grep` - the web interface for grep.metacpan on http://localhost:3001 +- `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) +- `github-meets-cpan` - Containerized version of [gh.metacpan.org](https://gh.metacpan.org) +- `grep` - the web interface for grep.metacpan on [http://localhost:3001](http://localhost:3001) These services use one or more Docker volumes: @@ -206,7 +206,7 @@ These services use one or more Docker volumes: - `metacpan_git_shared`: points to the git repo containing all extracted CPAN versions. This is mounted in `/shared/metacpan_git`. This can be either `metacpan-cpan-extracted` or `metacpan-cpan-extracted-lite`. - The volume is bind to the local repo at `${PWD}/src/metacpan-cpan-extracted`. + The volume is bound to the local repo at `${PWD}/src/metacpan-cpan-extracted`. [4]: https://metacpan.org/pod/Carton @@ -217,7 +217,7 @@ usage (and to get you started hacking on the MetaCPAN sooner!) ### The `bin/metacpan-docker` script -`bin/metacpan-docker` is a thin wrapper for the `docker-compose` command, +`bin/metacpan-docker` is a thin wrapper around the `docker-compose` command, providing the environment variables necessary to run a basic MetaCPAN environment. It provides these subcommands: @@ -228,6 +228,8 @@ The `init` subcommand basically clones the [metacpan-api][5] and them, in preparation for future `docker-compose` or `bin/metacpan-docker localapi` commands. +It also clones the `metacpan-grep-front-end` and `metacpan-cpan-extracted-lite` repositories. + [5]: https://github.com/metacpan/metacpan-api [6]: https://github.com/metacpan/metacpan-web @@ -247,14 +249,14 @@ This will stay on your current local branch. #### `bin/metacpan-docker reset` -This is used to reset all the git repository in `src/*` to their -last version on `upstream/master`. +This is used to reset all the git repositories in `src/*` to their +latest version on `upstream/master`. This will fail if you have some uncommited local changes. You should then commit or cancel your changes before re-running the command. #### `bin/metacpan-docker` build/up/down/start/stop/run/ps/top... -As noted earlier, `bin/metacpan-docker` is a thin wrapper to `docker-compose`, +As noted earlier, `bin/metacpan-docker` is a thin wrapper around `docker-compose`, so commands like `up`, `down`, and `run` will work as expected from `docker-compose`. See the [docker-compose docs][7] for an overview of available commands. @@ -269,7 +271,7 @@ commands. The `web` service is a checkout of `metacpan-web`, built as a Docker image. Running this service alone is enough if you want to just hack on the frontend, since by default the service is configured to talk to -https://fastapi.metacpan.org for its backend; if this is what you want, then you +[https://fastapi.metacpan.org](https://fastapi.metacpan.org) for its backend; if this is what you want, then you can simply invoke `docker-compose up`. #### `api` @@ -279,12 +281,12 @@ like the `web` service. If using this service to run a local backend, you will need to run some additional commands in a separate terminal once -`bin/metacpan-docker localapi up` runs: +`bin/metacpan-docker localapi up` runs. #### `grep` The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker image. -Note that this is using `metacpan_git_shared` volume which requires the git repo for +Note that this is using the `metacpan_git_shared` volume, which requires the git repo for `metacpan-cpan-extracted` which can be initialized by running: ./bin/metacpan-docker init @@ -295,9 +297,9 @@ Running bin/metacpan-docker localapi exec api partial-cpan-mirror.sh -will `rsync` modules selected CPAN authors, plus the package and author indices, +will `rsync` modules from selected CPAN authors, plus the package and author indices, into the `api` service's `/CPAN` directory. This is nearly equivalent to the -same script in the [metacpan-developer][8] repository. +same script in the (now deprecated) [metacpan-developer][8] repository. [8]: https://github.com/metacpan/metacpan-developer ##### Bootstrapping the `elasticsearch` indices @@ -314,7 +316,7 @@ and import the `/CPAN` data into `elasticsearch`. ##### Putting the above all together -If you're impatient or lazy to do all the above, just running +If you're impatient or too lazy to do all the above, just running bin/metacpan-docker localapi exec api index-cpan.sh @@ -322,9 +324,9 @@ instead will set it all up for you. #### elasticsearch and elasticsearch_test -The `elasticsearch` and `elasticsearch_test` services uses the official -[ElasticSearch Docker image][9], configured with settings and scripts taken from -the [metacpan-puppet][10] repository. It is depended on by the `api` service. +The `elasticsearch` and `elasticsearch_test` services use the official +[Elasticsearch Docker image][9], configured with settings and scripts taken from +the [metacpan-puppet][10] repository. It is depended upon by the `api` service. [9]: https://store.docker.com/images/elasticsearch [10]: https://github.com/metacpan/metacpan-puppet @@ -334,7 +336,7 @@ the [metacpan-puppet][10] repository. It is depended on by the `api` service. ### Running your own miniCPAN inside metacpan-docker Suppose you have a local minicpan in `/home/ftp/pub/CPAN`. If you would like to -use this in metacpan-docker, then edit the `docker-compose.localapi.yml` to +use this in `metacpan-docker`, then edit the `docker-compose.localapi.yml` to change the `api` service's volume mounts to use your local minicpan as `/CPAN`, e.g.: @@ -346,7 +348,7 @@ services: ... ``` -Note that if you want CPAN author data indexed into ElasticSearch, your minicpan +Note that if you want CPAN author data indexed into Elasticsearch, your minicpan should include `authors/00whois.xml`. Full indexing would take a better part of a day or two, depending on your hardware. @@ -357,10 +359,10 @@ Use `bin/metacpan-docker run` and similar: # Run tests for metacpan-web against fastapi.metacpan.org bin/metacpan-docker exec web bin/prove - # Run tests for metacpan-web against local api + # Run tests for metacpan-web against a local api bin/metacpan-docker localapi exec web bin/prove - # Run tests for metacpan-api against local elasticsearch_test + # Run tests for metacpan-api against a local elasticsearch_test bin/metacpan-docker localapi exec api bin/prove ### Updating Carton dependencies @@ -386,17 +388,17 @@ You can use `bin/metacpan-docker pull` to update all `src/*` directories. [11]: https://github.com/Perl/docker-perl -### Running Kibana to peek into ElasticSearch data +### Running Kibana to peek into Elasticsearch data By default, the `docker-compose.localapi.yml` configures the `elasticsearch` -service to listen on the Docker host at http://localhost:9200, and is also -accessible via the Docker `default` network address of http://172.17.0.1:9200; +service to listen on the Docker host at [http://localhost:9200](http://localhost:9200), and is also +accessible via the Docker `default` network address of [http://172.17.0.1:9200](http://172.17.0.1:9200); you can inspect it via simple `curl` or `wget` requests, or use a [Kibana][12] container, e.g. docker run --rm -p 5601:5601 -e ELASTICSEARCH_URL=http://172.17.0.1:9200 -it kibana:4.6 -Running the above will provide a Kibana container at http://localhost:5601, +Running the above will provide a Kibana container at [http://localhost:5601](http://localhost:5601), which you can configure to have it read the `cpan*` index in the `elasticsearch` service. @@ -426,7 +428,7 @@ to the API container: ## To Do -- Integrate other MetaCPAN services (e.g. github-meets-cpan) +- Integrate all other MetaCPAN services - Add more Tips and tricks (as we continue hacking MetaCPAN in Docker) - Provide a "near-production" Docker Compose configuration, suitable for Docker Swarm, and/or From 3e651f0ff944f586d2e0abd1dcb099cdd8599181 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 7 Dec 2019 14:06:28 -0500 Subject: [PATCH 060/141] Document how to install test deps on api --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 70f7333..885e4d5 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,22 @@ For further details, read on! ## Working with Containers +### Building Containers + +You can (re)build arbitrary containers. For instance, if you want to rebuild +the `api` container: + +``` +docker-compose build api +``` + +If you want to be able to run tests against the `api` container, you'll need to +install the test dependencies: + +``` +docker-compose build --build-arg CPM_ARGS='--with-test' api +``` + ### Accessing Containers Containers are accessible via the `docker-compose exec` command followed by the From 426083c3c27014058b670367d2961a864276f9c2 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Sat, 7 Dec 2019 15:53:48 -0500 Subject: [PATCH 061/141] Add traefik for common services We can now use domain to access to each individual services: - http://api.metacpan.localhost - http://web.metacpan.localhost - http://gh.metacpan.localhost - http://grep.metacpan.localhost The dashboard is accessible there: http://localhost:8080 --- README.md | 20 +++++++++-- docker-compose.yml | 83 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 70f7333..e09db53 100644 --- a/README.md +++ b/README.md @@ -153,18 +153,34 @@ via: Each container is responsible for a different service. Some of these services are available in the developer environment via ports on the host system. +We are using [traefik][13] to manage the trafic between services. +The current configurations is the following: + +- api: [http://api.metacpan.localhost](http://api.metacpan.localhost) +- web: [http://web.metacpan.localhost](http://web.metacpan.localhost) +- github-meets-cpan: [http://gh.metacpan.localhost](http://gh.metacpan.localhost) +- grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) + +You can access the dashboard configuration via: +[http://metacpan.localhost:8080](http://metacpan.localhost:8080) + +[0]: https://docs.traefik.io/providers/docker/ + #### `web` The local instance of the web front end is accessiable via -[http://localhost:5001](http://localhost:5001). +[http://localhost:5001](http://localhost:5001) +[http://web.metacpan.localhost](http://web.metacpan.localhost) #### `api` +[http://api.metacpan.localhost](http://api.metacpan.localhost) [http://localhost:5000](http://localhost:5000) #### `github-meets-cpan` [http://localhost:3000](http://localhost:3000) +[http://gh.metacpan.localhost](http://gh.metacpan.localhost) #### `ElasticSearch` @@ -176,7 +192,7 @@ containers. #### `grep` The grep metacpan front end is accessible via -[http://localhost:3001](http://localhost:3001). +[http://grep.metacpan.localhost](http://grep.metacpan.localhost) Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via [metacpan-cpan-extracted-lite](https://github.com/metacpan/metacpan-cpan-extracted-lite). diff --git a/docker-compose.yml b/docker-compose.yml index acac22e..fb18277 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,29 @@ version: "3.4" services: +# __ _____ __ +# / /__________ ____ / __(_) /__ +# / __/ ___/ __ `/ _ \/ /_/ / //_/ __ +# / /_/ / / /_/ / __/ __/ / ,< _| =\__ +# \__/_/ \__,_/\___/_/ /_/_/|_| /o____o_\ + + + traefik: + # The official v2.0 Traefik docker image + image: traefik:v2.0 + networks: + - traefik-network + # Enables the web UI and tells Traefik to listen to docker + command: --api.insecure=true --providers.docker + ports: + # The HTTP port + - "80:80" + # The Web UI (enabled by --api.insecure=true) + - "8080:8080" + volumes: + # So that Traefik can listen to the Docker events + - /var/run/docker.sock:/var/run/docker.sock + # _ _ # | | ___ __ _ ___ _ __ ___ _ _| |_ # | |/ _ \ / _` / __| '_ \ / _ \| | | | __| @@ -27,6 +50,8 @@ services: - logging.env ports: - "8100:80" + labels: + - "traefik.enable=false" # _ # __ _____| |__ @@ -36,6 +61,8 @@ services: # web: + depends_on: + - traefik image: metacpan/metacpan-web:latest build: context: ./src/metacpan-web @@ -54,7 +81,13 @@ services: ports: - "5001:5001" networks: - - web + - web-network + - traefik-network + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik-network" + - traefik.http.routers.web.rule=Host(`web.metacpan.localhost`) + - traefik.http.services.web.loadbalancer.server.port=5001 # _ # __ _ _ __ (_) @@ -69,6 +102,7 @@ services: - elasticsearch - elasticsearch_test - pgdb + - traefik image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -105,9 +139,15 @@ services: ports: - "5000:5000" networks: - - elasticsearch - - web - database + - elasticsearch + - traefik-network + - web-network + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik-network" + - traefik.http.routers.api.rule=Host(`api.metacpan.localhost`) + - traefik.http.services.api.loadbalancer.server.port=5000 # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ @@ -128,10 +168,15 @@ services: depends_on: - mongodb - logspout + - traefik networks: - mongo - ports: - - "127.0.0.1:${GH_CPAN_SITE_PORT:-3000}:3000" + - traefik-network + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik-network" + - traefik.http.routers.github-meets-cpan.rule=Host(`gh.metacpan.localhost`) + - traefik.http.services.gh-meet-cpan-web.loadbalancer.server.port=3000 # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ @@ -159,6 +204,8 @@ services: read_only: true networks: - mongo + labels: + - "traefik.enable=false" # __ _ _ __ ___ _ __ # / _` | '__/ _ \ '_ \ @@ -168,6 +215,8 @@ services: # |___/ |_| grep: + depends_on: + - traefik image: metacpan/metacpan-grep-front-end:latest build: context: ./src/metacpan-grep-front-end @@ -182,10 +231,11 @@ services: read_only: true env_file: - grep.env - ports: - - "127.0.0.1:${GREP_SITE_PORT:-3001}:3000" networks: - - grep + - traefik-network + labels: + - traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`) + - traefik.http.services.grep-web.loadbalancer.server.port=3000 # ____ _ _____ _ ____ _ ____ _____ ____ # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| @@ -219,6 +269,8 @@ services: - "9200:9200" networks: - elasticsearch + labels: + - "traefik.enable=false" # _ _ _ _ # ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ @@ -251,7 +303,8 @@ services: - "9900:9200" networks: - elasticsearch - + labels: + - "traefik.enable=false" # _ _ # _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | # | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | @@ -287,7 +340,8 @@ services: source: ./pg/healthcheck.sh target: /healthcheck.sh read_only: true - + labels: + - "traefik.enable=false" # _ _ # _ __ ___ ___ _ __ __ _ ___ __| | |__ # | '_ ` _ \ / _ \| '_ \ / _` |/ _ \ / _` | '_ \ @@ -306,7 +360,8 @@ services: retries: 0 start_period: 40s test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet - + labels: + - "traefik.enable=false" # _ _ _____ _______ _____ ____ _ ______ # | \ | | ____|_ _\ \ / / _ \| _ \| |/ / ___| # | \| | _| | | \ \ /\ / / | | | |_) | ' /\___ \ @@ -315,11 +370,11 @@ services: # networks: - elasticsearch: database: - web: + elasticsearch: mongo: - grep: + traefik-network: + web-network: # __ _____ _ _ _ __ __ _____ ____ # \ \ / / _ \| | | | | | \/ | ____/ ___| From ff08b6e4f05f6161f6ee824b60bf61a05503ca96 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Sun, 8 Dec 2019 10:13:51 -0500 Subject: [PATCH 062/141] Add dns setup to use localhost subdomains --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index e09db53..4f77600 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,18 @@ The current configurations is the following: - github-meets-cpan: [http://gh.metacpan.localhost](http://gh.metacpan.localhost) - grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) +In order to access to the localhost subdomains, you probably have to manually +enter these entries in you `/etc/hosts` file. + +``` +# add to /etc/hosts +127.0.0.1 api.metacpan.localhost +127.0.0.1 gh.metacpan.localhost +127.0.0.1 grep.metacpan.localhost +127.0.0.1 metacpan.localhost +127.0.0.1 web.metacpan.localhost +``` + You can access the dashboard configuration via: [http://metacpan.localhost:8080](http://metacpan.localhost:8080) From 796961a7cee63de76debf0e2d564315ddc1c96eb Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sun, 8 Dec 2019 10:53:23 -0500 Subject: [PATCH 063/141] Automatically create docker volume with script The definition of the metacpan_git_shared docker volume in the docker-compose file is causing issues with deploying the image, as the volume location has changed. By defining the volume to docker first and then just using it in the docker-compose file, this problem is bypassed. --- bin/metacpan-docker | 6 ++++++ docker-compose.yml | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index 25351fb..6df7054 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -31,6 +31,12 @@ init() { [ -e src/metacpan-cpan-extracted ] || ln -s metacpan-cpan-extracted-lite src/metacpan-cpan-extracted + docker volume create \ + --opt type=none \ + --opt device="$PWD/src/metacpan-cpan-extracted" \ + --opt o=bind \ + metacpan_git_shared + echo "metacpan-docker ready! Run 'bin/metacpan-docker localapi up' to start." } diff --git a/docker-compose.yml b/docker-compose.yml index fb18277..186b01f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -391,8 +391,4 @@ volumes: elasticsearch_test: pgdb-data: metacpan_git_shared: - driver_opts: - type: none - device: ${PWD}/src/metacpan-cpan-extracted - o: bind - + external: true From dbb4b83cd563403d733f7fe022447df15e9f1db7 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Sun, 8 Dec 2019 11:33:54 -0500 Subject: [PATCH 064/141] Do not expose docker containers by default Let's explicitely expose docker containers using: traefik.enable=true --- docker-compose.yml | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fb18277..6c0d8e4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,11 @@ services: networks: - traefik-network # Enables the web UI and tells Traefik to listen to docker - command: --api.insecure=true --providers.docker + command: + - "--api.insecure=true" + - "--providers.docker" + # Do not expose containers unless explicitly told so + - "--providers.docker.exposedbydefault=false" ports: # The HTTP port - "80:80" @@ -50,8 +54,6 @@ services: - logging.env ports: - "8100:80" - labels: - - "traefik.enable=false" # _ # __ _____| |__ @@ -86,8 +88,8 @@ services: labels: - "traefik.enable=true" - "traefik.docker.network=traefik-network" - - traefik.http.routers.web.rule=Host(`web.metacpan.localhost`) - - traefik.http.services.web.loadbalancer.server.port=5001 + - "traefik.http.routers.web.rule=Host(`web.metacpan.localhost`)" + - "traefik.http.services.web.loadbalancer.server.port=5001" # _ # __ _ _ __ (_) @@ -146,8 +148,8 @@ services: labels: - "traefik.enable=true" - "traefik.docker.network=traefik-network" - - traefik.http.routers.api.rule=Host(`api.metacpan.localhost`) - - traefik.http.services.api.loadbalancer.server.port=5000 + - "traefik.http.routers.api.rule=Host(`api.metacpan.localhost`)" + - "traefik.http.services.api.loadbalancer.server.port=5000" # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ @@ -175,8 +177,8 @@ services: labels: - "traefik.enable=true" - "traefik.docker.network=traefik-network" - - traefik.http.routers.github-meets-cpan.rule=Host(`gh.metacpan.localhost`) - - traefik.http.services.gh-meet-cpan-web.loadbalancer.server.port=3000 + - "traefik.http.routers.github-meets-cpan.rule=Host(`gh.metacpan.localhost`)" + - "traefik.http.services.gh-meet-cpan-web.loadbalancer.server.port=3000" # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ @@ -204,8 +206,6 @@ services: read_only: true networks: - mongo - labels: - - "traefik.enable=false" # __ _ _ __ ___ _ __ # / _` | '__/ _ \ '_ \ @@ -234,8 +234,9 @@ services: networks: - traefik-network labels: - - traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`) - - traefik.http.services.grep-web.loadbalancer.server.port=3000 + - "traefik.enable=true" + - "traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`)" + - "traefik.http.services.grep-web.loadbalancer.server.port=3000" # ____ _ _____ _ ____ _ ____ _____ ____ # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| @@ -269,8 +270,6 @@ services: - "9200:9200" networks: - elasticsearch - labels: - - "traefik.enable=false" # _ _ _ _ # ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ @@ -303,8 +302,6 @@ services: - "9900:9200" networks: - elasticsearch - labels: - - "traefik.enable=false" # _ _ # _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | # | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | @@ -340,8 +337,7 @@ services: source: ./pg/healthcheck.sh target: /healthcheck.sh read_only: true - labels: - - "traefik.enable=false" + # _ _ # _ __ ___ ___ _ __ __ _ ___ __| | |__ # | '_ ` _ \ / _ \| '_ \ / _` |/ _ \ / _` | '_ \ @@ -360,8 +356,7 @@ services: retries: 0 start_period: 40s test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet - labels: - - "traefik.enable=false" + # _ _ _____ _______ _____ ____ _ ______ # | \ | | ____|_ _\ \ / / _ \| _ \| |/ / ___| # | \| | _| | | \ \ /\ / / | | | |_) | ' /\___ \ From 1dfa6e6256ca2f21725dea90f4107337996eb7dc Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Wed, 18 Mar 2020 15:58:40 -0400 Subject: [PATCH 065/141] Add a GitHub workflow to test build and up --- .github/workflows/up.yml | 24 +++++++++++++++++++ README.md | 52 ++++++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/up.yml diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml new file mode 100644 index 0000000..4d41193 --- /dev/null +++ b/.github/workflows/up.yml @@ -0,0 +1,24 @@ +--- +name: docker-compose up + +on: + push: + schedule: + # Every Sunday morning + - cron: "15 4 * * *" +jobs: + build: + name: init and up + runs-on: ubuntu-latest + strategy: + max-parallel: 1 + steps: + - uses: actions/checkout@v1 + - name: mkdir + run: mkdir -p src/metacpan-cpan-extracted + - name: init + run: bin/metacpan-docker init + - name: up + run: docker-compose up -d + - name: ps + run: docker-compose ps diff --git a/README.md b/README.md index 509ca70..e0a1932 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,41 @@ # MetaCPAN Docker +![.github/workflows/dzil-build-and-test.yml](https://github.com/metacpan/metacpan-docker/workflows/.github/workflows/dzil-build-and-test.yml/badge.svg) + * [Running the MetaCPAN stack with Docker (via Docker Compose)](#running-the-metacpan-stack-with-docker-via-docker-compose) * [Quick Start](#quick-start) * [Working with Containers](#working-with-containers) - * [Accessing Containers](#accessing-containers) - * [Accessing Services](#accessing-services) - * [`web`](#web) - * [`api`](#api) - * [`github-meets-cpan`](#github-meets-cpan) - * [`grep`](#grep) - * [`ElasticSearch`](#elasticsearch) + * [Building Containers](#building-containers) + * [Accessing Containers](#accessing-containers) + * [Accessing Services](#accessing-services) + * [`web`](#web) + * [`api`](#api) + * [`github-meets-cpan`](#github-meets-cpan) + * [`ElasticSearch`](#elasticsearch) + * [`grep`](#grep) * [System architecture](#system-architecture) - * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) - * [`bin/metacpan init`](#binmetacpan-init) - * [`bin/metacpan localapi`](#binmetacpan-localapi) - * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) - * [Services](#services) - * [`web`](#web-1) - * [`api`](#api-1) - * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) - * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) - * [Putting the above all together](#putting-the-above-all-together) - * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) - * [`grep`](#grep-1) + * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) + * [`bin/metacpan init`](#binmetacpan-init) + * [`bin/metacpan localapi`](#binmetacpan-localapi) + * [`bin/metacpan-docker pull`](#binmetacpan-docker-pull) + * [`bin/metacpan-docker reset`](#binmetacpan-docker-reset) + * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) + * [Services](#services) + * [`web`](#web-1) + * [`api`](#api-1) + * [`grep`](#grep-1) + * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) + * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) + * [Putting the above all together](#putting-the-above-all-together) + * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) * [Tips and tricks](#tips-and-tricks) - * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) - * [Running tests](#running-tests) - * [Updating Carton dependencies](#updating-carton-dependencies) - * [Running Kibana to peek into ElasticSearch data](#running-kibana-to-peek-into-elasticsearch-data) + * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) + * [Running tests](#running-tests) + * [Updating Carton dependencies](#updating-carton-dependencies) + * [Updating the git repositories](#updating-the-git-repositories) + * [Running Kibana to peek into Elasticsearch data](#running-kibana-to-peek-into-elasticsearch-data) * [Peeking Inside the Container](#peeking-inside-the-container) * [To Do](#to-do) * [See also](#see-also) From 3fefeeaba13eba2ab2518f2cbe94b335775bec26 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 19 Mar 2020 15:11:58 -0400 Subject: [PATCH 066/141] Fix GH workflow badge on README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0a1932..735c038 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MetaCPAN Docker -![.github/workflows/dzil-build-and-test.yml](https://github.com/metacpan/metacpan-docker/workflows/.github/workflows/dzil-build-and-test.yml/badge.svg) +![docker-compose up](https://github.com/metacpan/metacpan-docker/workflows/docker-compose%20up/badge.svg?branch=master) From ea092bb002cba87078609f372bec30c73b53dee6 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 20 Mar 2020 15:34:26 -0400 Subject: [PATCH 067/141] Fix Docker hostname for Pg --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 27def18..074398d 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development -PGDB=db:5432 +PGDB=pgdb:5432 API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose From c726fc985c9fa51bc268c0d19175fb8eb8e85ee0 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 20 Mar 2020 15:34:56 -0400 Subject: [PATCH 068/141] Make yamllint happy --- docker-compose.yml | 193 ++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 97 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fda4af0..1858be0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,4 @@ +--- version: "3.4" # ____ _____ ______ _____ ____ _____ ____ @@ -8,13 +9,11 @@ version: "3.4" # services: - -# __ _____ __ -# / /__________ ____ / __(_) /__ -# / __/ ___/ __ `/ _ \/ /_/ / //_/ __ -# / /_/ / / /_/ / __/ __/ / ,< _| =\__ -# \__/_/ \__,_/\___/_/ /_/_/|_| /o____o_\ - + # __ _____ __ + # / /__________ ____ / __(_) /__ + # / __/ ___/ __ `/ _ \/ /_/ / //_/ __ + # / /_/ / / /_/ / __/ __/ / ,< _| =\__ + # \__/_/ \__,_/\___/_/ /_/_/|_| /o____o_\ traefik: # The official v2.0 Traefik docker image @@ -36,13 +35,13 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock -# _ _ -# | | ___ __ _ ___ _ __ ___ _ _| |_ -# | |/ _ \ / _` / __| '_ \ / _ \| | | | __| -# | | (_) | (_| \__ \ |_) | (_) | |_| | |_ -# |_|\___/ \__, |___/ .__/ \___/ \__,_|\__| -# |___/ |_| -# + # _ _ + # | | ___ __ _ ___ _ __ ___ _ _| |_ + # | |/ _ \ / _` / __| '_ \ / _ \| | | | __| + # | | (_) | (_| \__ \ |_) | (_) | |_| | |_ + # |_|\___/ \__, |___/ .__/ \___/ \__,_|\__| + # |___/ |_| + # logspout: image: honeycombio/logspout-honeycomb:1.13 @@ -55,12 +54,12 @@ services: ports: - "8100:80" -# _ -# __ _____| |__ -# \ \ /\ / / _ \ '_ \ -# \ V V / __/ |_) | -# \_/\_/ \___|_.__/ -# + # _ + # __ _____| |__ + # \ \ /\ / / _ \ '_ \ + # \ V V / __/ |_) | + # \_/\_/ \___|_.__/ + # web: depends_on: @@ -91,13 +90,13 @@ services: - "traefik.http.routers.web.rule=Host(`web.metacpan.localhost`)" - "traefik.http.services.web.loadbalancer.server.port=5001" -# _ -# __ _ _ __ (_) -# / _` | '_ \| | -# | (_| | |_) | | -# \__,_| .__/|_| -# |_| -# + # _ + # __ _ _ __ (_) + # / _` | '_ \| | + # | (_| | |_) | | + # \__,_| .__/|_| + # |_| + # api: depends_on: @@ -151,19 +150,19 @@ services: - "traefik.http.routers.api.rule=Host(`api.metacpan.localhost`)" - "traefik.http.services.api.loadbalancer.server.port=5000" -# _ _ _ _ _ -# __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ -# / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| -# | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ -# \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ -# |___/ -# -# ___ _ __ __ _ _ __ -# / __| '_ \ / _` | '_ \ -# | (__| |_) | (_| | | | | -# \___| .__/ \__,_|_| |_| -# |_| -# + # _ _ _ _ _ + # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ + # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| + # | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ + # \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ + # |___/ + # + # ___ _ __ __ _ _ __ + # / __| '_ \ / _` | '_ \ + # | (__| |_) | (_| | | | | + # \___| .__/ \__,_|_| |_| + # |_| + # github-meets-cpan: image: metacpan/github-meets-cpan:latest command: "/wait-for-it.sh mongodb:27017 -- morbo script/app.pl" @@ -180,19 +179,19 @@ services: - "traefik.http.routers.github-meets-cpan.rule=Host(`gh.metacpan.localhost`)" - "traefik.http.services.gh-meet-cpan-web.loadbalancer.server.port=3000" -# _ _ _ _ _ -# __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ -# / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| -# | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ -# \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ -# |___/ -# -# ___ _ __ __ _ _ __ ___ _ __ ___ _ __ -# / __| '_ \ / _` | '_ \ / __| '__/ _ \| '_ \ -# | (__| |_) | (_| | | | | | (__| | | (_) | | | | -# \___| .__/ \__,_|_| |_| \___|_| \___/|_| |_| -# |_| -# + # _ _ _ _ _ + # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ + # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| + # | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ + # \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ + # |___/ + # + # ___ _ __ __ _ _ __ ___ _ __ ___ _ __ + # / __| '_ \ / _` | '_ \ / __| '__/ _ \| '_ \ + # | (__| |_) | (_| | | | | | (__| | | (_) | | | | + # \___| .__/ \__,_|_| |_| \___|_| \___/|_| |_| + # |_| + # github-meets-cpan-cron: image: metacpan/github-meets-cpan:latest @@ -207,12 +206,12 @@ services: networks: - mongo -# __ _ _ __ ___ _ __ -# / _` | '__/ _ \ '_ \ -# | (_| | | | __/ |_) | -# \__, |_| \___| .__/ -# __/ | | | -# |___/ |_| + # __ _ _ __ ___ _ __ + # / _` | '__/ _ \ '_ \ + # | (_| | | | __/ |_) | + # \__, |_| \___| .__/ + # __/ | | | + # |___/ |_| grep: depends_on: @@ -238,19 +237,19 @@ services: - "traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`)" - "traefik.http.services.grep-web.loadbalancer.server.port=3000" -# ____ _ _____ _ ____ _ ____ _____ ____ -# | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| -# | | | |/ _ \ | | / _ \ | _ \ / _ \ \___ \| _| \___ \ -# | |_| / ___ \| |/ ___ \| |_) / ___ \ ___) | |___ ___) | -# |____/_/ \_\_/_/ \_\____/_/ \_\____/|_____|____/ -# + # ____ _ _____ _ ____ _ ____ _____ ____ + # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| + # | | | |/ _ \ | | / _ \ | _ \ / _ \ \___ \| _| \___ \ + # | |_| / ___ \| |/ ___ \| |_) / ___ \ ___) | |___ ___) | + # |____/_/ \_\_/_/ \_\____/_/ \_\____/|_____|____/ + # -# _ _ _ _ -# ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ -# / _ \ |/ _` / __| __| |/ __/ __|/ _ \/ _` | '__/ __| '_ \ -# | __/ | (_| \__ \ |_| | (__\__ \ __/ (_| | | | (__| | | | -# \___|_|\__,_|___/\__|_|\___|___/\___|\__,_|_| \___|_| |_| -# + # _ _ _ _ + # ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ + # / _ \ |/ _` / __| __| |/ __/ __|/ _ \/ _` | '__/ __| '_ \ + # | __/ | (_| \__ \ |_| | (__\__ \ __/ (_| | | | (__| | | | + # \___|_|\__,_|___/\__|_|\___|___/\___|\__,_|_| \___|_| |_| + # elasticsearch: image: elasticsearch:2.4 @@ -271,18 +270,18 @@ services: networks: - elasticsearch -# _ _ _ _ -# ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ -# / _ \ |/ _` / __| __| |/ __/ __|/ _ \/ _` | '__/ __| '_ \ -# | __/ | (_| \__ \ |_| | (__\__ \ __/ (_| | | | (__| | | | -# \___|_|\__,_|___/\__|_|\___|___/\___|\__,_|_| \___|_| |_| -# -# _ _ -# | |_ ___ ___| |_ -# | __/ _ \/ __| __| -# | || __/\__ \ |_ -# \__\___||___/\__| -# + # _ _ _ _ + # ___| | __ _ ___| |_(_) ___ ___ ___ __ _ _ __ ___| |__ + # / _ \ |/ _` / __| __| |/ __/ __|/ _ \/ _` | '__/ __| '_ \ + # | __/ | (_| \__ \ |_| | (__\__ \ __/ (_| | | | (__| | | | + # \___|_|\__,_|___/\__|_|\___|___/\___|\__,_|_| \___|_| |_| + # + # _ _ + # | |_ ___ ___| |_ + # | __/ _ \/ __| __| + # | || __/\__ \ |_ + # \__\___||___/\__| + # elasticsearch_test: image: elasticsearch:2.4 @@ -302,13 +301,13 @@ services: - "9900:9200" networks: - elasticsearch -# _ _ -# _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | -# | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | -# | |_) | (_) \__ \ || (_| | | | __/\__ \ (_| | | -# | .__/ \___/|___/\__\__, |_| \___||___/\__, |_| -# |_| |___/ |_| -# + # _ _ + # _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | + # | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | + # | |_) | (_) \__ \ || (_| | | | __/\__ \ (_| | | + # | .__/ \___/|___/\__\__, |_| \___||___/\__, |_| + # |_| |___/ |_| + # pgdb: hostname: pgdb @@ -338,13 +337,13 @@ services: target: /healthcheck.sh read_only: true -# _ _ -# _ __ ___ ___ _ __ __ _ ___ __| | |__ -# | '_ ` _ \ / _ \| '_ \ / _` |/ _ \ / _` | '_ \ -# | | | | | | (_) | | | | (_| | (_) | (_| | |_) | -# |_| |_| |_|\___/|_| |_|\__, |\___/ \__,_|_.__/ -# |___/ -# + # _ _ + # _ __ ___ ___ _ __ __ _ ___ __| | |__ + # | '_ ` _ \ / _ \| '_ \ / _` |/ _ \ / _` | '_ \ + # | | | | | | (_) | | | | (_| | (_) | (_| | |_) | + # |_| |_| |_|\___/|_| |_|\__, |\___/ \__,_|_.__/ + # |___/ + # mongodb: image: mongo:latest From 00582b3bbf4482056462de0f03be9e71f58bd160 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 20 Mar 2020 15:35:20 -0400 Subject: [PATCH 069/141] Wait for Elasticsearch when starting the api --- docker-compose.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1858be0..1fee93a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,7 +109,10 @@ services: context: ./src/metacpan-api env_file: - localapi.env - command: "/wait-for-it.sh ${PGDB} -- ${API_SERVER} ./bin/api.pl" + command: > + /metacpan-api/wait-for-es.sh http://elasticsearch:9200 -- + /metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} -- + ${API_SERVER} ./bin/api.pl volumes: - type: volume source: cpan From 43b0ba7697c197b630fdb9e32be176b325cb4aa3 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 21 Aug 2020 12:39:08 -0400 Subject: [PATCH 070/141] Add an env file just for api_test Set HARNESS_ACTIVE in localapi_test.env --- localapi.env | 1 - localapi_test.env | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 localapi_test.env diff --git a/localapi.env b/localapi.env index 6ef8aa8..1d6483b 100644 --- a/localapi.env +++ b/localapi.env @@ -1,7 +1,6 @@ NET_ASYNC_HTTP_MAXCONNS=1 COLUMNS=80 ES=elasticsearch:9200 -ES_TEST=elasticsearch_test:9200 MINICPAN=/CPAN PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton diff --git a/localapi_test.env b/localapi_test.env new file mode 100644 index 0000000..4ea8bc2 --- /dev/null +++ b/localapi_test.env @@ -0,0 +1,10 @@ +NET_ASYNC_HTTP_MAXCONNS=1 +COLUMNS=80 +ES=elasticsearch_test:9200 +ES_TEST=elasticsearch_test:9200 +HARNESS_ACTIVE=1 +# Instantiate Catalyst models using metacpan_server_testing.conf +METACPAN_SERVER_CONFIG_LOCAL_SUFFIX=testing +MINICPAN=/CPAN +PERL_MM_USE_DEFAULT=1 +PERL_CARTON_PATH=/carton From b57835dba207969d275613ab928b61fbff862adf Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 21 Aug 2020 12:45:12 -0400 Subject: [PATCH 071/141] Add a test configuration for the API to docker-compose This seems to be slightly less confusing than having the API start up two different Elasticsearch containers and (hopefully) only direct traffic to one of them. In the tests, we were apparently sending traffic to both and the results were very hard to debug. With this change we will use the same port number for test and production Elasticsearch hosts, but we will use a different host name for each. --- docker-compose.yml | 50 +++++++++++++++++++++++++++++++++++++++++++--- localapi.env | 2 ++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1fee93a..a0fd5bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -101,7 +101,6 @@ services: api: depends_on: - elasticsearch - - elasticsearch_test - pgdb - traefik image: metacpan/metacpan-api:latest @@ -153,6 +152,50 @@ services: - "traefik.http.routers.api.rule=Host(`api.metacpan.localhost`)" - "traefik.http.services.api.loadbalancer.server.port=5000" + api_test: + depends_on: + - elasticsearch_test + image: metacpan/metacpan-api:latest + build: + context: ./src/metacpan-api + env_file: + - localapi_test.env + command: > + /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 -- + ${API_SERVER} ./bin/api.pl + volumes: + - type: volume + source: cpan + target: /CPAN + - type: bind + source: ./src/metacpan-api + target: /metacpan-api + - type: bind + source: ./configs/metacpan-api/metacpan_server.conf + target: /metacpan-api/metacpan_server.conf + read_only: true + - type: bind + source: ./configs/metacpan-api/metacpan_server_testing.conf + target: /metacpan-api/metacpan_server_testing.conf + read_only: true + - type: bind + source: ./configs/metacpan-api/metacpan.pl + target: /metacpan-api/etc/metacpan.pl + read_only: true + - type: bind + source: ./bin/index-cpan.sh + target: /bin/index-cpan.sh + read_only: true + - type: bind + source: ./bin/partial-cpan-mirror.sh + target: /bin/partial-cpan-mirror.sh + read_only: true + ports: + - "5000:5000" + networks: + - database + - elasticsearch_test + - web-network # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| @@ -301,9 +344,9 @@ services: target: /usr/share/elasticsearch/config/scripts read_only: true ports: - - "9900:9200" + - "9200:9200" networks: - - elasticsearch + - elasticsearch_test # _ _ # _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | # | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | @@ -369,6 +412,7 @@ services: networks: database: elasticsearch: + elasticsearch_test: mongo: traefik-network: web-network: diff --git a/localapi.env b/localapi.env index 1d6483b..f0a4aa4 100644 --- a/localapi.env +++ b/localapi.env @@ -1,6 +1,8 @@ NET_ASYNC_HTTP_MAXCONNS=1 COLUMNS=80 ES=elasticsearch:9200 +ES_TEST=elasticsearch_test:9200 +ES_TEST=elasticsearch_test:9200 MINICPAN=/CPAN PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton From 5ed6e499810ce771d69b26d074a468fa4d492f2b Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Wed, 26 Aug 2020 22:13:36 -0400 Subject: [PATCH 072/141] Remove Travis CI --- .travis.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7d7a455..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python - -services: - - docker - -notifications: - irc: "irc.perl.org#metacpan-travis" - -env: - global: - - DOCKER_COMPOSE_VERSION=1.24.0 - - METACPAN_ROOT=$HOME - -# Install an up to date (ish) docker-compose -before_install: - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - mkdir -p ${METACPAN_ROOT}/src/metacpan-cpan-extracted - -## FIXME: this is just until local repo's build their own images -before_script: - - bin/metacpan-docker init - -# Perform build, make sure to pull image deps and build from the fetched version as cache -script: - - docker-compose up -d - - docker-compose ps - From 0d6d1a86a70334c277aaa7e8c64a8a6fc525d140 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Wed, 26 Aug 2020 22:13:29 -0400 Subject: [PATCH 073/141] Don't try to start everything with docker-compose --- .github/workflows/up.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index 4d41193..cd9892e 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -19,6 +19,8 @@ jobs: - name: init run: bin/metacpan-docker init - name: up - run: docker-compose up -d + run: docker-compose up -d api_test + - name: down + run: docker-compose down - name: ps run: docker-compose ps From 7e8fe87f9c5ea1ba744179a73287cdad28682cff Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Wed, 26 Aug 2020 22:14:40 -0400 Subject: [PATCH 074/141] Test service configurations --- .github/workflows/up.yml | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index cd9892e..bac1f8a 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -14,13 +14,36 @@ jobs: max-parallel: 1 steps: - uses: actions/checkout@v1 - - name: mkdir - run: mkdir -p src/metacpan-cpan-extracted + - name: init run: bin/metacpan-docker init - - name: up + + - name: up api_test run: docker-compose up -d api_test - name: down run: docker-compose down - - name: ps - run: docker-compose ps + + - name: up api + run: docker-compose up -d api + - name: down + run: docker-compose down + + - name: up github-meets-cpan + run: docker-compose up -d github-meets-cpan + - name: down + run: docker-compose down + + - name: up github-meets-cpan-cron + run: docker-compose up -d github-meets-cpan-cron + - name: down + run: docker-compose down + + - name: up web + run: docker-compose up -d web + - name: down + run: docker-compose down + + - name: up grep + run: docker-compose up -d grep + - name: down + run: docker-compose down From a32b10eaeb2f35f1cc4738637316b8476d6a8d74 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sun, 25 Oct 2020 19:40:38 -0400 Subject: [PATCH 075/141] Rework api_test container This container now runs standalone and offers the ability to run tests on the same code as the api server is running, without conflicting with the api server's port, or configuration. --- .github/workflows/up.yml | 8 ++++---- docker-compose.yml | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index bac1f8a..0ff54c7 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -18,13 +18,13 @@ jobs: - name: init run: bin/metacpan-docker init - - name: up api_test - run: docker-compose up -d api_test + - name: up api + run: docker-compose up -d api - name: down run: docker-compose down - - name: up api - run: docker-compose up -d api + - name: up apitest + run: docker-compose up -d apitest - name: down run: docker-compose down diff --git a/docker-compose.yml b/docker-compose.yml index a0fd5bc..d36c621 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -152,9 +152,10 @@ services: - "traefik.http.routers.api.rule=Host(`api.metacpan.localhost`)" - "traefik.http.services.api.loadbalancer.server.port=5000" - api_test: + apitest: depends_on: - elasticsearch_test + - pgdb image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -162,6 +163,7 @@ services: - localapi_test.env command: > /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 -- + /metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -191,11 +193,11 @@ services: target: /bin/partial-cpan-mirror.sh read_only: true ports: - - "5000:5000" + - "5000" networks: - database - - elasticsearch_test - - web-network + - elasticsearch + # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| From 07556958170ab641c672bf9e32b4202b3ce27395 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 22 Oct 2020 20:53:12 -0400 Subject: [PATCH 076/141] Unset localhost port number for ES Without specifying a port number to assign to the container one is dynamically assigned (and available from fig ps), which avoids the conflict of having 2 ES containers. The containers are on the internal elasticsearch network and use that when communicating with the api container. --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d36c621..dd3436c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -314,7 +314,7 @@ services: target: /usr/share/elasticsearch/config/scripts read_only: true ports: - - "9200:9200" + - "9200" networks: - elasticsearch @@ -346,7 +346,7 @@ services: target: /usr/share/elasticsearch/config/scripts read_only: true ports: - - "9200:9200" + - "9200" networks: - elasticsearch_test # _ _ From bd99a838fedade59e892237e09d6f0db870c7275 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Thu, 22 Oct 2020 20:57:07 -0400 Subject: [PATCH 077/141] Fix a bug with PostgreSQL configuration The postgres image now requires that a password be set for the postgres user. Setting this via the environment variable so the container will start. --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index dd3436c..442c13e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -364,6 +364,8 @@ services: context: "./pg" args: PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" + environment: + POSTGRES_PASSWORD: metacpan networks: - database healthcheck: From 1f3ef048f81763c66f410507fb564b88ea6d951a Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sun, 25 Oct 2020 19:37:23 -0400 Subject: [PATCH 078/141] Consolidate elasticsearch networks No need for multiple networks for elasticsearch, reducing to one with both servers on it. --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 442c13e..f9617f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -348,7 +348,7 @@ services: ports: - "9200" networks: - - elasticsearch_test + - elasticsearch # _ _ # _ __ ___ ___| |_ __ _ _ __ ___ ___ __ _| | # | '_ \ / _ \/ __| __/ _` | '__/ _ \/ __|/ _` | | @@ -416,7 +416,6 @@ services: networks: database: elasticsearch: - elasticsearch_test: mongo: traefik-network: web-network: From 1b951dffcf70f84dd28be973d49026345554d934 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 17 Nov 2020 16:11:55 -0500 Subject: [PATCH 079/141] Revert apitest to api_test The metacpan-api CI relies on this naming. --- .github/workflows/up.yml | 4 ++-- docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index 0ff54c7..9d6a13f 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -23,8 +23,8 @@ jobs: - name: down run: docker-compose down - - name: up apitest - run: docker-compose up -d apitest + - name: up api_test + run: docker-compose up -d api_test - name: down run: docker-compose down diff --git a/docker-compose.yml b/docker-compose.yml index f9617f4..fea1455 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -152,7 +152,7 @@ services: - "traefik.http.routers.api.rule=Host(`api.metacpan.localhost`)" - "traefik.http.services.api.loadbalancer.server.port=5000" - apitest: + api_test: depends_on: - elasticsearch_test - pgdb From 43448b1e24c0c644593b2bb7ba17d3fc550051ee Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 1 Dec 2020 17:44:55 -0500 Subject: [PATCH 080/141] Add .circleci/config.yml --- .circleci/config.yml | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..d445471 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,62 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 +# Orchestrate or schedule a set of jobs +workflows: + docker-compose: + jobs: + - build-and-test +jobs: + build-and-test: + machine: true + resource_class: medium + steps: + # CircleCI has its own docker-compose already installed, but as of this writing, their version is too old to understand our docker-compose.yml + - run: + name: Install Docker Compose + command: | + set -x + curl -L https://github.com/docker/compose/releases/download/1.26.2/docker-compose-`uname -s`-`uname -m` > /home/circleci/bin/docker-compose + sudo chmod +x /home/circleci/bin/docker-compose + which docker-compose + docker-compose --version + - run: + command: | + git clone https://github.com/metacpan/metacpan-docker.git + cd metacpan-docker + git checkout ${CIRCLE_BRANCH} + name: metacpan-docker checkout + - run: + command: | + pushd metacpan-docker + ./bin/metacpan-docker init + name: clone missing repositories + - run: + command: | + pushd metacpan-docker + docker-compose build api_test + name: compose build + - run: + command: | + pushd metacpan-docker + docker-compose --verbose up -d api_test + name: compose up + # Since we're running docker-compose -d, we don't actually know if + # Elasticsearch is available at the time this build step begins. We + # probably need to wait for it here, so we'll add our own check. + - run: + command: | + pushd metacpan-docker + ./src/metacpan-api/wait-for-es.sh http://localhost:9200 elasticsearch_test -- + name: wait for ES + - run: + command: | + pushd metacpan-docker + docker-compose exec -T api_test prove -lr --jobs 2 t + - run: + command: | + pushd metacpan-docker + docker-compose logs + docker stats --no-stream + docker ps -a | head + name: docker-compose logs + when: on_fail From e5c28931e2cbec802f7d671bbf740285b48d6509 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 1 Dec 2020 18:20:02 -0500 Subject: [PATCH 081/141] Add CircleCI badge to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 735c038..c3a4ca2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # MetaCPAN Docker +[![CircleCI](https://circleci.com/gh/metacpan/metacpan-docker.svg?style=svg)](https://circleci.com/gh/metacpan/metcpan-docker) + ![docker-compose up](https://github.com/metacpan/metacpan-docker/workflows/docker-compose%20up/badge.svg?branch=master) From 8c98f3cce1a04e771de777d75d97adc0b004e0b6 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 1 Dec 2020 18:22:41 -0500 Subject: [PATCH 082/141] Fix typo in CircleCI badge name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3a4ca2..e0713f4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MetaCPAN Docker -[![CircleCI](https://circleci.com/gh/metacpan/metacpan-docker.svg?style=svg)](https://circleci.com/gh/metacpan/metcpan-docker) +[![CircleCI](https://circleci.com/gh/metacpan/metacpan-docker.svg?style=svg)](https://circleci.com/gh/metacpan/metacpan-docker) ![docker-compose up](https://github.com/metacpan/metacpan-docker/workflows/docker-compose%20up/badge.svg?branch=master) From 72bf81a830764a52fcc428c2fe257111cfab1211 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 1 Dec 2020 18:32:12 -0500 Subject: [PATCH 083/141] Take down api_test after tests have run on CircleCI --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d445471..632ee38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,6 +52,7 @@ jobs: command: | pushd metacpan-docker docker-compose exec -T api_test prove -lr --jobs 2 t + docker-compose down - run: command: | pushd metacpan-docker From aa28488e8534cb14a22e01933a9b2d0b5b3d57fd Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 1 Dec 2020 18:32:30 -0500 Subject: [PATCH 084/141] Add CircleCI tests for github-meets-cpan --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 632ee38..f3e7d7f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,3 +61,13 @@ jobs: docker ps -a | head name: docker-compose logs when: on_fail + - run: + command: | + pushd metacpan-docker + docker-compose --verbose up -d github-meets-cpan + name: github-meets-cpan up + - run: + command: | + pushd metacpan-docker + docker-compose exec -T github-meets-cpan prove -lr --jobs 2 t + docker-compose down From 1018460935c56b3dfe71e424f7fffbef199a4d60 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 3 Dec 2020 11:50:55 -0500 Subject: [PATCH 085/141] Use CircleCI default checkout step --- .circleci/config.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3e7d7f..2c38054 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,25 +19,17 @@ jobs: sudo chmod +x /home/circleci/bin/docker-compose which docker-compose docker-compose --version + - checkout - run: command: | - git clone https://github.com/metacpan/metacpan-docker.git - cd metacpan-docker - git checkout ${CIRCLE_BRANCH} - name: metacpan-docker checkout - - run: - command: | - pushd metacpan-docker ./bin/metacpan-docker init name: clone missing repositories - run: command: | - pushd metacpan-docker docker-compose build api_test name: compose build - run: command: | - pushd metacpan-docker docker-compose --verbose up -d api_test name: compose up # Since we're running docker-compose -d, we don't actually know if @@ -45,17 +37,14 @@ jobs: # probably need to wait for it here, so we'll add our own check. - run: command: | - pushd metacpan-docker ./src/metacpan-api/wait-for-es.sh http://localhost:9200 elasticsearch_test -- name: wait for ES - run: command: | - pushd metacpan-docker docker-compose exec -T api_test prove -lr --jobs 2 t docker-compose down - run: command: | - pushd metacpan-docker docker-compose logs docker stats --no-stream docker ps -a | head @@ -63,11 +52,9 @@ jobs: when: on_fail - run: command: | - pushd metacpan-docker docker-compose --verbose up -d github-meets-cpan name: github-meets-cpan up - run: command: | - pushd metacpan-docker docker-compose exec -T github-meets-cpan prove -lr --jobs 2 t docker-compose down From 7182a6368e670fe944f3837081e68d583fce525b Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 3 Dec 2020 11:51:26 -0500 Subject: [PATCH 086/141] Add missing arg to wait-for-es.sh in docker-compose.yml --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fea1455..73aa586 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,7 +109,7 @@ services: env_file: - localapi.env command: > - /metacpan-api/wait-for-es.sh http://elasticsearch:9200 -- + /metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" -- /metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} -- ${API_SERVER} ./bin/api.pl volumes: @@ -162,7 +162,7 @@ services: env_file: - localapi_test.env command: > - /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 -- + /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" -- /metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} -- ${API_SERVER} ./bin/api.pl volumes: From 00432af4c1431577909df132a12ef11ae8b03e18 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 3 Dec 2020 13:01:57 -0500 Subject: [PATCH 087/141] Don't build an image for api_test in CI --- .circleci/config.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c38054..a7ca498 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,10 +24,6 @@ jobs: command: | ./bin/metacpan-docker init name: clone missing repositories - - run: - command: | - docker-compose build api_test - name: compose build - run: command: | docker-compose --verbose up -d api_test From 7f7729dc864c14f22a38bd6c9a342a70dd188fd9 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 3 Dec 2020 21:11:12 -0500 Subject: [PATCH 088/141] Bring README.md closer to current reality --- README.md | 83 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index e0713f4..4d102ee 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ * [`web`](#web) * [`api`](#api) * [`github-meets-cpan`](#github-meets-cpan) - * [`ElasticSearch`](#elasticsearch) + * [`Elasticsearch`](#elasticsearch) * [`grep`](#grep) * [System architecture](#system-architecture) * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) @@ -60,8 +60,8 @@ on either of these environments. [2]: https://docs.docker.com/docker-for-mac/ [3]: https://docs.docker.com/docker-for-windows/ -On Linux, Docker's default implementation allows only `root` user to access -docker commands and control containers. In order to allow a regular user to +On Linux, Docker's default implementation only allows `root` user access to +Docker commands and to control containers. In order to allow a regular user to access docker follow the [post-installation instructions](https://docs.docker.com/install/linux/linux-postinstall/). This document assumes the post-installation steps have been followed for the @@ -71,7 +71,7 @@ It is highly recommended that you alias `docker-compose` to `fig` (its original name) and use it wherever `docker-compose` is used. You are going to have to type this command a lot. -Then, clone this repo and setup the environment: +Then, clone this repo and set up the environment: git clone https://github.com/metacpan/metacpan-docker.git cd metacpan-docker @@ -84,7 +84,7 @@ The `bin/metacpan-docker init` command clones the source repositories for: - `metacpan-grep-front-end` - `metacpan-cpan-extracted-lite` -These repositories are automatically mounted in to the appropriate docker +These repositories are automatically mounted into the appropriate docker containers allowing the developer to use their preferred tools to work with the source code. @@ -95,7 +95,7 @@ The `docker-compose up` command will also fetch the official container images fr [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) repositories. -This will build the Docker containers for MetaCPAN, PostgreSQL and ElasticSearch +This will build the Docker containers for MetaCPAN, PostgreSQL and Elasticsearch services (which will take a while, especially on a fresh first time install of Docker) and run the services. @@ -105,7 +105,7 @@ following command in a separate terminal to get yourself up to speed: docker-compose exec api index-cpan.sh This will prompt you to confirm removing old indices and setting up mappings on -the ElasticSearch service (say `YES`). It will then proceed to rsync a partial CPAN in +the Elasticsearch service (say `YES`). It will then proceed to rsync a partial CPAN in `/CPAN` for its metadata to be imported. Once the above is done, you should be able to see your local partial CPAN data @@ -141,13 +141,6 @@ the `api` container: docker-compose build api ``` -If you want to be able to run tests against the `api` container, you'll need to -install the test dependencies: - -``` -docker-compose build --build-arg CPM_ARGS='--with-test' api -``` - ### Accessing Containers Containers are accessible via the `docker-compose exec` command followed by the @@ -158,7 +151,7 @@ in the `api` container: Executing tests via `prove` inside the API container: - docker-compose exec api prove -lvr \ + docker-compose exec api_test prove -lvr \ t/00_setup.t \ t/01_darkpan.t \ t/api/controller/cover.t @@ -177,8 +170,8 @@ via: Each container is responsible for a different service. Some of these services are available in the developer environment via ports on the host system. -We are using [traefik][13] to manage the trafic between services. -The current configurations is the following: +We are using [traefik][13] to manage the traffic between services. +The current configuration is: - api: [http://api.metacpan.localhost](http://api.metacpan.localhost) - web: [http://web.metacpan.localhost](http://web.metacpan.localhost) @@ -186,7 +179,7 @@ The current configurations is the following: - grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) In order to access to the localhost subdomains, you probably have to manually -enter these entries in you `/etc/hosts` file. +add these entries in you `/etc/hosts` file. ``` # add to /etc/hosts @@ -204,31 +197,47 @@ You can access the dashboard configuration via: #### `web` -The local instance of the web front end is accessiable via -[http://localhost:5001](http://localhost:5001) -[http://web.metacpan.localhost](http://web.metacpan.localhost) +The local instance of the web front end is accessiable via: + +* [http://localhost:5001](http://localhost:5001) +* [http://web.metacpan.localhost](http://web.metacpan.localhost) #### `api` -[http://api.metacpan.localhost](http://api.metacpan.localhost) -[http://localhost:5000](http://localhost:5000) +* [http://localhost:5000](http://localhost:5000) +* [http://api.metacpan.localhost](http://api.metacpan.localhost) #### `github-meets-cpan` -[http://localhost:3000](http://localhost:3000) -[http://gh.metacpan.localhost](http://gh.metacpan.localhost) +* [http://localhost:3000](http://localhost:3000) +* [http://gh.metacpan.localhost](http://gh.metacpan.localhost) + +#### `Elasticsearch` -#### `ElasticSearch` +The `elasticsearch` and `elasticsearch_test` containers are not exposed directly. They are available via the `api` and `api_test` containers. -[http://localhost:9200](http://localhost:9200) +You can query the `elasticsearch` container via: + +``` +docker-compose exec elasticsearch curl http://localhost:9200 +``` + +You can query the `elasticsearch_test` container via: + +``` +docker-compose exec elasticsearch_test curl http://localhost:9200 +``` + +#### `PostgreSQL and MongoDB` The PostgreSQL and MongoDB services by default are only accessible from other containers. #### `grep` -The grep metacpan front end is accessible via -[http://grep.metacpan.localhost](http://grep.metacpan.localhost) +The grep metacpan front end is accessible via: + +* [http://grep.metacpan.localhost](http://grep.metacpan.localhost) Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via [metacpan-cpan-extracted-lite](https://github.com/metacpan/metacpan-cpan-extracted-lite). @@ -239,8 +248,9 @@ The system consists of several services that live in docker containers: - `web` — the web interface on [http://localhost:5001](http://localhost:5001) - `api` — the main server on [http://localhost:5000](http://localhost:5000) -- `elasticsearch` — database on [http://localhost:9200](http://localhost:9200) -- `elasticsearch_test` — test database on [http://localhost:9300](http://localhost:9300) +- `api_test` — the api server for running tests via `prove` +- `elasticsearch` — database for `api` +- `elasticsearch_test` — database for `api_test` - `pgdb` - PostgreSQL database container - `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) - `github-meets-cpan` - Containerized version of [gh.metacpan.org](https://gh.metacpan.org) @@ -249,8 +259,8 @@ The system consists of several services that live in docker containers: These services use one or more Docker volumes: - `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` -- `metacpan_elasticsearch`: holds the ElasticSearch database files -- `metacpan_elasticsearch_test`: holds the ElasticSearch test database files +- `metacpan_elasticsearch`: holds the Elasticsearch database files +- `metacpan_elasticsearch_test`: holds the Elasticsearch test database files - `metacpan_api_carton` and `metacpan_web_carton`: holds the dependencies installed by [Carton][4] for the `api` and `web` services, respectively; mounted on `/carton` instead of `local`, to prevent clashing with the host @@ -324,7 +334,7 @@ The `web` service is a checkout of `metacpan-web`, built as a Docker image. Running this service alone is enough if you want to just hack on the frontend, since by default the service is configured to talk to [https://fastapi.metacpan.org](https://fastapi.metacpan.org) for its backend; if this is what you want, then you -can simply invoke `docker-compose up`. +can simply invoke `docker-compose up` or `docker-compose up web`. #### `api` @@ -337,8 +347,7 @@ additional commands in a separate terminal once #### `grep` -The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker image. -Note that this is using the `metacpan_git_shared` volume, which requires the git repo for +The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker image. Note that this is using the `metacpan_git_shared` volume, which requires the git repo for `metacpan-cpan-extracted` which can be initialized by running: ./bin/metacpan-docker init @@ -378,7 +387,7 @@ instead will set it all up for you. The `elasticsearch` and `elasticsearch_test` services use the official [Elasticsearch Docker image][9], configured with settings and scripts taken from -the [metacpan-puppet][10] repository. It is depended upon by the `api` service. +the [metacpan-puppet][10] repository. The `api` service depends on the `elasticsearch` service and the `api_test` service depends on the `elasticsearch_test` services. [9]: https://store.docker.com/images/elasticsearch [10]: https://github.com/metacpan/metacpan-puppet From 090c89735dd8f629f7497276a5344857a513ecdf Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 3 Dec 2020 21:21:24 -0500 Subject: [PATCH 089/141] Quote more variables in bin/metacpan-docker --- bin/metacpan-docker | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index 6df7054..c3ea546 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -13,8 +13,8 @@ git_clone_and_setup_hooks() { local repo=$1 ( cd src - [ -d "$repo" ] || git clone https://github.com/metacpan/$repo.git - cd $repo + [ -d "$repo" ] || git clone "https://github.com/metacpan/$repo.git" + cd "$repo" [ -e git/hooks/pre-commit ] && chmod +x git/hooks/pre-commit cd .git/hooks ln -sf ../../git/hooks/pre-commit @@ -26,7 +26,7 @@ init() { echo "Initializing metacpan-docker repositories:" mkdir -p src for repo in ${GitRepos[@]}; do - git_clone_and_setup_hooks $repo + git_clone_and_setup_hooks "$repo" done [ -e src/metacpan-cpan-extracted ] || ln -s metacpan-cpan-extracted-lite src/metacpan-cpan-extracted @@ -43,7 +43,7 @@ init() { git_update_repo() { local repo=$1 ( - cd src/$repo + cd "src/$repo" git fetch origin git pull origin master ) @@ -54,7 +54,7 @@ git_reset_repo() { local repo=$1 echo "Updating repository $repo" ( - cd src/$repo + cd "src/$repo" git fetch origin git checkout master git pull origin master @@ -69,7 +69,7 @@ update() { git pull origin master for repo in ${GitRepos[@]}; do - git_update_repo $repo + git_update_repo "$repo" done } @@ -77,7 +77,7 @@ reset_repo() { echo "Resetting metacpan-docker repositories:" for repo in ${GitRepos[@]}; do - git_reset_repo $repo + git_reset_repo "$repo" done } From 763e000eb10a3ab8216f23fa618a5f8aff76e6db Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Thu, 18 Feb 2021 19:56:41 -0800 Subject: [PATCH 090/141] Remove `PRE_PROCESS` template. Matches a configuration change in the `metacpan-web` repo, found in `efea8a29` (in that repo). --- configs/metacpan-web/metacpan_web.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/metacpan-web/metacpan_web.conf b/configs/metacpan-web/metacpan_web.conf index c04263b..360ab89 100644 --- a/configs/metacpan-web/metacpan_web.conf +++ b/configs/metacpan-web/metacpan_web.conf @@ -20,7 +20,6 @@ mark_unauthorized_releases = 0 INCLUDE_PATH root/ TAG_STYLE asp - PRE_PROCESS preprocess.html WRAPPER wrapper.html TEMPLATE_EXTENSION .html ENCODING utf8 From f3ea30f2bf6b36e64c03e64348809a88c7c65036 Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Thu, 18 Feb 2021 20:00:38 -0800 Subject: [PATCH 091/141] Point `COMPILE_DIR` to a writable directory. Under Docker, `var/tmp/templates/` is not writable, but `/var/tmp/templates` is. --- configs/metacpan-web/metacpan_web.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/metacpan-web/metacpan_web.conf b/configs/metacpan-web/metacpan_web.conf index 360ab89..e8b4c81 100644 --- a/configs/metacpan-web/metacpan_web.conf +++ b/configs/metacpan-web/metacpan_web.conf @@ -26,7 +26,7 @@ mark_unauthorized_releases = 0 AUTO_FILTER html STAT_TTL 1 COMPILE_PERL 0 - COMPILE_DIR var/tmp/templates + COMPILE_DIR /var/tmp/templates From 419d74e584518df0c773ba9e4da9414b56b9d31b Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Thu, 18 Feb 2021 20:13:55 -0800 Subject: [PATCH 092/141] Ensure that PGDB has a password for the `metacpan` user. A password is required for Minion to be able to connect to PGDB, and so we need to set it on both sides; in `pg/` to ensure that a password exists in the DB, and then `configs/` to use it when connecting to the DB. --- configs/metacpan-api/metacpan_server.conf | 2 +- pg/docker-entrypoint-initdb.d/100-roles.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/metacpan-api/metacpan_server.conf b/configs/metacpan-api/metacpan_server.conf index d2a2da8..1894643 100644 --- a/configs/metacpan-api/metacpan_server.conf +++ b/configs/metacpan-api/metacpan_server.conf @@ -1,6 +1,6 @@ git /usr/bin/git cpan /CPAN -minion_dsn = postgresql://metacpan@pgdb/minion_queue +minion_dsn = postgresql://metacpan:metacpan@pgdb/minion_queue secret = I wish I had one to keep diff --git a/pg/docker-entrypoint-initdb.d/100-roles.sql b/pg/docker-entrypoint-initdb.d/100-roles.sql index 91fa225..6094210 100644 --- a/pg/docker-entrypoint-initdb.d/100-roles.sql +++ b/pg/docker-entrypoint-initdb.d/100-roles.sql @@ -1,4 +1,4 @@ -CREATE ROLE metacpan WITH LOGIN; +CREATE ROLE metacpan WITH LOGIN PASSWORD 'metacpan'; CREATE ROLE "metacpan-api" WITH LOGIN; -- make things easier for when we're poking around from inside the container From 1c279c4201542afbba5e2c9479c91e9f6a3b96a2 Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Fri, 19 Feb 2021 19:58:28 -0800 Subject: [PATCH 093/141] Re-index Permissions during initial setup. Can't verify Permissions or check on the status of various Notifications without having the Permissions indexed, so make sure that we reindex Permissions when doing the initial setup of the partial CPAN index. --- bin/index-cpan.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/index-cpan.sh b/bin/index-cpan.sh index 6fab08b..c3d99ea 100755 --- a/bin/index-cpan.sh +++ b/bin/index-cpan.sh @@ -7,3 +7,4 @@ ./bin/run bin/metacpan release /CPAN/authors/id/ ./bin/run bin/metacpan latest ./bin/run bin/metacpan author +./bin/run bin/metacpan permission From 49174fa0bca58bff50c1f6c6bea6720736ccfa39 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Fri, 26 Feb 2021 10:22:13 -0500 Subject: [PATCH 094/141] Bump Traefik from 2.0 to 2.4.5 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 73aa586..1a6d245 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,8 @@ services: # \__/_/ \__,_/\___/_/ /_/_/|_| /o____o_\ traefik: - # The official v2.0 Traefik docker image - image: traefik:v2.0 + # The official v2.4.5 Traefik docker image + image: traefik:v2.4.5 networks: - traefik-network # Enables the web UI and tells Traefik to listen to docker From c70a74e009e8e4b74ee6e6d3c952f7e378857e13 Mon Sep 17 00:00:00 2001 From: Wesley Schwengle Date: Thu, 16 Sep 2021 21:02:38 -0400 Subject: [PATCH 095/141] Add postgres login details to docker-compose.yml Resolves: gh#70 Signed-off-by: Wesley Schwengle --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 1a6d245..59c5f3e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -366,6 +366,8 @@ services: PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" environment: POSTGRES_PASSWORD: metacpan + POSTGRES_USERNAME: metacpan123 + POSTGRES_DB: metacpan networks: - database healthcheck: From faa1c9430f60607cfc02bb26c145a0fdaf0993a2 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Thu, 23 Sep 2021 14:59:30 +0100 Subject: [PATCH 096/141] Use the latest version of mongo that will work on older systems, see https://github.com/petio-team/petio/issues/533 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1a6d245..3b4780b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -396,7 +396,7 @@ services: # mongodb: - image: mongo:latest + image: mongo:4.4.9 networks: - mongo healthcheck: From fd468ece5ad86151a0f4d02a3de69816f72c74be Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 23 Sep 2021 18:27:07 +0200 Subject: [PATCH 097/141] fix metacpan_web config The configuration being used was broken because it was a copy of the old main config file, and hadn't been updated with the changes that have been made. There shouldn't be any need to mirror these changes. Instead we can just override the values we care about, specifically the URLs used. --- configs/metacpan-web/metacpan_web.conf | 39 -------------------- configs/metacpan-web/metacpan_web_local.conf | 8 ++++ docker-compose.yml | 4 +- 3 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 configs/metacpan-web/metacpan_web.conf create mode 100644 configs/metacpan-web/metacpan_web_local.conf diff --git a/configs/metacpan-web/metacpan_web.conf b/configs/metacpan-web/metacpan_web.conf deleted file mode 100644 index e8b4c81..0000000 --- a/configs/metacpan-web/metacpan_web.conf +++ /dev/null @@ -1,39 +0,0 @@ -# rename this file to metacpan::web.yml and put a ':' after 'name' if -# you want to use YAML like in old versions of Catalyst -name MetaCPAN::Web -default_view HTML - -api = http://api:5000 -api_external = http://localhost:5000 -api_secure = http://api:5000 -api_external_secure = http://localhost:5000 -source_host = http://localhost:5000 -web_host = http://localhost:5001 -consumer_key = metacpan.dev -cookie_secret = seekrit -consumer_secret = ClearAirTurbulence - -mark_unauthorized_releases = 0 - -#site_alert_message = The sky is falling. - - - INCLUDE_PATH root/ - TAG_STYLE asp - WRAPPER wrapper.html - TEMPLATE_EXTENSION .html - ENCODING utf8 - AUTO_FILTER html - STAT_TTL 1 - COMPILE_PERL 0 - COMPILE_DIR /var/tmp/templates - - - - WRAPPER "" - - - - public_key 6LeH2MsSAAAAANwz3AA73Gw5OjCVjT6I51Ev-ior - - diff --git a/configs/metacpan-web/metacpan_web_local.conf b/configs/metacpan-web/metacpan_web_local.conf new file mode 100644 index 0000000..16dc12c --- /dev/null +++ b/configs/metacpan-web/metacpan_web_local.conf @@ -0,0 +1,8 @@ +api = http://api:5000 +api_public = http://localhost:5000 +source_host = http://localhost:5000 +web_host = http://localhost:5001 + + + cache_dir = /var/tmp/templates + diff --git a/docker-compose.yml b/docker-compose.yml index 3b4780b..182807d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,8 +72,8 @@ services: source: web_carton target: /carton - type: bind - source: ./configs/metacpan-web/metacpan_web.conf - target: /metacpan-web/metacpan_web.conf + source: ./configs/metacpan-web/metacpan_web_local.conf + target: /metacpan-web/metacpan_web_local.conf read_only: true - type: bind source: ./src/metacpan-web From ff4160f37dae9f35bdf1a09f12906ee9e5a78e29 Mon Sep 17 00:00:00 2001 From: Shawn Sorichetti Date: Sat, 30 Oct 2021 21:15:14 -0400 Subject: [PATCH 098/141] Fix quoting setting environment variables Docker started throwing error messages because of the dashes (`-`) that appear as part of of the environment variables being set. Adding double quotes around the setting fixes the error. --- .env | 2 +- grep.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 074398d..8ea602e 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development PGDB=pgdb:5432 -API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose +API_SERVER="morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose" diff --git a/grep.env b/grep.env index 6b03c65..8e1d6a5 100644 --- a/grep.env +++ b/grep.env @@ -1,4 +1,4 @@ # grep service - development environment GREP_SITE_PORT=3001 -GREP_PLACKUP_SERVER_ARGS=-E development -R lib,bin \ No newline at end of file +GREP_PLACKUP_SERVER_ARGS="-E development -R lib,bin" From 0cf6a12ae161cc86306feb14759b7788e3a5c547 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Tue, 27 Dec 2022 13:35:48 +0300 Subject: [PATCH 099/141] set MOJO_MODE to 'testing' to mark the environment --- .circleci/config.yml | 3 +++ .env | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a7ca498..1760122 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,9 +36,12 @@ jobs: ./src/metacpan-api/wait-for-es.sh http://localhost:9200 elasticsearch_test -- name: wait for ES - run: + name: Run complete MetaCPAN API Test Suite command: | docker-compose exec -T api_test prove -lr --jobs 2 t docker-compose down + environment: + MOJO_MODE: testing - run: command: | docker-compose logs diff --git a/.env b/.env index 8ea602e..074398d 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ COMPOSE_PROJECT_NAME=metacpan PLACK_ENV=development PGDB=pgdb:5432 -API_SERVER="morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose" +API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose From 5984be8ef20c5a6cb0867f8542f1fafa25431987 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Fri, 30 Dec 2022 17:04:46 +0300 Subject: [PATCH 100/141] set MOJO_MODE for Docker environment --- .circleci/config.yml | 3 +-- localapi.env | 1 + localapi_test.env | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1760122..16b113f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,9 +40,8 @@ jobs: command: | docker-compose exec -T api_test prove -lr --jobs 2 t docker-compose down - environment: - MOJO_MODE: testing - run: + name: Show Docker container logs on Error command: | docker-compose logs docker stats --no-stream diff --git a/localapi.env b/localapi.env index f0a4aa4..97514a8 100644 --- a/localapi.env +++ b/localapi.env @@ -6,3 +6,4 @@ ES_TEST=elasticsearch_test:9200 MINICPAN=/CPAN PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton +MOJO_MODE=development diff --git a/localapi_test.env b/localapi_test.env index 4ea8bc2..1f49954 100644 --- a/localapi_test.env +++ b/localapi_test.env @@ -8,3 +8,4 @@ METACPAN_SERVER_CONFIG_LOCAL_SUFFIX=testing MINICPAN=/CPAN PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton +MOJO_MODE=testing From 32455840b729cb5676122f2c07b8273770e1a0f1 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 27 Apr 2023 14:46:45 +0200 Subject: [PATCH 101/141] Bump actions/checkout to v3 --- .github/workflows/up.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index 9d6a13f..e3b1a6b 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -13,7 +13,7 @@ jobs: strategy: max-parallel: 1 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: init run: bin/metacpan-docker init From 49395532c736feb75b2573876dc95bd6501621f6 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 27 Apr 2023 14:50:01 +0200 Subject: [PATCH 102/141] Remove duplicate key in CircleCI config --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 16b113f..90564db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,6 @@ jobs: docker-compose logs docker stats --no-stream docker ps -a | head - name: docker-compose logs when: on_fail - run: command: | From d2a23f3cafb103777eb52b17ceee42e7eb21baae Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 27 Apr 2023 16:46:19 +0200 Subject: [PATCH 103/141] Don't try to nest read-only mounts in Docker At some point Docker stopped permitting this. Disable the read-only attribute on metacpan-web in order to be able to nest mounts. The proper change would probably be to rearchitect where the local config file lives. --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6ddb536..3ec32ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -71,13 +71,13 @@ services: - type: volume source: web_carton target: /carton - - type: bind - source: ./configs/metacpan-web/metacpan_web_local.conf - target: /metacpan-web/metacpan_web_local.conf - read_only: true - type: bind source: ./src/metacpan-web target: /metacpan-web + # read_only: true + - type: bind + source: ./configs/metacpan-web/metacpan_web_local.conf + target: /metacpan-web/metacpan_web_local.conf read_only: true ports: - "5001:5001" From 4397dc028974b7bdc36f2f81662cfa206f8ec476 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 30 Jan 2024 16:51:56 -0500 Subject: [PATCH 104/141] Fix typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4d102ee..6345f5c 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ You can access the dashboard configuration via: #### `web` -The local instance of the web front end is accessiable via: +The local instance of the web front end is accessible via: * [http://localhost:5001](http://localhost:5001) * [http://web.metacpan.localhost](http://web.metacpan.localhost) @@ -313,7 +313,7 @@ This will stay on your current local branch. This is used to reset all the git repositories in `src/*` to their latest version on `upstream/master`. -This will fail if you have some uncommited local changes. +This will fail if you have some uncommitted local changes. You should then commit or cancel your changes before re-running the command. #### `bin/metacpan-docker` build/up/down/start/stop/run/ps/top... From 04e477a4515ab1e5c9d947b6811c83ebb0b5111b Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 26 Apr 2024 14:00:32 +0100 Subject: [PATCH 105/141] add metacpan-ingest --- bin/metacpan-docker | 2 +- .../metacpan-ingest/metacpan_ingest_local.conf | 1 + docker-compose.yml | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 configs/metacpan-ingest/metacpan_ingest_local.conf diff --git a/bin/metacpan-docker b/bin/metacpan-docker index c3ea546..d8ebd7a 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -3,7 +3,7 @@ set -e -GitRepos=("metacpan-api" "metacpan-web" "metacpan-grep-front-end" "metacpan-cpan-extracted-lite") +GitRepos=("metacpan-api" "metacpan-web" "metacpan-grep-front-end" "metacpan-cpan-extracted-lite" "metacpan-ingest") # sanity check type "docker" > /dev/null diff --git a/configs/metacpan-ingest/metacpan_ingest_local.conf b/configs/metacpan-ingest/metacpan_ingest_local.conf new file mode 100644 index 0000000..aed640c --- /dev/null +++ b/configs/metacpan-ingest/metacpan_ingest_local.conf @@ -0,0 +1 @@ +cpan = /CPAN diff --git a/docker-compose.yml b/docker-compose.yml index 3ec32ac..fd32fe6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -198,6 +198,21 @@ services: - database - elasticsearch + ingest: + image: metacpan/metacpan-ingest:latest + volumes: + - type: volume + source: cpan + target: /CPAN + - type: bind + source: ./configs/metacpan-ingest/metacpan_ingest_local.conf + target: /metacpan-ingest/metacpan_ingest_local.conf + read_only: true + depends_on: + - elasticsearch + networks: + - elasticsearch + # _ _ _ _ _ # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| From cf53558b68cc993a5c33e16d7d2e09fbc945c09b Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 26 Apr 2024 17:00:26 +0100 Subject: [PATCH 106/141] update readme to cover buildx, buildkit, and ES 2.4 on mac systems --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 6345f5c..35a5249 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,19 @@ access docker follow the This document assumes the post-installation steps have been followed for the current user. +You will also need Docker buildx, and to enable Docker BuildKit. They should +be set up by default when using Docker Desktop, but on Linux you may need to +install them. buildx is the `docker-buildx` package on Debian based systems. +Docker BuildKit can be enabled by following the +[Getting Started](https://docs.docker.com/build/buildkit/#getting-started) +instructions. + +If you are running a Mac ARM64 system, you will need to manually tell docker +to use the x86_64 version of Elasticsearch 2.4. This can be done by running +the command: + + docker pull elasticsearch:2.4 --platform=linux/x86_64 + It is highly recommended that you alias `docker-compose` to `fig` (its original name) and use it wherever `docker-compose` is used. You are going to have to type this command a lot. From 516cfed6a99400be330b1c9d97688017b25f13a5 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 27 Apr 2024 10:24:39 +0100 Subject: [PATCH 107/141] Remove github-meets-cpan --- .circleci/config.yml | 8 --- .github/workflows/up.yml | 10 ---- README.md | 71 +++++++++++--------------- docker-compose.yml | 107 --------------------------------------- 4 files changed, 29 insertions(+), 167 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 90564db..0a92c0d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,11 +47,3 @@ jobs: docker stats --no-stream docker ps -a | head when: on_fail - - run: - command: | - docker-compose --verbose up -d github-meets-cpan - name: github-meets-cpan up - - run: - command: | - docker-compose exec -T github-meets-cpan prove -lr --jobs 2 t - docker-compose down diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index e3b1a6b..0adfc79 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -28,16 +28,6 @@ jobs: - name: down run: docker-compose down - - name: up github-meets-cpan - run: docker-compose up -d github-meets-cpan - - name: down - run: docker-compose down - - - name: up github-meets-cpan-cron - run: docker-compose up -d github-meets-cpan-cron - - name: down - run: docker-compose down - - name: up web run: docker-compose up -d web - name: down diff --git a/README.md b/README.md index 35a5249..f0cfa63 100644 --- a/README.md +++ b/README.md @@ -9,35 +9,35 @@ * [Running the MetaCPAN stack with Docker (via Docker Compose)](#running-the-metacpan-stack-with-docker-via-docker-compose) * [Quick Start](#quick-start) * [Working with Containers](#working-with-containers) - * [Building Containers](#building-containers) - * [Accessing Containers](#accessing-containers) - * [Accessing Services](#accessing-services) - * [`web`](#web) - * [`api`](#api) - * [`github-meets-cpan`](#github-meets-cpan) - * [`Elasticsearch`](#elasticsearch) - * [`grep`](#grep) + * [Building Containers](#building-containers) + * [Accessing Containers](#accessing-containers) + * [Accessing Services](#accessing-services) + * [`web`](#web) + * [`api`](#api) + * [`Elasticsearch`](#elasticsearch) + * [`PostgreSQL`](#postgresql) + * [`grep`](#grep) * [System architecture](#system-architecture) - * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) - * [`bin/metacpan init`](#binmetacpan-init) - * [`bin/metacpan localapi`](#binmetacpan-localapi) - * [`bin/metacpan-docker pull`](#binmetacpan-docker-pull) - * [`bin/metacpan-docker reset`](#binmetacpan-docker-reset) - * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) - * [Services](#services) - * [`web`](#web-1) - * [`api`](#api-1) - * [`grep`](#grep-1) - * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) - * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) - * [Putting the above all together](#putting-the-above-all-together) - * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) + * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) + * [`bin/metacpan init`](#binmetacpan-init) + * [`bin/metacpan localapi`](#binmetacpan-localapi) + * [`bin/metacpan-docker pull`](#binmetacpan-docker-pull) + * [`bin/metacpan-docker reset`](#binmetacpan-docker-reset) + * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) + * [Services](#services) + * [`web`](#web-1) + * [`api`](#api-1) + * [`grep`](#grep-1) + * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) + * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) + * [Putting the above all together](#putting-the-above-all-together) + * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) * [Tips and tricks](#tips-and-tricks) - * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) - * [Running tests](#running-tests) - * [Updating Carton dependencies](#updating-carton-dependencies) - * [Updating the git repositories](#updating-the-git-repositories) - * [Running Kibana to peek into Elasticsearch data](#running-kibana-to-peek-into-elasticsearch-data) + * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) + * [Running tests](#running-tests) + * [Updating Carton dependencies](#updating-carton-dependencies) + * [Updating the git repositories](#updating-the-git-repositories) + * [Running Kibana to peek into Elasticsearch data](#running-kibana-to-peek-into-elasticsearch-data) * [Peeking Inside the Container](#peeking-inside-the-container) * [To Do](#to-do) * [See also](#see-also) @@ -173,11 +173,6 @@ To access the `psql` command line client in the PostgreSQL container: docker-compose exec pgdb psql -Similarly the `mongodb` command line client in the MongoDB container is accessed -via: - - docker-compose exec mongodb mongo --host mongodb test - ### Accessing Services Each container is responsible for a different service. Some of these services @@ -188,7 +183,6 @@ The current configuration is: - api: [http://api.metacpan.localhost](http://api.metacpan.localhost) - web: [http://web.metacpan.localhost](http://web.metacpan.localhost) -- github-meets-cpan: [http://gh.metacpan.localhost](http://gh.metacpan.localhost) - grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) In order to access to the localhost subdomains, you probably have to manually @@ -220,11 +214,6 @@ The local instance of the web front end is accessible via: * [http://localhost:5000](http://localhost:5000) * [http://api.metacpan.localhost](http://api.metacpan.localhost) -#### `github-meets-cpan` - -* [http://localhost:3000](http://localhost:3000) -* [http://gh.metacpan.localhost](http://gh.metacpan.localhost) - #### `Elasticsearch` The `elasticsearch` and `elasticsearch_test` containers are not exposed directly. They are available via the `api` and `api_test` containers. @@ -241,10 +230,9 @@ You can query the `elasticsearch_test` container via: docker-compose exec elasticsearch_test curl http://localhost:9200 ``` -#### `PostgreSQL and MongoDB` +#### `PostgreSQL` -The PostgreSQL and MongoDB services by default are only accessible from other -containers. +The PostgreSQL service by default is only accessible from other containers. #### `grep` @@ -266,7 +254,6 @@ The system consists of several services that live in docker containers: - `elasticsearch_test` — database for `api_test` - `pgdb` - PostgreSQL database container - `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) -- `github-meets-cpan` - Containerized version of [gh.metacpan.org](https://gh.metacpan.org) - `grep` - the web interface for grep.metacpan on [http://localhost:3001](http://localhost:3001) These services use one or more Docker volumes: diff --git a/docker-compose.yml b/docker-compose.yml index fd32fe6..6059aaa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -213,93 +213,6 @@ services: networks: - elasticsearch - # _ _ _ _ _ - # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ - # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| - # | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ - # \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ - # |___/ - # - # ___ _ __ __ _ _ __ - # / __| '_ \ / _` | '_ \ - # | (__| |_) | (_| | | | | - # \___| .__/ \__,_|_| |_| - # |_| - # - github-meets-cpan: - image: metacpan/github-meets-cpan:latest - command: "/wait-for-it.sh mongodb:27017 -- morbo script/app.pl" - depends_on: - - mongodb - - logspout - - traefik - networks: - - mongo - - traefik-network - labels: - - "traefik.enable=true" - - "traefik.docker.network=traefik-network" - - "traefik.http.routers.github-meets-cpan.rule=Host(`gh.metacpan.localhost`)" - - "traefik.http.services.gh-meet-cpan-web.loadbalancer.server.port=3000" - - # _ _ _ _ _ - # __ _(_) |_| |__ _ _| |__ _ __ ___ ___ ___| |_ ___ - # / _` | | __| '_ \| | | | '_ \ | '_ ` _ \ / _ \/ _ \ __/ __| - # | (_| | | |_| | | | |_| | |_) | | | | | | | __/ __/ |_\__ \ - # \__, |_|\__|_| |_|\__,_|_.__/ |_| |_| |_|\___|\___|\__|___/ - # |___/ - # - # ___ _ __ __ _ _ __ ___ _ __ ___ _ __ - # / __| '_ \ / _` | '_ \ / __| '__/ _ \| '_ \ - # | (__| |_) | (_| | | | | | (__| | | (_) | | | | - # \___| .__/ \__,_|_| |_| \___|_| \___/|_| |_| - # |_| - # - - github-meets-cpan-cron: - image: metacpan/github-meets-cpan:latest - command: "/wait-for-it.sh mongodb:27017 -- perl cron/update.pl" - depends_on: - - mongodb - volumes: - - type: bind - source: ${MC_CONF_PRIVATE_DIR:-.}/github-meets-cpan/environment.json - target: /code/environment.json - read_only: true - networks: - - mongo - - # __ _ _ __ ___ _ __ - # / _` | '__/ _ \ '_ \ - # | (_| | | | __/ |_) | - # \__, |_| \___| .__/ - # __/ | | | - # |___/ |_| - - grep: - depends_on: - - traefik - image: metacpan/metacpan-grep-front-end:latest - build: - context: ./src/metacpan-grep-front-end - volumes: - - type: volume - source: metacpan_git_shared - target: /shared/metacpan_git - read_only: true - - type: bind - source: ./src/metacpan-grep-front-end - target: /metacpan-grep-front-end - read_only: true - env_file: - - grep.env - networks: - - traefik-network - labels: - - "traefik.enable=true" - - "traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`)" - - "traefik.http.services.grep-web.loadbalancer.server.port=3000" - # ____ _ _____ _ ____ _ ____ _____ ____ # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| # | | | |/ _ \ | | / _ \ | _ \ / _ \ \___ \| _| \___ \ @@ -404,25 +317,6 @@ services: target: /healthcheck.sh read_only: true - # _ _ - # _ __ ___ ___ _ __ __ _ ___ __| | |__ - # | '_ ` _ \ / _ \| '_ \ / _` |/ _ \ / _` | '_ \ - # | | | | | | (_) | | | | (_| | (_) | (_| | |_) | - # |_| |_| |_|\___/|_| |_|\__, |\___/ \__,_|_.__/ - # |___/ - # - - mongodb: - image: mongo:4.4.9 - networks: - - mongo - healthcheck: - interval: 10s - timeout: 10s - retries: 0 - start_period: 40s - test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet - # _ _ _____ _______ _____ ____ _ ______ # | \ | | ____|_ _\ \ / / _ \| _ \| |/ / ___| # | \| | _| | | \ \ /\ / / | | | |_) | ' /\___ \ @@ -433,7 +327,6 @@ services: networks: database: elasticsearch: - mongo: traefik-network: web-network: From 4b5d47f6b92da2eebc62eeeae09f5104852faa7c Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 27 Apr 2024 11:12:58 +0100 Subject: [PATCH 108/141] Restore grep config after accidentally removing it --- docker-compose.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 6059aaa..3a47f53 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -213,6 +213,37 @@ services: networks: - elasticsearch + # __ _ _ __ ___ _ __ + # / _` | '__/ _ \ '_ \ + # | (_| | | | __/ |_) | + # \__, |_| \___| .__/ + # __/ | | | + # |___/ |_| + + grep: + depends_on: + - traefik + image: metacpan/metacpan-grep-front-end:latest + build: + context: ./src/metacpan-grep-front-end + volumes: + - type: volume + source: metacpan_git_shared + target: /shared/metacpan_git + read_only: true + - type: bind + source: ./src/metacpan-grep-front-end + target: /metacpan-grep-front-end + read_only: true + env_file: + - grep.env + networks: + - traefik-network + labels: + - "traefik.enable=true" + - "traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`)" + - "traefik.http.services.grep-web.loadbalancer.server.port=3000" + # ____ _ _____ _ ____ _ ____ _____ ____ # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| # | | | |/ _ \ | | / _ \ | _ \ / _ \ \___ \| _| \___ \ From 49a7884872b497b1cddd9a72ab2e1974ee094078 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 27 Apr 2024 15:44:35 +0100 Subject: [PATCH 109/141] Tidy some of README --- README.md | 75 +++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index f0cfa63..31cd866 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,10 @@ Then, clone this repo and set up the environment: The `bin/metacpan-docker init` command clones the source repositories for: -- `metacpan-web` -- `metacpan-api` -- `metacpan-grep-front-end` -- `metacpan-cpan-extracted-lite` +* `metacpan-web` +* `metacpan-api` +* `metacpan-grep-front-end` +* `metacpan-cpan-extracted-lite` These repositories are automatically mounted into the appropriate docker containers allowing the developer to use their preferred tools to work with the @@ -118,8 +118,8 @@ following command in a separate terminal to get yourself up to speed: docker-compose exec api index-cpan.sh This will prompt you to confirm removing old indices and setting up mappings on -the Elasticsearch service (say `YES`). It will then proceed to rsync a partial CPAN in -`/CPAN` for its metadata to be imported. +the Elasticsearch service (say `YES`). It will then proceed to rsync a partial +CPAN in `/CPAN` for its metadata to be imported. Once the above is done, you should be able to see your local partial CPAN data in e.g. [http://localhost:5001/recent](http://localhost:5001/recent) and @@ -150,9 +150,7 @@ For further details, read on! You can (re)build arbitrary containers. For instance, if you want to rebuild the `api` container: -``` -docker-compose build api -``` + docker-compose build api ### Accessing Containers @@ -181,21 +179,19 @@ are available in the developer environment via ports on the host system. We are using [traefik][13] to manage the traffic between services. The current configuration is: -- api: [http://api.metacpan.localhost](http://api.metacpan.localhost) -- web: [http://web.metacpan.localhost](http://web.metacpan.localhost) -- grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) +* api: [http://api.metacpan.localhost](http://api.metacpan.localhost) +* web: [http://web.metacpan.localhost](http://web.metacpan.localhost) +* grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) In order to access to the localhost subdomains, you probably have to manually add these entries in you `/etc/hosts` file. -``` -# add to /etc/hosts -127.0.0.1 api.metacpan.localhost -127.0.0.1 gh.metacpan.localhost -127.0.0.1 grep.metacpan.localhost -127.0.0.1 metacpan.localhost -127.0.0.1 web.metacpan.localhost -``` + # add to /etc/hosts + 127.0.0.1 api.metacpan.localhost + 127.0.0.1 gh.metacpan.localhost + 127.0.0.1 grep.metacpan.localhost + 127.0.0.1 metacpan.localhost + 127.0.0.1 web.metacpan.localhost You can access the dashboard configuration via: [http://metacpan.localhost:8080](http://metacpan.localhost:8080) @@ -216,19 +212,16 @@ The local instance of the web front end is accessible via: #### `Elasticsearch` -The `elasticsearch` and `elasticsearch_test` containers are not exposed directly. They are available via the `api` and `api_test` containers. +The `elasticsearch` and `elasticsearch_test` containers are not exposed +directly. They are available via the `api` and `api_test` containers. You can query the `elasticsearch` container via: -``` -docker-compose exec elasticsearch curl http://localhost:9200 -``` + docker-compose exec elasticsearch curl http://localhost:9200 You can query the `elasticsearch_test` container via: -``` -docker-compose exec elasticsearch_test curl http://localhost:9200 -``` + docker-compose exec elasticsearch_test curl http://localhost:9200 #### `PostgreSQL` @@ -247,25 +240,25 @@ Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via The system consists of several services that live in docker containers: -- `web` — the web interface on [http://localhost:5001](http://localhost:5001) -- `api` — the main server on [http://localhost:5000](http://localhost:5000) -- `api_test` — the api server for running tests via `prove` -- `elasticsearch` — database for `api` -- `elasticsearch_test` — database for `api_test` -- `pgdb` - PostgreSQL database container -- `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) -- `grep` - the web interface for grep.metacpan on [http://localhost:3001](http://localhost:3001) +* `web` — the web interface on [http://localhost:5001](http://localhost:5001) +* `api` — the main server on [http://localhost:5000](http://localhost:5000) +* `api_test` — the api server for running tests via `prove` +* `elasticsearch` — database for `api` +* `elasticsearch_test` — database for `api_test` +* `pgdb` - PostgreSQL database container +* `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) +* `grep` - the web interface for grep.metacpan on [http://localhost:3001](http://localhost:3001) These services use one or more Docker volumes: -- `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` -- `metacpan_elasticsearch`: holds the Elasticsearch database files -- `metacpan_elasticsearch_test`: holds the Elasticsearch test database files -- `metacpan_api_carton` and `metacpan_web_carton`: holds the dependencies +* `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` +* `metacpan_elasticsearch`: holds the Elasticsearch database files +* `metacpan_elasticsearch_test`: holds the Elasticsearch test database files +* `metacpan_api_carton` and `metacpan_web_carton`: holds the dependencies installed by [Carton][4] for the `api` and `web` services, respectively; mounted on `/carton` instead of `local`, to prevent clashing with the host user's Carton -- `metacpan_git_shared`: points to the git repo containing all extracted CPAN +* `metacpan_git_shared`: points to the git repo containing all extracted CPAN versions. This is mounted in `/shared/metacpan_git`. This can be either `metacpan-cpan-extracted` or `metacpan-cpan-extracted-lite`. The volume is bound to the local repo at `${PWD}/src/metacpan-cpan-extracted`. @@ -472,7 +465,7 @@ configuring e.g. a `kibana` service. If you run `docker ps` you'll see the containers. You might see something like: -``` +```bash $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2efb9c475c83 metacpan-web:latest "carton exec plackup…" 12 hours ago Up 12 hours 0.0.0.0:5001->5001/tcp metacpan_web_1 From dd7cfa73ef838fe378d84629b24b2cd1418c2cf3 Mon Sep 17 00:00:00 2001 From: Alexander Hartmaier Date: Wed, 8 May 2024 17:43:34 +0200 Subject: [PATCH 110/141] fix metacpan-docker init when .git/hooks directory isn't created by git clone --- bin/metacpan-docker | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index d8ebd7a..c4cf5a8 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -16,6 +16,7 @@ git_clone_and_setup_hooks() { [ -d "$repo" ] || git clone "https://github.com/metacpan/$repo.git" cd "$repo" [ -e git/hooks/pre-commit ] && chmod +x git/hooks/pre-commit + [ -d .git/hooks ] || mkdir .git/hooks cd .git/hooks ln -sf ../../git/hooks/pre-commit ) From 9bf55def3b33cd119051e06e680f2a82a58ad254 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sun, 1 Sep 2024 19:47:56 -0400 Subject: [PATCH 111/141] Tidy README.md --- README.md | 209 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 108 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index 31cd866..61df61a 100644 --- a/README.md +++ b/README.md @@ -6,41 +6,41 @@ -* [Running the MetaCPAN stack with Docker (via Docker Compose)](#running-the-metacpan-stack-with-docker-via-docker-compose) -* [Quick Start](#quick-start) -* [Working with Containers](#working-with-containers) - * [Building Containers](#building-containers) - * [Accessing Containers](#accessing-containers) - * [Accessing Services](#accessing-services) - * [`web`](#web) - * [`api`](#api) - * [`Elasticsearch`](#elasticsearch) - * [`PostgreSQL`](#postgresql) - * [`grep`](#grep) -* [System architecture](#system-architecture) - * [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) - * [`bin/metacpan init`](#binmetacpan-init) - * [`bin/metacpan localapi`](#binmetacpan-localapi) - * [`bin/metacpan-docker pull`](#binmetacpan-docker-pull) - * [`bin/metacpan-docker reset`](#binmetacpan-docker-reset) - * [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) - * [Services](#services) - * [`web`](#web-1) - * [`api`](#api-1) - * [`grep`](#grep-1) - * [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) - * [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) - * [Putting the above all together](#putting-the-above-all-together) - * [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) -* [Tips and tricks](#tips-and-tricks) - * [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) - * [Running tests](#running-tests) - * [Updating Carton dependencies](#updating-carton-dependencies) - * [Updating the git repositories](#updating-the-git-repositories) - * [Running Kibana to peek into Elasticsearch data](#running-kibana-to-peek-into-elasticsearch-data) -* [Peeking Inside the Container](#peeking-inside-the-container) -* [To Do](#to-do) -* [See also](#see-also) +- [Running the MetaCPAN stack with Docker (via Docker Compose)](#running-the-metacpan-stack-with-docker-via-docker-compose) +- [Quick Start](#quick-start) +- [Working with Containers](#working-with-containers) + - [Building Containers](#building-containers) + - [Accessing Containers](#accessing-containers) + - [Accessing Services](#accessing-services) + - [`web`](#web) + - [`api`](#api) + - [`Elasticsearch`](#elasticsearch) + - [`PostgreSQL`](#postgresql) + - [`grep`](#grep) +- [System architecture](#system-architecture) + - [The `bin/metacpan-docker` script](#the-binmetacpan-docker-script) + - [`bin/metacpan init`](#binmetacpan-init) + - [`bin/metacpan localapi`](#binmetacpan-localapi) + - [`bin/metacpan-docker pull`](#binmetacpan-docker-pull) + - [`bin/metacpan-docker reset`](#binmetacpan-docker-reset) + - [`bin/metacpan-docker` build/up/down/start/stop/run/ps/top...](#binmetacpan-docker-buildupdownstartstoprunpstop) + - [Services](#services) + - [`web`](#web-1) + - [`api`](#api-1) + - [`grep`](#grep-1) + - [Setting up a partial CPAN in the `api` service](#setting-up-a-partial-cpan-in-the-api-service) + - [Bootstrapping the `elasticsearch` indices](#bootstrapping-the-elasticsearch-indices) + - [Putting the above all together](#putting-the-above-all-together) + - [elasticsearch and elasticsearch_test](#elasticsearch-and-elasticsearch_test) +- [Tips and tricks](#tips-and-tricks) + - [Running your own miniCPAN inside metacpan-docker](#running-your-own-minicpan-inside-metacpan-docker) + - [Running tests](#running-tests) + - [Updating Carton dependencies](#updating-carton-dependencies) + - [Updating the git repositories](#updating-the-git-repositories) + - [Running Kibana to peek into Elasticsearch data](#running-kibana-to-peek-into-elasticsearch-data) +- [Peeking Inside the Container](#peeking-inside-the-container) +- [To Do](#to-do) +- [See also](#see-also) @@ -67,16 +67,16 @@ access docker follow the This document assumes the post-installation steps have been followed for the current user. -You will also need Docker buildx, and to enable Docker BuildKit. They should -be set up by default when using Docker Desktop, but on Linux you may need to +You will also need Docker buildx, and to enable Docker BuildKit. They should be +set up by default when using Docker Desktop, but on Linux you may need to install them. buildx is the `docker-buildx` package on Debian based systems. Docker BuildKit can be enabled by following the [Getting Started](https://docs.docker.com/build/buildkit/#getting-started) instructions. -If you are running a Mac ARM64 system, you will need to manually tell docker -to use the x86_64 version of Elasticsearch 2.4. This can be done by running -the command: +If you are running a Mac ARM64 system, you will need to manually tell docker to +use the x86_64 version of Elasticsearch 2.4. This can be done by running the +command: docker pull elasticsearch:2.4 --platform=linux/x86_64 @@ -92,10 +92,10 @@ Then, clone this repo and set up the environment: The `bin/metacpan-docker init` command clones the source repositories for: -* `metacpan-web` -* `metacpan-api` -* `metacpan-grep-front-end` -* `metacpan-cpan-extracted-lite` +- `metacpan-web` +- `metacpan-api` +- `metacpan-grep-front-end` +- `metacpan-cpan-extracted-lite` These repositories are automatically mounted into the appropriate docker containers allowing the developer to use their preferred tools to work with the @@ -104,8 +104,8 @@ source code. The `docker-compose up` command on its own will bring up the entire stack in the foreground (logs will be displayed). -The `docker-compose up` command will also fetch the official container images from -[MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) +The `docker-compose up` command will also fetch the official container images +from [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) repositories. This will build the Docker containers for MetaCPAN, PostgreSQL and Elasticsearch @@ -118,7 +118,7 @@ following command in a separate terminal to get yourself up to speed: docker-compose exec api index-cpan.sh This will prompt you to confirm removing old indices and setting up mappings on -the Elasticsearch service (say `YES`). It will then proceed to rsync a partial +the Elasticsearch service (say `YES`). It will then proceed to rsync a partial CPAN in `/CPAN` for its metadata to be imported. Once the above is done, you should be able to see your local partial CPAN data @@ -147,8 +147,8 @@ For further details, read on! ### Building Containers -You can (re)build arbitrary containers. For instance, if you want to rebuild -the `api` container: +You can (re)build arbitrary containers. For instance, if you want to rebuild the +`api` container: docker-compose build api @@ -176,12 +176,12 @@ To access the `psql` command line client in the PostgreSQL container: Each container is responsible for a different service. Some of these services are available in the developer environment via ports on the host system. -We are using [traefik][13] to manage the traffic between services. -The current configuration is: +We are using [traefik][13] to manage the traffic between services. The current +configuration is: -* api: [http://api.metacpan.localhost](http://api.metacpan.localhost) -* web: [http://web.metacpan.localhost](http://web.metacpan.localhost) -* grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) +- api: [http://api.metacpan.localhost](http://api.metacpan.localhost) +- web: [http://web.metacpan.localhost](http://web.metacpan.localhost) +- grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) In order to access to the localhost subdomains, you probably have to manually add these entries in you `/etc/hosts` file. @@ -202,13 +202,13 @@ You can access the dashboard configuration via: The local instance of the web front end is accessible via: -* [http://localhost:5001](http://localhost:5001) -* [http://web.metacpan.localhost](http://web.metacpan.localhost) +- [http://localhost:5001](http://localhost:5001) +- [http://web.metacpan.localhost](http://web.metacpan.localhost) #### `api` -* [http://localhost:5000](http://localhost:5000) -* [http://api.metacpan.localhost](http://api.metacpan.localhost) +- [http://localhost:5000](http://localhost:5000) +- [http://api.metacpan.localhost](http://api.metacpan.localhost) #### `Elasticsearch` @@ -231,7 +231,7 @@ The PostgreSQL service by default is only accessible from other containers. The grep metacpan front end is accessible via: -* [http://grep.metacpan.localhost](http://grep.metacpan.localhost) +- [http://grep.metacpan.localhost](http://grep.metacpan.localhost) Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via [metacpan-cpan-extracted-lite](https://github.com/metacpan/metacpan-cpan-extracted-lite). @@ -240,28 +240,29 @@ Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via The system consists of several services that live in docker containers: -* `web` — the web interface on [http://localhost:5001](http://localhost:5001) -* `api` — the main server on [http://localhost:5000](http://localhost:5000) -* `api_test` — the api server for running tests via `prove` -* `elasticsearch` — database for `api` -* `elasticsearch_test` — database for `api_test` -* `pgdb` - PostgreSQL database container -* `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) -* `grep` - the web interface for grep.metacpan on [http://localhost:3001](http://localhost:3001) +- `web` — the web interface on [http://localhost:5001](http://localhost:5001) +- `api` — the main server on [http://localhost:5000](http://localhost:5000) +- `api_test` — the api server for running tests via `prove` +- `elasticsearch` — database for `api` +- `elasticsearch_test` — database for `api_test` +- `pgdb` - PostgreSQL database container +- `logspout` - Docker log interface to [honeycomb.io](https://honeycomb.io) +- `grep` - the web interface for grep.metacpan on + [http://localhost:3001](http://localhost:3001) These services use one or more Docker volumes: -* `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` -* `metacpan_elasticsearch`: holds the Elasticsearch database files -* `metacpan_elasticsearch_test`: holds the Elasticsearch test database files -* `metacpan_api_carton` and `metacpan_web_carton`: holds the dependencies +- `metacpan_cpan`: holds the CPAN archive, mounted in `/CPAN` +- `metacpan_elasticsearch`: holds the Elasticsearch database files +- `metacpan_elasticsearch_test`: holds the Elasticsearch test database files +- `metacpan_api_carton` and `metacpan_web_carton`: holds the dependencies installed by [Carton][4] for the `api` and `web` services, respectively; mounted on `/carton` instead of `local`, to prevent clashing with the host user's Carton -* `metacpan_git_shared`: points to the git repo containing all extracted CPAN - versions. This is mounted in `/shared/metacpan_git`. - This can be either `metacpan-cpan-extracted` or `metacpan-cpan-extracted-lite`. - The volume is bound to the local repo at `${PWD}/src/metacpan-cpan-extracted`. +- `metacpan_git_shared`: points to the git repo containing all extracted CPAN + versions. This is mounted in `/shared/metacpan_git`. This can be either + `metacpan-cpan-extracted` or `metacpan-cpan-extracted-lite`. The volume is + bound to the local repo at `${PWD}/src/metacpan-cpan-extracted`. [4]: https://metacpan.org/pod/Carton @@ -283,7 +284,8 @@ The `init` subcommand basically clones the [metacpan-api][5] and them, in preparation for future `docker-compose` or `bin/metacpan-docker localapi` commands. -It also clones the `metacpan-grep-front-end` and `metacpan-cpan-extracted-lite` repositories. +It also clones the `metacpan-grep-front-end` and `metacpan-cpan-extracted-lite` +repositories. [5]: https://github.com/metacpan/metacpan-api [6]: https://github.com/metacpan/metacpan-web @@ -299,22 +301,22 @@ default `docker-compose.yml`. #### `bin/metacpan-docker pull` -This is used to update all the git repository in `src/*`. -This will stay on your current local branch. +This is used to update all the git repository in `src/*`. This will stay on your +current local branch. #### `bin/metacpan-docker reset` -This is used to reset all the git repositories in `src/*` to their -latest version on `upstream/master`. -This will fail if you have some uncommitted local changes. -You should then commit or cancel your changes before re-running the command. +This is used to reset all the git repositories in `src/*` to their latest +version on `upstream/master`. This will fail if you have some uncommitted local +changes. You should then commit or cancel your changes before re-running the +command. #### `bin/metacpan-docker` build/up/down/start/stop/run/ps/top... -As noted earlier, `bin/metacpan-docker` is a thin wrapper around `docker-compose`, -so commands like `up`, `down`, and `run` will work as expected from -`docker-compose`. See the [docker-compose docs][7] for an overview of available -commands. +As noted earlier, `bin/metacpan-docker` is a thin wrapper around +`docker-compose`, so commands like `up`, `down`, and `run` will work as expected +from `docker-compose`. See the [docker-compose docs][7] for an overview of +available commands. [7]: https://docs.docker.com/compose/reference/overview/#command-options-overview-and-help @@ -326,8 +328,9 @@ commands. The `web` service is a checkout of `metacpan-web`, built as a Docker image. Running this service alone is enough if you want to just hack on the frontend, since by default the service is configured to talk to -[https://fastapi.metacpan.org](https://fastapi.metacpan.org) for its backend; if this is what you want, then you -can simply invoke `docker-compose up` or `docker-compose up web`. +[https://fastapi.metacpan.org](https://fastapi.metacpan.org) for its backend; if +this is what you want, then you can simply invoke `docker-compose up` or +`docker-compose up web`. #### `api` @@ -340,8 +343,9 @@ additional commands in a separate terminal once #### `grep` -The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker image. Note that this is using the `metacpan_git_shared` volume, which requires the git repo for -`metacpan-cpan-extracted` which can be initialized by running: +The `grep` service is a checkout of `metacpan-grep-front-end`, built as a Docker +image. Note that this is using the `metacpan_git_shared` volume, which requires +the git repo for `metacpan-cpan-extracted` which can be initialized by running: ./bin/metacpan-docker init @@ -351,9 +355,9 @@ Running bin/metacpan-docker localapi exec api partial-cpan-mirror.sh -will `rsync` modules from selected CPAN authors, plus the package and author indices, -into the `api` service's `/CPAN` directory. This is nearly equivalent to the -same script in the (now deprecated) [metacpan-developer][8] repository. +will `rsync` modules from selected CPAN authors, plus the package and author +indices, into the `api` service's `/CPAN` directory. This is nearly equivalent +to the same script in the (now deprecated) [metacpan-developer][8] repository. [8]: https://github.com/metacpan/metacpan-developer ##### Bootstrapping the `elasticsearch` indices @@ -380,7 +384,9 @@ instead will set it all up for you. The `elasticsearch` and `elasticsearch_test` services use the official [Elasticsearch Docker image][9], configured with settings and scripts taken from -the [metacpan-puppet][10] repository. The `api` service depends on the `elasticsearch` service and the `api_test` service depends on the `elasticsearch_test` services. +the [metacpan-puppet][10] repository. The `api` service depends on the +`elasticsearch` service and the `api_test` service depends on the +`elasticsearch_test` services. [9]: https://store.docker.com/images/elasticsearch [10]: https://github.com/metacpan/metacpan-puppet @@ -445,16 +451,17 @@ You can use `bin/metacpan-docker pull` to update all `src/*` directories. ### Running Kibana to peek into Elasticsearch data By default, the `docker-compose.localapi.yml` configures the `elasticsearch` -service to listen on the Docker host at [http://localhost:9200](http://localhost:9200), and is also -accessible via the Docker `default` network address of [http://172.17.0.1:9200](http://172.17.0.1:9200); -you can inspect it via simple `curl` or `wget` requests, or use a [Kibana][12] -container, e.g. +service to listen on the Docker host at +[http://localhost:9200](http://localhost:9200), and is also accessible via the +Docker `default` network address of +[http://172.17.0.1:9200](http://172.17.0.1:9200); you can inspect it via simple +`curl` or `wget` requests, or use a [Kibana][12] container, e.g. docker run --rm -p 5601:5601 -e ELASTICSEARCH_URL=http://172.17.0.1:9200 -it kibana:4.6 -Running the above will provide a Kibana container at [http://localhost:5601](http://localhost:5601), -which you can configure to have it read the `cpan*` index in the `elasticsearch` -service. +Running the above will provide a Kibana container at +[http://localhost:5601](http://localhost:5601), which you can configure to have +it read the `cpan*` index in the `elasticsearch` service. It is also certainly possible to run Kibana as part of the compose setup, by configuring e.g. a `kibana` service. From 0a8ba6f44982b0ebe815e0eb3040a6907fb0f609 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sun, 1 Sep 2024 19:54:36 -0400 Subject: [PATCH 112/141] version in docker-compose.yml is now obsolete --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3a47f53..5f1d52f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,4 @@ --- -version: "3.4" # ____ _____ ______ _____ ____ _____ ____ # / ___|| ____| _ \ \ / /_ _/ ___| ____/ ___| From e8c4a8142cf0cb70bc4ed9b9f9c68df174cd1f93 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sun, 1 Sep 2024 20:18:25 -0400 Subject: [PATCH 113/141] s/docker-compose/docker compose/ in bin/metacpan-docker --- bin/metacpan-docker | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index c4cf5a8..01d98ed 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# metacpan-docker: simple wrapper for docker-compose running MetaCPAN +# metacpan-docker: simple wrapper for docker compose running MetaCPAN set -e @@ -7,7 +7,6 @@ GitRepos=("metacpan-api" "metacpan-web" "metacpan-grep-front-end" "metacpan-cpan # sanity check type "docker" > /dev/null -type "docker-compose" > /dev/null git_clone_and_setup_hooks() { local repo=$1 @@ -108,4 +107,4 @@ case "x$1" in ;; esac -exec docker-compose "$@" +exec docker compose "$@" From b3990721d926260aee6ac740fd0bb19b6ab39c9c Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sun, 1 Sep 2024 20:19:40 -0400 Subject: [PATCH 114/141] Tidy bin/metacpan-docker --- bin/metacpan-docker | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/bin/metacpan-docker b/bin/metacpan-docker index 01d98ed..139b4b4 100755 --- a/bin/metacpan-docker +++ b/bin/metacpan-docker @@ -81,30 +81,28 @@ reset_repo() { done } - case "x$1" in - 'xinit') - init - exit - ;; - 'xreset') - reset_repo - exit - ;; - 'xpull') - update - exit - ;; - 'xlocalapi') - shift - ;; - 'x') - init - update - exit - ;; - *) - ;; +'xinit') + init + exit + ;; +'xreset') + reset_repo + exit + ;; +'xpull') + update + exit + ;; +'xlocalapi') + shift + ;; +'x') + init + update + exit + ;; +*) ;; esac exec docker compose "$@" From 4bb6cc2a881c5e0bffbae7b9c79dd9c1d051c1e9 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sun, 1 Sep 2024 20:25:50 -0400 Subject: [PATCH 115/141] s/docker-compose/docker compose/ in README --- README.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 61df61a..6d6daee 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CircleCI](https://circleci.com/gh/metacpan/metacpan-docker.svg?style=svg)](https://circleci.com/gh/metacpan/metacpan-docker) -![docker-compose up](https://github.com/metacpan/metacpan-docker/workflows/docker-compose%20up/badge.svg?branch=master) +![docker compose up](https://github.com/metacpan/metacpan-docker/workflows/docker-compose%20up/badge.svg?branch=master) @@ -80,8 +80,8 @@ command: docker pull elasticsearch:2.4 --platform=linux/x86_64 -It is highly recommended that you alias `docker-compose` to `fig` (its original -name) and use it wherever `docker-compose` is used. You are going to have to +It is highly recommended that you alias `docker compose` to `fig` (its original +name) and use it wherever `docker compose` is used. You are going to have to type this command a lot. Then, clone this repo and set up the environment: @@ -101,10 +101,10 @@ These repositories are automatically mounted into the appropriate docker containers allowing the developer to use their preferred tools to work with the source code. -The `docker-compose up` command on its own will bring up the entire stack in the +The `docker compose up` command on its own will bring up the entire stack in the foreground (logs will be displayed). -The `docker-compose up` command will also fetch the official container images +The `docker compose up` command will also fetch the official container images from [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) repositories. @@ -115,7 +115,7 @@ Docker) and run the services. Don't forget to seed the local `metacpan-api` with a partial CPAN; run the following command in a separate terminal to get yourself up to speed: - docker-compose exec api index-cpan.sh + docker compose exec api index-cpan.sh This will prompt you to confirm removing old indices and setting up mappings on the Elasticsearch service (say `YES`). It will then proceed to rsync a partial @@ -128,7 +128,7 @@ elsewhere. Alternatively, if you just want to hack on the web frontend, you can run this instead of all the above: - docker-compose up web + docker compose up web From here, you can proceed and hack on the MetaCPAN code at `src/metacpan-api` and/or `src/metacpan-web` directories, and saving edits will reload the @@ -137,7 +137,7 @@ corresponding apps automatically! When done hacking (or, more likely, when you need to rebuild/refresh your Docker environment) you can then run - docker-compose down + docker compose down in another terminal to stop all MetaCPAN services and remove the containers. @@ -150,26 +150,26 @@ For further details, read on! You can (re)build arbitrary containers. For instance, if you want to rebuild the `api` container: - docker-compose build api + docker compose build api ### Accessing Containers -Containers are accessible via the `docker-compose exec` command followed by the +Containers are accessible via the `docker compose exec` command followed by the container and then the command to execute. For example, to start a shell prompt in the `api` container: - docker-compose exec api /bin/bash + docker compose exec api /bin/bash Executing tests via `prove` inside the API container: - docker-compose exec api_test prove -lvr \ + docker compose exec api_test prove -lvr \ t/00_setup.t \ t/01_darkpan.t \ t/api/controller/cover.t To access the `psql` command line client in the PostgreSQL container: - docker-compose exec pgdb psql + docker compose exec pgdb psql ### Accessing Services @@ -217,11 +217,11 @@ directly. They are available via the `api` and `api_test` containers. You can query the `elasticsearch` container via: - docker-compose exec elasticsearch curl http://localhost:9200 + docker compose exec elasticsearch curl http://localhost:9200 You can query the `elasticsearch_test` container via: - docker-compose exec elasticsearch_test curl http://localhost:9200 + docker compose exec elasticsearch_test curl http://localhost:9200 #### `PostgreSQL` @@ -267,13 +267,13 @@ These services use one or more Docker volumes: [4]: https://metacpan.org/pod/Carton Docker Compose is used to, uh, _compose_ them all together into one system. -Using `docker-compose` directly is a mouthful, however, so putting this all +Using `docker compose` directly is a mouthful, however, so putting this all together is done via the `bin/metacpan-docker` script to simplify setup and usage (and to get you started hacking on the MetaCPAN sooner!) ### The `bin/metacpan-docker` script -`bin/metacpan-docker` is a thin wrapper around the `docker-compose` command, +`bin/metacpan-docker` is a thin wrapper around the `docker compose` command, providing the environment variables necessary to run a basic MetaCPAN environment. It provides these subcommands: @@ -281,7 +281,7 @@ environment. It provides these subcommands: The `init` subcommand basically clones the [metacpan-api][5] and [metacpan-web][6] repositories, and sets up the git commit hooks for each of -them, in preparation for future `docker-compose` or +them, in preparation for future `docker compose` or `bin/metacpan-docker localapi` commands. It also clones the `metacpan-grep-front-end` and `metacpan-cpan-extracted-lite` @@ -292,12 +292,12 @@ repositories. #### `bin/metacpan localapi` -The `localapi` subcommand adds the necessary configuration for `docker-compose` +The `localapi` subcommand adds the necessary configuration for `docker compose` to run both the `metacpan-web` and `metacpan-api` services, along with `elasticsearch` and Docker volumes. Under the hood, it customizes the `COMPOSE_FILE` and `COMPOSE_PROJECT_NAME` environment variables used by -`docker-compose` to use additional YAML configuration files aside from the -default `docker-compose.yml`. +`docker compose` to use additional YAML configuration files aside from the +default `docker compose.yml`. #### `bin/metacpan-docker pull` @@ -314,8 +314,8 @@ command. #### `bin/metacpan-docker` build/up/down/start/stop/run/ps/top... As noted earlier, `bin/metacpan-docker` is a thin wrapper around -`docker-compose`, so commands like `up`, `down`, and `run` will work as expected -from `docker-compose`. See the [docker-compose docs][7] for an overview of +`docker compose`, so commands like `up`, `down`, and `run` will work as expected +from `docker compose`. See the [docker compose docs][7] for an overview of available commands. [7]: @@ -329,8 +329,8 @@ The `web` service is a checkout of `metacpan-web`, built as a Docker image. Running this service alone is enough if you want to just hack on the frontend, since by default the service is configured to talk to [https://fastapi.metacpan.org](https://fastapi.metacpan.org) for its backend; if -this is what you want, then you can simply invoke `docker-compose up` or -`docker-compose up web`. +this is what you want, then you can simply invoke `docker compose up` or +`docker compose up web`. #### `api` @@ -396,7 +396,7 @@ the [metacpan-puppet][10] repository. The `api` service depends on the ### Running your own miniCPAN inside metacpan-docker Suppose you have a local minicpan in `/home/ftp/pub/CPAN`. If you would like to -use this in `metacpan-docker`, then edit the `docker-compose.localapi.yml` to +use this in `metacpan-docker`, then edit the `docker compose.localapi.yml` to change the `api` service's volume mounts to use your local minicpan as `/CPAN`, e.g.: @@ -450,7 +450,7 @@ You can use `bin/metacpan-docker pull` to update all `src/*` directories. ### Running Kibana to peek into Elasticsearch data -By default, the `docker-compose.localapi.yml` configures the `elasticsearch` +By default, the `docker compose.localapi.yml` configures the `elasticsearch` service to listen on the Docker host at [http://localhost:9200](http://localhost:9200), and is also accessible via the Docker `default` network address of From 028feef1bba47cfb61ac04fa82a02119d8fb35a3 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Mon, 9 Sep 2024 22:27:47 -0400 Subject: [PATCH 116/141] Updat econfigs/metacpan-api/metacpan_server_testing.conf --- configs/metacpan-api/metacpan_server_testing.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configs/metacpan-api/metacpan_server_testing.conf b/configs/metacpan-api/metacpan_server_testing.conf index 1600860..396826d 100644 --- a/configs/metacpan-api/metacpan_server_testing.conf +++ b/configs/metacpan-api/metacpan_server_testing.conf @@ -1,6 +1,15 @@ cpan var/t/tmp/fakecpan +die_on_error 1 +level warn source_base var/t/tmp/source +elasticsearch_servers = elasticsearch_test:9200 + + + class Log::Log4perl::Appender::Screen + name testing + + servers __ENV(ES)__ From 74f5ddbffeb8dd320c74e0d034ef7cbc7fe0fe23 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Thu, 19 Sep 2024 11:21:01 -0400 Subject: [PATCH 117/141] Remove api and web configs Use the configs in the respective repos. I'm not sure why this was done, but this setup makes it very easy for the configs to get out of sync. Since we are not using docker compose in production, I don't think we should make the config file setup any more complicated it needs to be. --- configs/metacpan-api/metacpan.pl | 23 ----------- configs/metacpan-api/metacpan_server.conf | 25 ------------ .../metacpan-api/metacpan_server_testing.conf | 40 ------------------- configs/metacpan-web/metacpan_web_local.conf | 8 ---- docker-compose.yml | 28 ------------- 5 files changed, 124 deletions(-) delete mode 100644 configs/metacpan-api/metacpan.pl delete mode 100644 configs/metacpan-api/metacpan_server.conf delete mode 100644 configs/metacpan-api/metacpan_server_testing.conf delete mode 100644 configs/metacpan-web/metacpan_web_local.conf diff --git a/configs/metacpan-api/metacpan.pl b/configs/metacpan-api/metacpan.pl deleted file mode 100644 index 8821e2e..0000000 --- a/configs/metacpan-api/metacpan.pl +++ /dev/null @@ -1,23 +0,0 @@ -# do not edit this file -# create etc/metacpan_local.pl instead -use FindBin; - -{ - # ElasticSearch instance, can be either a single server - # or an arrayref of servers - es => 'elasticsearch:9200', - # the port of the api server - port => '5000', - # log level - level => 'info', - # appender for Log4perl - # default layout is "%d %p{1} %c: %m{chomp}%n" - # can be overridden using the layout key - # defining logger in metacpan_local.pl will - # override and not append to this configuration - logger => [{ - class => 'Log::Log4perl::Appender::File', - filename => $FindBin::RealBin . '/../var/log/metacpan.log', - syswrite => 1, - }] -} diff --git a/configs/metacpan-api/metacpan_server.conf b/configs/metacpan-api/metacpan_server.conf deleted file mode 100644 index 1894643..0000000 --- a/configs/metacpan-api/metacpan_server.conf +++ /dev/null @@ -1,25 +0,0 @@ -git /usr/bin/git -cpan /CPAN -minion_dsn = postgresql://metacpan:metacpan@pgdb/minion_queue -secret = I wish I had one to keep - - - servers elasticsearch:9200 - - - - servers elasticsearch:9200 - - - - servers elasticsearch:9200 - - - - servers elasticsearch:9200 - - - - # required for server startup -- override this in metacpan_server_local.conf - private_key 59125ffc09413eed3f2a2c07a37c7a44b95633e2 - diff --git a/configs/metacpan-api/metacpan_server_testing.conf b/configs/metacpan-api/metacpan_server_testing.conf deleted file mode 100644 index 396826d..0000000 --- a/configs/metacpan-api/metacpan_server_testing.conf +++ /dev/null @@ -1,40 +0,0 @@ -cpan var/t/tmp/fakecpan -die_on_error 1 -level warn -source_base var/t/tmp/source - -elasticsearch_servers = elasticsearch_test:9200 - - - class Log::Log4perl::Appender::Screen - name testing - - - - servers __ENV(ES)__ - - - - servers __ENV(ES)__ - - - - servers __ENV(ES)__ - - - - captcha_class Captcha::Mock - private_key testing - - -github_key = foo -github_secret = bar - -secret weak - - - host smtp.fastmail.com - port 465 - username foo@metacpan.org - password seekrit - diff --git a/configs/metacpan-web/metacpan_web_local.conf b/configs/metacpan-web/metacpan_web_local.conf deleted file mode 100644 index 16dc12c..0000000 --- a/configs/metacpan-web/metacpan_web_local.conf +++ /dev/null @@ -1,8 +0,0 @@ -api = http://api:5000 -api_public = http://localhost:5000 -source_host = http://localhost:5000 -web_host = http://localhost:5001 - - - cache_dir = /var/tmp/templates - diff --git a/docker-compose.yml b/docker-compose.yml index 5f1d52f..86ae5e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,10 +74,6 @@ services: source: ./src/metacpan-web target: /metacpan-web # read_only: true - - type: bind - source: ./configs/metacpan-web/metacpan_web_local.conf - target: /metacpan-web/metacpan_web_local.conf - read_only: true ports: - "5001:5001" networks: @@ -118,18 +114,6 @@ services: - type: bind source: ./src/metacpan-api target: /metacpan-api - - type: bind - source: ./configs/metacpan-api/metacpan_server.conf - target: /metacpan-api/metacpan_server.conf - read_only: true - - type: bind - source: ./configs/metacpan-api/metacpan_server_testing.conf - target: /metacpan-api/metacpan_server_testing.conf - read_only: true - - type: bind - source: ./configs/metacpan-api/metacpan.pl - target: /metacpan-api/etc/metacpan.pl - read_only: true - type: bind source: ./bin/index-cpan.sh target: /bin/index-cpan.sh @@ -171,18 +155,6 @@ services: - type: bind source: ./src/metacpan-api target: /metacpan-api - - type: bind - source: ./configs/metacpan-api/metacpan_server.conf - target: /metacpan-api/metacpan_server.conf - read_only: true - - type: bind - source: ./configs/metacpan-api/metacpan_server_testing.conf - target: /metacpan-api/metacpan_server_testing.conf - read_only: true - - type: bind - source: ./configs/metacpan-api/metacpan.pl - target: /metacpan-api/etc/metacpan.pl - read_only: true - type: bind source: ./bin/index-cpan.sh target: /bin/index-cpan.sh From 6a34c33f0d17a68698b370eeab779aa5df3e28c9 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Sat, 21 Sep 2024 18:34:49 -0400 Subject: [PATCH 118/141] Consolidate env vars + fix minion under compose Since we're not deploying this, we can try to set environment variables in fewer places. --- .env | 17 +++++++++++--- docker-compose.yml | 25 ++++++++++++--------- localapi.env | 9 -------- pg/docker-entrypoint-initdb.d/100-roles.sql | 2 +- 4 files changed, 29 insertions(+), 24 deletions(-) delete mode 100644 localapi.env diff --git a/.env b/.env index 074398d..854abd3 100644 --- a/.env +++ b/.env @@ -1,4 +1,15 @@ -COMPOSE_PROJECT_NAME=metacpan +API_SERVER="morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose" +COLUMNS=80 +ES=elasticsearch:9200 +ES_TEST=elasticsearch_test:9200 +MINICPAN=/CPAN +MOJO_MODE=development +NET_ASYNC_HTTP_MAXCONNS=1 +PERL_CARTON_PATH=/carton +PERL_MM_USE_DEFAULT=1 +PG_DATABASE=metacpan +PG_HOST=pghost +PG_PASSWORD=t00lchain +PG_PORT=5432 +PG_USER=metacpan PLACK_ENV=development -PGDB=pgdb:5432 -API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose diff --git a/docker-compose.yml b/docker-compose.yml index 5f1d52f..9d961a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ --- - +x-project: + name: metacpan # ____ _____ ______ _____ ____ _____ ____ # / ___|| ____| _ \ \ / /_ _/ ___| ____/ ___| # \___ \| _| | |_) \ \ / / | | | | _| \___ \ @@ -100,16 +101,18 @@ services: api: depends_on: - elasticsearch - - pgdb + - pghost - traefik image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api + # put variables for compose inside a .env file + # use env_file for variables to be set inside the container env_file: - - localapi.env + - .env command: > /metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" -- - /metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} -- + /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -154,7 +157,7 @@ services: api_test: depends_on: - elasticsearch_test - - pgdb + - pghost image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -162,7 +165,7 @@ services: - localapi_test.env command: > /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" -- - /metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} -- + /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -315,8 +318,8 @@ services: # |_| |___/ |_| # - pgdb: - hostname: pgdb + pghost: + hostname: pghost image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" build: context: "./pg" @@ -324,7 +327,7 @@ services: PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}" environment: POSTGRES_PASSWORD: metacpan - POSTGRES_USERNAME: metacpan123 + POSTGRES_USER: metacpan123 POSTGRES_DB: metacpan networks: - database @@ -336,7 +339,7 @@ services: test: ["CMD", "/healthcheck.sh"] volumes: - type: volume - source: pgdb-data + source: pghost-data target: /var/lib/postgresql/data - type: bind source: ./pg/docker-entrypoint-initdb.d @@ -373,6 +376,6 @@ volumes: cpan: elasticsearch: elasticsearch_test: - pgdb-data: + pghost-data: metacpan_git_shared: external: true diff --git a/localapi.env b/localapi.env deleted file mode 100644 index 97514a8..0000000 --- a/localapi.env +++ /dev/null @@ -1,9 +0,0 @@ -NET_ASYNC_HTTP_MAXCONNS=1 -COLUMNS=80 -ES=elasticsearch:9200 -ES_TEST=elasticsearch_test:9200 -ES_TEST=elasticsearch_test:9200 -MINICPAN=/CPAN -PERL_MM_USE_DEFAULT=1 -PERL_CARTON_PATH=/carton -MOJO_MODE=development diff --git a/pg/docker-entrypoint-initdb.d/100-roles.sql b/pg/docker-entrypoint-initdb.d/100-roles.sql index 6094210..867939c 100644 --- a/pg/docker-entrypoint-initdb.d/100-roles.sql +++ b/pg/docker-entrypoint-initdb.d/100-roles.sql @@ -1,4 +1,4 @@ -CREATE ROLE metacpan WITH LOGIN PASSWORD 'metacpan'; +CREATE ROLE metacpan WITH LOGIN PASSWORD 't00lchain'; CREATE ROLE "metacpan-api" WITH LOGIN; -- make things easier for when we're poking around from inside the container From 6b776cccc16e5259db6d1f94d2034cb8763a1e6d Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Mon, 23 Sep 2024 20:51:45 -0400 Subject: [PATCH 119/141] Remove traefik This is adding an extra (unneeded) layer of complexity to the dev environment. It's simpler to use ports than having to add hostnames to your system config and also having to troubleshoot traefik. --- docker-compose.yml | 50 ---------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 37af12b..0f3c2fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,32 +9,6 @@ x-project: # services: - # __ _____ __ - # / /__________ ____ / __(_) /__ - # / __/ ___/ __ `/ _ \/ /_/ / //_/ __ - # / /_/ / / /_/ / __/ __/ / ,< _| =\__ - # \__/_/ \__,_/\___/_/ /_/_/|_| /o____o_\ - - traefik: - # The official v2.4.5 Traefik docker image - image: traefik:v2.4.5 - networks: - - traefik-network - # Enables the web UI and tells Traefik to listen to docker - command: - - "--api.insecure=true" - - "--providers.docker" - # Do not expose containers unless explicitly told so - - "--providers.docker.exposedbydefault=false" - ports: - # The HTTP port - - "80:80" - # The Web UI (enabled by --api.insecure=true) - - "8080:8080" - volumes: - # So that Traefik can listen to the Docker events - - /var/run/docker.sock:/var/run/docker.sock - # _ _ # | | ___ __ _ ___ _ __ ___ _ _| |_ # | |/ _ \ / _` / __| '_ \ / _ \| | | | __| @@ -62,8 +36,6 @@ services: # web: - depends_on: - - traefik image: metacpan/metacpan-web:latest build: context: ./src/metacpan-web @@ -79,12 +51,6 @@ services: - "5001:5001" networks: - web-network - - traefik-network - labels: - - "traefik.enable=true" - - "traefik.docker.network=traefik-network" - - "traefik.http.routers.web.rule=Host(`web.metacpan.localhost`)" - - "traefik.http.services.web.loadbalancer.server.port=5001" # _ # __ _ _ __ (_) @@ -98,7 +64,6 @@ services: depends_on: - elasticsearch - pghost - - traefik image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -130,13 +95,7 @@ services: networks: - database - elasticsearch - - traefik-network - web-network - labels: - - "traefik.enable=true" - - "traefik.docker.network=traefik-network" - - "traefik.http.routers.api.rule=Host(`api.metacpan.localhost`)" - - "traefik.http.services.api.loadbalancer.server.port=5000" api_test: depends_on: @@ -195,8 +154,6 @@ services: # |___/ |_| grep: - depends_on: - - traefik image: metacpan/metacpan-grep-front-end:latest build: context: ./src/metacpan-grep-front-end @@ -211,12 +168,6 @@ services: read_only: true env_file: - grep.env - networks: - - traefik-network - labels: - - "traefik.enable=true" - - "traefik.http.routers.grep.rule=Host(`grep.metacpan.localhost`)" - - "traefik.http.services.grep-web.loadbalancer.server.port=3000" # ____ _ _____ _ ____ _ ____ _____ ____ # | _ \ / \|_ _|/ \ | __ ) / \ / ___|| ____/ ___| @@ -332,7 +283,6 @@ services: networks: database: elasticsearch: - traefik-network: web-network: # __ _____ _ _ _ __ __ _____ ____ From 9bfddb42b3482a63558559faf3e3928516bceef4 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Mon, 7 Oct 2024 22:36:59 -0400 Subject: [PATCH 120/141] web now exposes port 80 rather than 5001 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0f3c2fd..9964b39 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,7 +48,7 @@ services: target: /metacpan-web # read_only: true ports: - - "5001:5001" + - "5001:80" networks: - web-network From c356cc6fd1389e9ba5fe2e15fa647276f0af75d8 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Mon, 7 Oct 2024 22:49:31 -0400 Subject: [PATCH 121/141] Get debug logging in web container by default --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 9964b39..97d970c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,6 +51,8 @@ services: - "5001:80" networks: - web-network + environment: + - PLACK_ENV=development # _ # __ _ _ __ (_) From 963f35260bb21c347064984f19f566441d0386ca Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 10 Oct 2024 11:03:24 +0200 Subject: [PATCH 122/141] include web docker-compose file Rather than having an entirely separate configuration for metacpan-web, include its docker-compose.yml file, but with some overrides. --- compose/web.yml | 6 ++++++ docker-compose.yml | 32 +++++--------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) create mode 100644 compose/web.yml diff --git a/compose/web.yml b/compose/web.yml new file mode 100644 index 0000000..f85588b --- /dev/null +++ b/compose/web.yml @@ -0,0 +1,6 @@ +services: + web-server: + ports: + - "5001:80" + networks: + - web-network diff --git a/docker-compose.yml b/docker-compose.yml index 97d970c..1e14c98 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,11 @@ x-project: # |____/|_____|_| \_\ \_/ |___\____|_____|____/ # +include: + - path: + - src/metacpan-web/docker-compose.yml + - compose/web.yml + services: # _ _ # | | ___ __ _ ___ _ __ ___ _ _| |_ @@ -28,32 +33,6 @@ services: ports: - "8100:80" - # _ - # __ _____| |__ - # \ \ /\ / / _ \ '_ \ - # \ V V / __/ |_) | - # \_/\_/ \___|_.__/ - # - - web: - image: metacpan/metacpan-web:latest - build: - context: ./src/metacpan-web - volumes: - - type: volume - source: web_carton - target: /carton - - type: bind - source: ./src/metacpan-web - target: /metacpan-web - # read_only: true - ports: - - "5001:80" - networks: - - web-network - environment: - - PLACK_ENV=development - # _ # __ _ _ __ (_) # / _` | '_ \| | @@ -295,7 +274,6 @@ networks: # volumes: - web_carton: api_carton: cpan: elasticsearch: From 6cd73139cc3da4aa6e13c2bae0ef7e4b0b121a34 Mon Sep 17 00:00:00 2001 From: Cesar Tessarin Date: Fri, 11 Oct 2024 15:40:08 -0300 Subject: [PATCH 123/141] Enable prompts from IO::Prompt::Tiny When the environment variable PERL_MM_USE_DEFAULT is set to true, all code using IO::Prompt::Tiny becomes non-functional. This specifically affects two locations: - metacpan-api: MetaCPAN::Role::Script::are_you_sure - metacpan-ingest: MetaCPAN::Ingest::are_you_sure Both prompt users for confirmation before critical operations. They set no default answer and perform a string equality test to 'YES' to proceed. Without a default value, PERL_MM_USE_DEFAULT causes these prompts to return an empty string, failing the confirmation check and rendering the prompt useless. This commit resolves the issue. --- .env | 1 - localapi_test.env | 1 - 2 files changed, 2 deletions(-) diff --git a/.env b/.env index 854abd3..6536994 100644 --- a/.env +++ b/.env @@ -6,7 +6,6 @@ MINICPAN=/CPAN MOJO_MODE=development NET_ASYNC_HTTP_MAXCONNS=1 PERL_CARTON_PATH=/carton -PERL_MM_USE_DEFAULT=1 PG_DATABASE=metacpan PG_HOST=pghost PG_PASSWORD=t00lchain diff --git a/localapi_test.env b/localapi_test.env index 1f49954..e899080 100644 --- a/localapi_test.env +++ b/localapi_test.env @@ -6,6 +6,5 @@ HARNESS_ACTIVE=1 # Instantiate Catalyst models using metacpan_server_testing.conf METACPAN_SERVER_CONFIG_LOCAL_SUFFIX=testing MINICPAN=/CPAN -PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton MOJO_MODE=testing From 0f907dfcd60ce2804ad25326b5eff235ead5c84a Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 15 Oct 2024 19:23:06 -0400 Subject: [PATCH 124/141] specify image name for web-server Fixes "docker compose pull" --- compose/web.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/compose/web.yml b/compose/web.yml index f85588b..445b0bb 100644 --- a/compose/web.yml +++ b/compose/web.yml @@ -1,5 +1,6 @@ services: web-server: + image: metacpan/metacpan-web:latest ports: - "5001:80" networks: From 1bea9753c585f3b772887cfd7f9d210634c852f1 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 15 Oct 2024 19:52:27 -0400 Subject: [PATCH 125/141] Remove logspout This seems to be configured to send logs to Honeycomb.io in production, but we aren't going to be deploying via compose. --- docker-compose.yml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1e14c98..6a35324 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,25 +14,6 @@ include: - compose/web.yml services: - # _ _ - # | | ___ __ _ ___ _ __ ___ _ _| |_ - # | |/ _ \ / _` / __| '_ \ / _ \| | | | __| - # | | (_) | (_| \__ \ |_) | (_) | |_| | |_ - # |_|\___/ \__, |___/ .__/ \___/ \__,_|\__| - # |___/ |_| - # - - logspout: - image: honeycombio/logspout-honeycomb:1.13 - volumes: - - type: bind - source: /var/run/docker.sock - target: /var/run/docker.sock - env_file: - - logging.env - ports: - - "8100:80" - # _ # __ _ _ __ (_) # / _` | '_ \| | From eabc6b9cabacde9d1a46d3a3e4ded65261c54dea Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 15 Oct 2024 19:53:56 -0400 Subject: [PATCH 126/141] tidy Docker config --- compose/web.yml | 1 + docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compose/web.yml b/compose/web.yml index 445b0bb..1f490a9 100644 --- a/compose/web.yml +++ b/compose/web.yml @@ -1,3 +1,4 @@ +--- services: web-server: image: metacpan/metacpan-web:latest diff --git a/docker-compose.yml b/docker-compose.yml index 6a35324..fa670f2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,8 @@ x-project: include: - path: - - src/metacpan-web/docker-compose.yml - - compose/web.yml + - src/metacpan-web/docker-compose.yml + - compose/web.yml services: # _ From b55126b3e2222c527d40b02e3847e51180776bb1 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 15 Oct 2024 20:45:12 -0400 Subject: [PATCH 127/141] Use compose profiles This allows us to do things like: docker compose --profile test up docker compose --profile dev up --- .circleci/config.yml | 23 ++++++++--------------- README.md | 13 +++++++------ docker-compose.yml | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0a92c0d..b933d65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,6 @@ -# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference +--- +# Use the latest 2.1 version of CircleCI pipeline process engine. See: +# https://circleci.com/docs/2.0/configuration-reference version: 2.1 # Orchestrate or schedule a set of jobs workflows: @@ -8,17 +10,8 @@ workflows: jobs: build-and-test: machine: true - resource_class: medium + resource_class: large steps: - # CircleCI has its own docker-compose already installed, but as of this writing, their version is too old to understand our docker-compose.yml - - run: - name: Install Docker Compose - command: | - set -x - curl -L https://github.com/docker/compose/releases/download/1.26.2/docker-compose-`uname -s`-`uname -m` > /home/circleci/bin/docker-compose - sudo chmod +x /home/circleci/bin/docker-compose - which docker-compose - docker-compose --version - checkout - run: command: | @@ -26,7 +19,7 @@ jobs: name: clone missing repositories - run: command: | - docker-compose --verbose up -d api_test + docker-compose --verbose --profile test up -d name: compose up # Since we're running docker-compose -d, we don't actually know if # Elasticsearch is available at the time this build step begins. We @@ -38,12 +31,12 @@ jobs: - run: name: Run complete MetaCPAN API Test Suite command: | - docker-compose exec -T api_test prove -lr --jobs 2 t - docker-compose down + docker-compose --profile test exec -T api_test prove -lr --jobs 4 t + docker-compose --profile test down - run: name: Show Docker container logs on Error command: | - docker-compose logs + docker-compose --profile test logs docker stats --no-stream docker ps -a | head when: on_fail diff --git a/README.md b/README.md index 6d6daee..2363ef6 100644 --- a/README.md +++ b/README.md @@ -101,11 +101,12 @@ These repositories are automatically mounted into the appropriate docker containers allowing the developer to use their preferred tools to work with the source code. -The `docker compose up` command on its own will bring up the entire stack in the -foreground (logs will be displayed). +The `docker compose --profile dev up` command on its own will bring up the +entire stack in the foreground (logs will be displayed). -The `docker compose up` command will also fetch the official container images -from [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) +The `docker compose --profile dev up` command will also fetch the official +container images from +[MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list) repositories. This will build the Docker containers for MetaCPAN, PostgreSQL and Elasticsearch @@ -128,7 +129,7 @@ elsewhere. Alternatively, if you just want to hack on the web frontend, you can run this instead of all the above: - docker compose up web + docker compose up web-server From here, you can proceed and hack on the MetaCPAN code at `src/metacpan-api` and/or `src/metacpan-web` directories, and saving edits will reload the @@ -137,7 +138,7 @@ corresponding apps automatically! When done hacking (or, more likely, when you need to rebuild/refresh your Docker environment) you can then run - docker compose down + docker compose --profile dev down in another terminal to stop all MetaCPAN services and remove the containers. diff --git a/docker-compose.yml b/docker-compose.yml index fa670f2..b0bb40f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,8 @@ services: # api: + profiles: + - dev depends_on: - elasticsearch - pghost @@ -60,6 +62,8 @@ services: - web-network api_test: + profiles: + - test depends_on: - elasticsearch_test - pghost @@ -94,6 +98,9 @@ services: - elasticsearch ingest: + profiles: + - dev + - ingest image: metacpan/metacpan-ingest:latest volumes: - type: volume @@ -116,6 +123,8 @@ services: # |___/ |_| grep: + profiles: + - grep image: metacpan/metacpan-grep-front-end:latest build: context: ./src/metacpan-grep-front-end @@ -146,6 +155,9 @@ services: # elasticsearch: + profiles: + - dev + - ingest image: elasticsearch:2.4 volumes: - type: volume @@ -178,6 +190,8 @@ services: # elasticsearch_test: + profiles: + - test image: elasticsearch:2.4 volumes: - type: volume @@ -204,6 +218,9 @@ services: # pghost: + profiles: + - dev + - test hostname: pghost image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" build: From a21ea7017efc466e39db6aa58cd25fcb1d307e85 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 15 Oct 2024 22:51:15 -0400 Subject: [PATCH 128/141] wait for Pg first It should be available before Elasticsearch --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b0bb40f..1aa1e81 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,8 +36,8 @@ services: env_file: - .env command: > - /metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" -- /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- + /metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -73,8 +73,8 @@ services: env_file: - localapi_test.env command: > - /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" -- /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- + /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" -- ${API_SERVER} ./bin/api.pl volumes: - type: volume From 1fc094eeaa9befba3d44b65b8eca9e8989f705db Mon Sep 17 00:00:00 2001 From: Cesar Tessarin Date: Fri, 18 Oct 2024 09:11:07 -0300 Subject: [PATCH 129/141] Add missing index file on partial CPAN One of the local operations commonly used for testing the API, performed by `bin/metacpan author`, requires the find-ls.gz file, which was not included in the default partial CPAN. By adding this file to the loading script, testing becomes easier and eliminates the need for manual intervention to include the index. --- bin/partial-cpan-mirror.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/partial-cpan-mirror.sh b/bin/partial-cpan-mirror.sh index d901723..233b344 100755 --- a/bin/partial-cpan-mirror.sh +++ b/bin/partial-cpan-mirror.sh @@ -16,3 +16,4 @@ $RSYNC $PATH/authors/0* $MINICPAN/ $RSYNC $PATH/modules/0* $MINICPAN/ $RSYNC $PATH/indices/mirrors.json $MINICPAN/ +$RSYNC $PATH/indices/find-ls.gz $MINICPAN/ From f215ea5369fb3cbec1bd9a52ceff81de12c87224 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 22 Oct 2024 21:25:38 -0400 Subject: [PATCH 130/141] Revert "specify image name for web-server" --- compose/web.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/compose/web.yml b/compose/web.yml index 1f490a9..72ceb0e 100644 --- a/compose/web.yml +++ b/compose/web.yml @@ -1,7 +1,6 @@ --- services: web-server: - image: metacpan/metacpan-web:latest ports: - "5001:80" networks: From 9c8965be6b4f20de324afe68640da241308bbbbc Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Tue, 22 Oct 2024 21:16:28 -0400 Subject: [PATCH 131/141] Add a cloud-es full-stack profile This allows us to test a full stack environment with a cloud-based elasticsearch --- compose/web.yml | 2 ++ docker-compose.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/compose/web.yml b/compose/web.yml index 72ceb0e..f6becf1 100644 --- a/compose/web.yml +++ b/compose/web.yml @@ -1,6 +1,8 @@ --- services: web-server: + profiles: + - cloud-es ports: - "5001:80" networks: diff --git a/docker-compose.yml b/docker-compose.yml index 1aa1e81..648cf1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,41 @@ services: # |_| # + cloud_api: + profiles: + - cloud-es + depends_on: + - pghost + image: metacpan/metacpan-api:latest + build: + context: ./src/metacpan-api + # put variables for compose inside a .env file + # use env_file for variables to be set inside the container + env_file: + - .env + command: > + /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- + ${API_SERVER} ./bin/api.pl + volumes: + - type: volume + source: cpan + target: /CPAN + - type: bind + source: ./src/metacpan-api + target: /metacpan-api + - type: bind + source: ./bin/index-cpan.sh + target: /bin/index-cpan.sh + read_only: true + - type: bind + source: ./bin/partial-cpan-mirror.sh + target: /bin/partial-cpan-mirror.sh + read_only: true + ports: + - "5000:5000" + networks: + - database + - web-network api: profiles: - dev @@ -219,6 +254,7 @@ services: pghost: profiles: + - cloud-es - dev - test hostname: pghost From 1209167b51e9f3139b3b021f012b56ac05c56f58 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 25 Oct 2024 11:17:49 +0200 Subject: [PATCH 132/141] remove no longer used Elasticsearch scripts --- docker-compose.yml | 8 -------- .../scripts/prefer_shorter_module_names_100.groovy | 1 - .../scripts/prefer_shorter_module_names_400.groovy | 2 -- elasticsearch/scripts/score_version_numified.groovy | 1 - elasticsearch/scripts/status_is_latest.groovy | 1 - 5 files changed, 13 deletions(-) delete mode 100644 elasticsearch/scripts/prefer_shorter_module_names_100.groovy delete mode 100644 elasticsearch/scripts/prefer_shorter_module_names_400.groovy delete mode 100644 elasticsearch/scripts/score_version_numified.groovy delete mode 100644 elasticsearch/scripts/status_is_latest.groovy diff --git a/docker-compose.yml b/docker-compose.yml index 1aa1e81..b0ecc4f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -167,10 +167,6 @@ services: source: ./elasticsearch/metacpan.yml target: /usr/share/elasticsearch/config/metacpan.yml read_only: true - - type: bind - source: ./elasticsearch/scripts - target: /usr/share/elasticsearch/config/scripts - read_only: true ports: - "9200" networks: @@ -201,10 +197,6 @@ services: source: ./elasticsearch/test.yml target: /usr/share/elasticsearch/config/test.yml read_only: true - - type: bind - source: ./elasticsearch/scripts - target: /usr/share/elasticsearch/config/scripts - read_only: true ports: - "9200" networks: diff --git a/elasticsearch/scripts/prefer_shorter_module_names_100.groovy b/elasticsearch/scripts/prefer_shorter_module_names_100.groovy deleted file mode 100644 index f99da4d..0000000 --- a/elasticsearch/scripts/prefer_shorter_module_names_100.groovy +++ /dev/null @@ -1 +0,0 @@ -_score - doc.documentation.value.length().toDouble()/100; \ No newline at end of file diff --git a/elasticsearch/scripts/prefer_shorter_module_names_400.groovy b/elasticsearch/scripts/prefer_shorter_module_names_400.groovy deleted file mode 100644 index 04c787b..0000000 --- a/elasticsearch/scripts/prefer_shorter_module_names_400.groovy +++ /dev/null @@ -1,2 +0,0 @@ -len = (doc.documentation.empty ? 26 : doc.documentation.value.length()); -_score - len.toDouble()/400; \ No newline at end of file diff --git a/elasticsearch/scripts/score_version_numified.groovy b/elasticsearch/scripts/score_version_numified.groovy deleted file mode 100644 index 65032ea..0000000 --- a/elasticsearch/scripts/score_version_numified.groovy +++ /dev/null @@ -1 +0,0 @@ -doc.module.version_numified.value; \ No newline at end of file diff --git a/elasticsearch/scripts/status_is_latest.groovy b/elasticsearch/scripts/status_is_latest.groovy deleted file mode 100644 index ac7ba92..0000000 --- a/elasticsearch/scripts/status_is_latest.groovy +++ /dev/null @@ -1 +0,0 @@ -doc.status.value == 'latest'; \ No newline at end of file From e7645d6e5512330362234f38214012dcf0b15448 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 28 Oct 2024 01:27:10 +0100 Subject: [PATCH 133/141] configure elasticsearch using environment The elasticsearch docker images accept configuration via the environment. This is easier than adding config files to the image, which as far as I can tell don't get used. --- docker-compose.yml | 12 ++++-------- elasticsearch/metacpan.yml | 29 ----------------------------- elasticsearch/test.yml | 29 ----------------------------- 3 files changed, 4 insertions(+), 66 deletions(-) delete mode 100644 elasticsearch/metacpan.yml delete mode 100644 elasticsearch/test.yml diff --git a/docker-compose.yml b/docker-compose.yml index 05ee833..07f43ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -194,14 +194,12 @@ services: - dev - ingest image: elasticsearch:2.4 + environment: + - discovery.type=single-node volumes: - type: volume source: elasticsearch target: /usr/share/elasticsearch/data - - type: bind - source: ./elasticsearch/metacpan.yml - target: /usr/share/elasticsearch/config/metacpan.yml - read_only: true ports: - "9200" networks: @@ -224,14 +222,12 @@ services: profiles: - test image: elasticsearch:2.4 + environment: + - discovery.type=single-node volumes: - type: volume source: elasticsearch_test target: /usr/share/elasticsearch/data - - type: bind - source: ./elasticsearch/test.yml - target: /usr/share/elasticsearch/config/test.yml - read_only: true ports: - "9200" networks: diff --git a/elasticsearch/metacpan.yml b/elasticsearch/metacpan.yml deleted file mode 100644 index 8eafdd9..0000000 --- a/elasticsearch/metacpan.yml +++ /dev/null @@ -1,29 +0,0 @@ -cluster.name: 'dev' - -index: - number_of_replicas: 0 - number_of_shards: 1 - search: - slowlog: - threshold: - query: - warn: 10s - info: 2s - fetch: - warn: 1s - -gateway: - recover_after_nodes: 1 - recover_after_time: 3m - expected_nodes: 1 - -node: - max_local_storage_nodes: 1 - -discovery: - zen: - minimum_master_nodes: 1 - ping: - multicast.enabled: false - unicast.hosts: - - "elasticsearch:9300" diff --git a/elasticsearch/test.yml b/elasticsearch/test.yml deleted file mode 100644 index 8fa6cd5..0000000 --- a/elasticsearch/test.yml +++ /dev/null @@ -1,29 +0,0 @@ -cluster.name: 'dev-test' - -index: - number_of_replicas: 0 - number_of_shards: 1 - search: - slowlog: - threshold: - query: - warn: 10s - info: 2s - fetch: - warn: 1s - -gateway: - recover_after_nodes: 1 - recover_after_time: 2m - expected_nodes: 1 - -node: - max_local_storage_nodes: 1 - -discovery: - zen: - minimum_master_nodes: 1 - ping: - multicast.enabled: false - unicast.hosts: - - "elasticsearch_test:9300" From 4d030b5fc516c1bd4d7e11996e206e6083f1de05 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 28 Oct 2024 01:37:10 +0100 Subject: [PATCH 134/141] use health checks rather than custom scripts Rather than having scripts running in the consumer before loading, add a health check, and allow docker compose itself to control the initialization of dependent containers. --- docker-compose.yml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 07f43ea..42231fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,8 @@ services: profiles: - cloud-es depends_on: - - pghost + pghost: + condition: service_healthy image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -35,7 +36,6 @@ services: env_file: - .env command: > - /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -57,12 +57,15 @@ services: networks: - database - web-network + api: profiles: - dev depends_on: - - elasticsearch - - pghost + elasticsearch: + condition: service_healthy + pghost: + condition: service_healthy image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api @@ -71,8 +74,6 @@ services: env_file: - .env command: > - /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- - /metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -100,16 +101,16 @@ services: profiles: - test depends_on: - - elasticsearch_test - - pghost + elasticsearch_test: + condition: service_healthy + pghost: + condition: service_healthy image: metacpan/metacpan-api:latest build: context: ./src/metacpan-api env_file: - localapi_test.env command: > - /metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} -- - /metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" -- ${API_SERVER} ./bin/api.pl volumes: - type: volume @@ -200,6 +201,10 @@ services: - type: volume source: elasticsearch target: /usr/share/elasticsearch/data + healthcheck: + timeout: 5s + start_period: 60s + test: ["CMD", "curl", "--fail", "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s"] ports: - "9200" networks: @@ -228,6 +233,10 @@ services: - type: volume source: elasticsearch_test target: /usr/share/elasticsearch/data + healthcheck: + timeout: 5s + start_period: 60s + test: ["CMD", "curl", "--fail", "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s"] ports: - "9200" networks: From e88be061062dd5f6812dba87a1ae08ef721d9ff1 Mon Sep 17 00:00:00 2001 From: Mickey Nasriachi Date: Wed, 30 Oct 2024 10:42:21 +0100 Subject: [PATCH 135/141] Added ingest test profile Allows running the scripts with elasticsearch_test instance --- docker-compose.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 05ee833..08cad60 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,6 +99,7 @@ services: api_test: profiles: - test + - ingest-test depends_on: - elasticsearch_test - pghost @@ -150,6 +151,25 @@ services: networks: - elasticsearch + ingest-test: + profiles: + - ingest-test + image: metacpan/metacpan-ingest:latest + environment: + PLACK_ENV: development + volumes: + - type: volume + source: cpan + target: /CPAN + - type: bind + source: ./configs/metacpan-ingest/metacpan_ingest_local.conf + target: /metacpan-ingest/metacpan_ingest_local.conf + read_only: true + depends_on: + - elasticsearch_test + networks: + - elasticsearch + # __ _ _ __ ___ _ __ # / _` | '__/ _ \ '_ \ # | (_| | | | __/ |_) | @@ -223,6 +243,7 @@ services: elasticsearch_test: profiles: - test + - ingest-test image: elasticsearch:2.4 volumes: - type: volume @@ -249,6 +270,7 @@ services: - cloud-es - dev - test + - ingest-test hostname: pghost image: "postgres:${PG_VERSION_TAG:-9.6-alpine}" build: From 5faa3b690645866f6071ab541dddae921792639a Mon Sep 17 00:00:00 2001 From: Mickey Nasriachi Date: Thu, 1 May 2025 12:09:38 +0200 Subject: [PATCH 136/141] Add useful installation tips for a fresh system --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2363ef6..3516dd4 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ of things to be done better. Please use it and create Issues with your problems. ## Quick Start -Install [Docker][0] and [Docker Compose][1] for your platform. [Docker for +Install [Docker][0] and [Docker Compose][1] (v2+) for your platform. [Docker for Mac][2] or [Docker for Windows][3] will install both tools for you, if you are on either of these environments. @@ -60,6 +60,10 @@ on either of these environments. [2]: https://docs.docker.com/docker-for-mac/ [3]: https://docs.docker.com/docker-for-windows/ +On Debian / Ubuntu, install using: + + apt install docker-compose-v2 + On Linux, Docker's default implementation only allows `root` user access to Docker commands and to control containers. In order to allow a regular user to access docker follow the @@ -74,6 +78,10 @@ Docker BuildKit can be enabled by following the [Getting Started](https://docs.docker.com/build/buildkit/#getting-started) instructions. +On Debian / Ubuntu, install using: + + apt install buildx + If you are running a Mac ARM64 system, you will need to manually tell docker to use the x86_64 version of Elasticsearch 2.4. This can be done by running the command: From 3db28bad7de541f4144377c5ad524933c39e5099 Mon Sep 17 00:00:00 2001 From: Mickey Nasriachi Date: Thu, 1 May 2025 23:39:46 +0200 Subject: [PATCH 137/141] fix README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3516dd4..21d9a25 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ on either of these environments. On Debian / Ubuntu, install using: - apt install docker-compose-v2 + apt install docker-compose-v2 On Linux, Docker's default implementation only allows `root` user access to Docker commands and to control containers. In order to allow a regular user to @@ -80,7 +80,7 @@ instructions. On Debian / Ubuntu, install using: - apt install buildx + apt install docker-buildx If you are running a Mac ARM64 system, you will need to manually tell docker to use the x86_64 version of Elasticsearch 2.4. This can be done by running the From 17f88a7bdf2151d083fc52d5abc6b3574f559bcd Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Fri, 23 May 2025 23:24:41 +0200 Subject: [PATCH 138/141] Fix the order of instructions for initialization Following the steps for initialization, I had to kickstart the web server before I was able to browse through port 5001. Apparently, the web server isn't automatically started. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 21d9a25..7951bd7 100644 --- a/README.md +++ b/README.md @@ -130,15 +130,15 @@ This will prompt you to confirm removing old indices and setting up mappings on the Elasticsearch service (say `YES`). It will then proceed to rsync a partial CPAN in `/CPAN` for its metadata to be imported. -Once the above is done, you should be able to see your local partial CPAN data -in e.g. [http://localhost:5001/recent](http://localhost:5001/recent) and -elsewhere. - -Alternatively, if you just want to hack on the web frontend, you can run this -instead of all the above: +After the initialization above completes, the next step is to start the web +frontend with the following command: docker compose up web-server +Once that is done, you should be able to see your local partial CPAN data +in e.g. [http://localhost:5001/recent](http://localhost:5001/recent) and +elsewhere. + From here, you can proceed and hack on the MetaCPAN code at `src/metacpan-api` and/or `src/metacpan-web` directories, and saving edits will reload the corresponding apps automatically! From 2011e25a40061b314df78d824466607822ceb5f6 Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sat, 24 May 2025 00:22:07 +0200 Subject: [PATCH 139/141] Remove reference to traefik Since Traefik isn't used... --- README.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/README.md b/README.md index 7951bd7..5f20608 100644 --- a/README.md +++ b/README.md @@ -185,28 +185,6 @@ To access the `psql` command line client in the PostgreSQL container: Each container is responsible for a different service. Some of these services are available in the developer environment via ports on the host system. -We are using [traefik][13] to manage the traffic between services. The current -configuration is: - -- api: [http://api.metacpan.localhost](http://api.metacpan.localhost) -- web: [http://web.metacpan.localhost](http://web.metacpan.localhost) -- grep: [http://grep.metacpan.localhost](http://grep.metacpan.localhost) - -In order to access to the localhost subdomains, you probably have to manually -add these entries in you `/etc/hosts` file. - - # add to /etc/hosts - 127.0.0.1 api.metacpan.localhost - 127.0.0.1 gh.metacpan.localhost - 127.0.0.1 grep.metacpan.localhost - 127.0.0.1 metacpan.localhost - 127.0.0.1 web.metacpan.localhost - -You can access the dashboard configuration via: -[http://metacpan.localhost:8080](http://metacpan.localhost:8080) - -[0]: https://docs.traefik.io/providers/docker/ - #### `web` The local instance of the web front end is accessible via: From 69b77624dba3229ead3f789e85fa8de21b46388a Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sat, 24 May 2025 00:40:49 +0200 Subject: [PATCH 140/141] Expose grep container ports ... So the port number can be used in the README. --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 463cea7..854e883 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -182,6 +182,8 @@ services: profiles: - grep image: metacpan/metacpan-grep-front-end:latest + ports: + - "3000:3000" build: context: ./src/metacpan-grep-front-end volumes: From 6515045774d6f92c172e0f9f4fe898e41906af0d Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sat, 24 May 2025 00:58:25 +0200 Subject: [PATCH 141/141] Change "grep" access references --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f20608..8bf4b24 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,7 @@ The PostgreSQL service by default is only accessible from other containers. The grep metacpan front end is accessible via: -- [http://grep.metacpan.localhost](http://grep.metacpan.localhost) +- [http://localhost:3000](http://localhost:3000) Note: this is using a smaller, frozen version of `metacpan-cpan-extracted` via [metacpan-cpan-extracted-lite](https://github.com/metacpan/metacpan-cpan-extracted-lite).