Skip to content

Commit

Permalink
Merge pull request #38 from humanmade/local-analytics
Browse files Browse the repository at this point in the history
Local analytics support
  • Loading branch information
joehoyle authored Jul 18, 2019
2 parents edfb34c + 49f3330 commit 23ee859
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
47 changes: 45 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ x-php: &php
S3_UPLOADS_REGION: not-needed
TACHYON_URL: https://${COMPOSE_PROJECT_NAME:-default}.altis.dev/tachyon
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
HM_ANALYTICS_PINPOINT_ENDPOINT: https://pinpoint-${COMPOSE_PROJECT_NAME:-default}.altis.dev
HM_ANALYTICS_COGNITO_ENDPOINT: https://cognito-${COMPOSE_PROJECT_NAME:-default}.altis.dev

x-analytics: &analytics
ports:
- "3000"
networks:
- proxy
- default
restart: on-failure

services:
db:
Expand Down Expand Up @@ -128,7 +138,7 @@ services:
- "traefik.port=9200"
- "traefik.protocol=http"
- "traefik.docker.network=proxy"
- "traefik.frontend.rule=HostRegexp:elasticsearch.${COMPOSE_PROJECT_NAME:-default}.altis.dev"
- "traefik.frontend.rule=HostRegexp:elasticsearch-${COMPOSE_PROJECT_NAME:-default}.altis.dev"
s3:
image: fingershock/fakes3:0.2.4
volumes:
Expand Down Expand Up @@ -170,9 +180,42 @@ services:
- "traefik.port=8025"
- "traefik.protocol=http"
- "traefik.docker.network=proxy"
- "traefik.frontend.rule=HostRegexp:${COMPOSE_PROJECT_NAME:-default}.altis.dev;PathPrefix:/mailhog"
- "traefik.frontend.rule=Host:${COMPOSE_PROJECT_NAME:-default}.altis.dev;PathPrefix:/mailhog"
environment:
MH_UI_WEB_PATH: mailhog
cognito:
<<: *analytics
image: humanmade/local-cognito
labels:
- "traefik.port=3000"
- "traefik.protocol=http"
- "traefik.docker.network=proxy"
- "traefik.frontend.rule=Host:cognito-${COMPOSE_PROJECT_NAME:-default}.altis.dev"
pinpoint:
<<: *analytics
image: humanmade/local-pinpoint
labels:
- "traefik.port=3000"
- "traefik.protocol=http"
- "traefik.docker.network=proxy"
- "traefik.frontend.rule=Host:pinpoint-${COMPOSE_PROJECT_NAME:-default}.altis.dev"
kibana:
image: blacktop/kibana:6.3
networks:
- proxy
- default
ports:
- "5601"
labels:
- "traefik.port=5601"
- "traefik.protocol=http"
- "traefik.docker.network=proxy"
- "traefik.frontend.rule=Host:${COMPOSE_PROJECT_NAME:-default}.altis.dev;PathPrefix:/kibana;PathPrefixStrip:/kibana"
depends_on:
elasticsearch:
condition: service_healthy
volumes:
- ${PWD}/kibana.yml:/usr/share/kibana/config/kibana.yml

networks:
proxy:
Expand Down
9 changes: 9 additions & 0 deletions docker/kibana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
elasticsearch.url: http://elasticsearch:9200

server.name: kibana
server.host: 0.0.0.0
server.basePath: /kibana
server.rewriteBasePath: false

logging.quiet: true
logging.verbose: false
5 changes: 5 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ function bootstrap() {
return parse_url( TACHYON_URL, PHP_URL_HOST ) === $host;
}, 10, 2 );
}

if ( $config['analytics'] ) {
define( 'HM_ANALYTICS_PINPOINT_ENDPOINT', getenv( 'HM_ANALYTICS_PINPOINT_ENDPOINT' ) );
define( 'HM_ANALYTICS_COGNITO_ENDPOINT', getenv( 'HM_ANALYTICS_COGNITO_ENDPOINT' ) );
}
}
3 changes: 2 additions & 1 deletion load.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
add_action( 'altis.modules.init', function () {
$default_settings = [
'enabled' => get_environment_architecture() === 'local-server',
's3' => true,
's3' => true,
'tachyon' => true,
'analytics' => true,
];

register_module( 'local-server', __DIR__, 'Local Server', $default_settings, __NAMESPACE__ . '\\bootstrap' );
Expand Down

0 comments on commit 23ee859

Please sign in to comment.