Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install countly server on Macbook M1 Pro 2020 via docker-compose #4476

Open
concman opened this issue Aug 25, 2023 · 3 comments
Open

Comments

@concman
Copy link

concman commented Aug 25, 2023

Problem

I've tried to install countly server via docker-compose, however, I could not run server on my local server. The aim was to test countly locally. Considering logging countly services that may cause issues, which can be listed as countly-frontend, countly-api, mongo-db, and nginx there were errors that needed to be reviewed.

Since the default port for countly server was 80, I've encountered 502 BAD REQUEST error while navigating following port.

Also, when I try to restart docker-compose, I stuck in the following lines:

lookfor_countly-countly-frontend-1  | Loading city coordinates into db
lookfor_countly-countly-frontend-1  | Process might take few minutes

To solve the issue I've manually added the ports for countly-frontend and countly-backend in docker-compose.yml file, as you can see in the below:

Note that: I was also getting some warnings from docker about the poor quality of AMD64 images, and images do not match with current version of ARM64 etc. To address this, I've also added platform: linux/amd64

version: "3.7"

volumes:
  mongodb_data:

networks:
  countly:
services:
  mongodb:
    image: "bitnami/mongodb:latest"
    volumes:
      - "mongodb_data:/bitnami"
    networks:
      countly:
    platform: "linux/amd64"

  countly-api:
    image: "countly/api:latest"
    # Enterprise Edition: image: 'gcr.io/countly-01/api:20.11.2'
    environment:
      - COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,times-of-day,compliance-hub,alerts,onboarding,consolidate,remote-config,hooks,dashboards,sdk,data-manager
      # Enterprise Edition: - COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,license,drill,funnels,retention_segments,flows,cohorts,surveys,remote-config,ab-testing,formulas,activity-map,concurrent_users,revenue,logger,systemlogs,populator,reports,crashes,push,geo,block,restrict,users,star-rating,slipping-away-users,compare,server-stats,assistant,dbviewer,crash_symbolication,crashes-jira,groups,white-labeling,alerts,times-of-day,compliance-hub,onboarding,active_users,performance-monitoring,config-transfer,consolidate,data-manager,hooks,dashboards,sdk
      - COUNTLY_CONFIG__MONGODB_HOST=mongodb
      - COUNTLY_CONFIG_API_API_WORKERS=4 # CPU core count
      - COUNTLY_CONFIG__FILESTORAGE="gridfs"
      - NODE_OPTIONS="--max-old-space-size=2048"
      - COUNTLY_CONFIG_HOSTNAME=localhost
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 400s
    networks:
      countly:
    depends_on:
      - mongodb
    platform: "linux/amd64"

  countly-frontend:
    image: "countly/frontend:latest"
    # Enterprise Edition: image: 'gcr.io/countly-01/frontend:20.11.2'
    environment:
      - COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,times-of-day,compliance-hub,alerts,onboarding,consolidate,remote-config,hooks,dashboards,sdk,data-manager
      # Enterprise Edition: - COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,license,drill,funnels,retention_segments,flows,cohorts,surveys,remote-config,ab-testing,formulas,activity-map,concurrent_users,revenue,logger,systemlogs,populator,reports,crashes,push,geo,block,restrict,users,star-rating,slipping-away-users,compare,server-stats,assistant,dbviewer,crash_symbolication,crashes-jira,groups,white-labeling,alerts,times-of-day,compliance-hub,onboarding,active_users,performance-monitoring,config-transfer,consolidate,data-manager,hooks,dashboards,sdk
      - COUNTLY_CONFIG__MONGODB_HOST=mongodb
      - NODE_OPTIONS="--max-old-space-size=2048"
      - COUNTLY_CONFIG_HOSTNAME=localhost
    networks:
      countly:
    platform: "linux/amd64"
    depends_on:
      - mongodb
    deploy:
      # There is usually no need in multiple frontends, so throttling down resources for it
      mode: global
      resources:
        limits:
          cpus: "0.5"
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 400s
        
       nginx:
    image: "bitnami/nginx"
    ports:
      - "80:8080"
    volumes:
      - "./nginx.server.conf:/opt/bitnami/nginx/conf/server_blocks/countly.conf:ro"
    networks:
      countly:
    depends_on:
      - countly-api
      - countly-frontend

The Bottom Line

Remarkably, I've tried everything to run countly server on my Macbook via docker-compose, if you open countly website you'll be likely to see that "the countly server is not going to support macOS etc". But I'm using docker for this, so that should not be a reflection in that case.

Your Environment

  • Operating System and version: macOS 13-inch, M1, 2020
  • Any changes you have made to your instance:
  • added platform: linux/64 to docker-compose.yml file
  • added ports manually to docker-compose.yml file
@ar2rsawseen
Copy link
Member

Hello
So, based on where the script is stuck, it looks like the connection with MongoDB is the problem.
Is mongodb hostname defined?

@Countly/devops anything we can help here with or improve in our docs/templates?

@concman
Copy link
Author

concman commented Aug 28, 2023

Hello

So, based on where the script is stuck, it looks like the connection with MongoDB is the problem.

Is mongodb hostname defined?

@Countly/devops anything we can help here with or improve in our docs/templates?

Hello, I did not define mongoDB hostname. However, there is neither YouTube video nor documentation that specifically defining mongoDB hostname about installation of countly server.

@kaanklky
Copy link
Contributor

Hello, I did not define mongoDB hostname. However, there is neither YouTube video nor documentation that specifically defining mongoDB hostname about installation of countly server.

Hello @concman,
Example docker-compose.yml file already has mongodb definition under services and also COUNTLY_CONFIG__MONGODB_HOST is configured to point that service, so everything should be fine in that context.
I couldn't understand the part that you mentioned about ports; there is a NGINX service definition too(which you have indentation issue as far as I can see) which uses nginx.server.conf that points to containers by reverse proxy. It is up to developer/user to change default NGINX port to access Countly via NGINX by different port than default HTTP port.
I tried to reproduce your issue on same device(Macbook Air M1 2020) by just downloading this repo and adding platform: "linux/amd64" for mongodb, countly-api, countly-frontend and nginx service entries in docker-compose.yml and got the same issue, stuck with %100 CPU on MongoDB service while it is completely OK on native amd64 architecture. @ar2rsawseen something is wrong with bitnami/mongodb and it is OK with official MongoDB images(mongo:latest), are there any specific reason to use Bitnami images or we can switch to official ones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants