rakam-io / rakam-api

📈 Collect customer event data from your apps. (Note that this project only includes the API collector, not the visualization platform)
https://rakam.io
GNU Affero General Public License v3.0
799 stars 105 forks source link

How to set custom lock key? #84

Closed rafaismyname closed 7 years ago

rafaismyname commented 7 years ago

Hey guys, how's going?

First of all, thanks for this awesome tool! :)

I had some struggle getting started with Rakam due to some issues with Lock Key, where whenever iI tried to create a new project using http://app.rakam.io/ the message "Invalid Lock Key" insisted to pop-up.

With a little bit of debugging i realized that rakam was not being initiated with lock key even if we provide it properly:

  rakam-db:
    image: postgres:9.6.1
    ports:
      - '5432:5432'
    environment:
      - POSTGRES_USER=rakam
      - POSTGRES_PASSWORD=rakam
  rakam:
    image: buremba/rakam
    ports:
      - '9999:9999'
    environment:
      - 'RAKAM_CONFIG_STORE_ADAPTER_POSTGRESQL_URL=postgres://rakam:rakam@rakam-db:5432/rakam'
      - 'RAKAM_CONFIG_ALLOW-PROJECT-DELETION=true'
      - 'RAKAM_CONFIG_LOCK-KEY=rakam'
    links:
      - rakam-db

and neither using the very same command as the README.md says:

docker run -d --name rakam-db -e POSTGRES_PASSWORD=dummy -e POSTGRES_USER=rakam postgres:9.6.1 && docker run --link rakam-db --name rakam -p 9999:9999 -e RAKAM_CONFIG_LOCK-KEY=mylockKey -e RAKAM_CONFIG_STORE_ADAPTER_POSTGRESQL_URL=postgres://rakam:dummy@rakam-db:5432/rakam buremba/rakam

so when i tried to register a new project using an empty lock key, it worked! :)

What is the correct way to set lock-key, allow-project-deletion and company-name configuration keys properly using env vars (during docker compose/run)?

Best :)

buremba commented 7 years ago

Hey @rafaelamorim, thanks for your kind words! After a few hours, I discovered that the dash character - on environment variable causes a bug so the environment variable is not seen in Rakam. It might be related with the last version of Docker because it was running fine when we wrote the Dockerfile. Sorry for the inconvenience. I replaced - character in environment variable with __ and updated the docs. For the configuration properties that you mentioned, here are the environment variables:

lock-key = RAKAM_CONFIG_LOCK__KEY allow-project-deletion = RAKAM_CONFIG_ALLOW__PROJECT__DELETION company-name = RAKAM_CONFIG_COMPANY__NAME

The environment variable must have RAKAM_CONFIG_ prefix, dots are replaced by underscore and dash are replaced by double underscore i.e. __. Please let me know if you see any other bugs. :)

rafaismyname commented 6 years ago

Working properly! THANKS! 👍