Migrating to Docker: Getting MAC is invalid error


#1

Hi!

I have been trying for a couple of days to migrate and existing Bitnami install to the docker-df stack. Both the instances runs DF version 2.11.1.

What we have done is the following:

  • spin up the new stack based on docker-compose
  • dump/restore the MySQL db from the old installation
  • set the APP_KEY to be the same as on the old installation together with any other environment variables that we used (why is this not an existing variable in the Docker file btw?)
  • run php artisan cache:clear and php artisan clear-compiled and clearing brower cache/rebooting/clearing cache in DF config setting
  • docker exec {df_container} bash -c ‘chown -R daemon:daemon /opt/bitnami/dreamfactory/storage/ /opt/bitnami/dreamfactory/bootstrap/cache/’"

After that I can log in with my old admin account and most is working, but not the App/Service pages which gives the dreaded “MAC is invalid” error. I have done a lot of research about it and the error comes from Laravels way of encrypting the credentials for the services, and it uses the APP_KEY as the encryption key for that. But we have changed the APP_KEY so that it matches the one used in the old installation and used for encrypting this data, and still it gives the error.

What else do I need to do, other than the above to get it working? Deleting the sq_db_config rows, which contains the services credentials, gets rid of the errors, but it is a really bad solution that is not viable for us.

Would really appreciate if anyone knows how to get this working with existing APP_KEY without recreating all services credentials.

Thanks!


#2

Finally found the solution to this. And even though the docker-df documentation does not mention it, you can pass in any varibles that will override the ones in .env when you run the container. For example doing it in docker-compose.yml file would be like this:

  dreamfactory:
    image: dreamfactorysoftware/df-docker:latest
    environment:
      - APP_KEY=base64:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
      - DF_JWT_TTL=180
      - DF_DB_MAX_RECORDS_RETURNED=50000

So documentation should be more clear on that is how it works.