Skip to content

Commit

Permalink
Merge pull request #355 from humanmade/backport-350-to-v8-branch
Browse files Browse the repository at this point in the history
[Backport v8-branch] Fix container names for Docker Compose 1.29.2
  • Loading branch information
roborourke authored Oct 6, 2021
2 parents bc7ca28 + 263338c commit 66b1721
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
networks:
- proxy
image: traefik:1.7
container_name: altis-proxy
volumes:
- "$PWD/conf/traefik.toml:/etc/traefik/traefik.toml"
- "$PWD/ssl.cert:/etc/traefik/ssl.cert"
Expand Down
3 changes: 2 additions & 1 deletion inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,10 @@ protected function exec( InputInterface $input, OutputInterface $output, ?string
}
}

$container_id = exec( sprintf( 'docker ps --filter name=%s_php_1 -q', $this->get_project_subdomain() ) );
$container_id = exec( sprintf( 'docker ps --filter name=%s-php -q', $this->get_project_subdomain() ) );
if ( ! $container_id ) {
$output->writeln( '<error>PHP container not found to run command.</>' );
$output->writeln( '<info>You may need to run `composer server start` again if you have recently updated Docker.</>' );
return 1;
}

Expand Down
20 changes: 19 additions & 1 deletion inc/composer/class-docker-compose-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ protected function get_php_reusable() : array {
*/
protected function get_service_php() : array {
return [
'php' => $this->get_php_reusable(),
'php' => array_merge(
[
'container_name' => "{$this->project_name}-php",
],
$this->get_php_reusable()
),
];
}

Expand All @@ -181,6 +186,7 @@ protected function get_service_cavalcade() : array {
return [
'cavalcade' => array_merge(
[
'container_name' => "{$this->project_name}-cavalcade",
'entrypoint' => [
'/usr/local/bin/cavalcade',
],
Expand All @@ -201,6 +207,7 @@ protected function get_service_nginx() : array {
return [
'nginx' => [
'image' => 'humanmade/altis-local-server-nginx:3.3.0',
'container_name' => "{$this->project_name}-nginx",
'networks' => [
'proxy',
'default',
Expand Down Expand Up @@ -241,6 +248,7 @@ protected function get_service_redis() : array {
return [
'redis' => [
'image' => 'redis:3.2-alpine',
'container_name' => "{$this->project_name}-redis",
'ports' => [
'6379',
],
Expand All @@ -257,6 +265,7 @@ protected function get_service_db() : array {
return [
'db' => [
'image' => 'mysql:5.7',
'container_name' => "{$this->project_name}-db",
'volumes' => [
'db-data:/var/lib/mysql',
],
Expand Down Expand Up @@ -298,6 +307,7 @@ protected function get_service_elasticsearch() : array {
return [
'elasticsearch' => [
'image' => 'humanmade/altis-local-server-elasticsearch:3.0.0',
'container_name' => "{$this->project_name}-es",
'ulimits' => [
'memlock' => [
'soft' => -1,
Expand Down Expand Up @@ -352,6 +362,7 @@ protected function get_service_kibana() : array {
return [
'kibana' => [
'image' => 'blacktop/kibana:6.3',
'container_name' => "{$this->project_name}-kibana",
'networks' => [
'proxy',
'default',
Expand Down Expand Up @@ -386,6 +397,7 @@ protected function get_service_s3() : array {
return [
's3' => [
'image' => 'minio/minio:RELEASE.2020-03-19T21-49-00Z',
'container_name' => "{$this->project_name}-s3",
'volumes' => [
's3:/data:rw',
],
Expand Down Expand Up @@ -427,6 +439,7 @@ protected function get_service_s3() : array {
],
's3-sync-to-host' => [
'image' => 'minio/mc:RELEASE.2020-03-14T01-23-37Z',
'container_name' => "{$this->project_name}-s3-sync",
'restart' => 'unless-stopped',
'depends_on' => [
's3',
Expand All @@ -452,6 +465,7 @@ protected function get_service_tachyon() : array {
return [
'tachyon' => [
'image' => 'humanmade/tachyon:2.3.2',
'container_name' => "{$this->project_name}-tachyon",
'ports' => [
'8080',
],
Expand Down Expand Up @@ -485,6 +499,7 @@ protected function get_service_mailhog() : array {
return [
'mailhog' => [
'image' => 'mailhog/mailhog:latest',
'container_name' => "{$this->project_name}-mailhog",
'ports' => [
'8025',
'1025',
Expand Down Expand Up @@ -514,6 +529,7 @@ protected function get_service_mailhog() : array {
protected function get_service_analytics() : array {
return [
'cognito' => [
'container_name' => "{$this->project_name}-cognito",
'ports' => [
'3000',
],
Expand All @@ -531,6 +547,7 @@ protected function get_service_analytics() : array {
],
],
'pinpoint' => [
'container_name' => "{$this->project_name}-pinpoint",
'ports' => [
'3000',
],
Expand Down Expand Up @@ -562,6 +579,7 @@ protected function get_service_xray() : array {
return [
'xray' => [
'image' => 'amazon/aws-xray-daemon:3.0.1',
'container_name' => "{$this->project_name}-xray",
'ports' => [
'2000',
],
Expand Down

0 comments on commit 66b1721

Please sign in to comment.