1

I have a PHP application which reads the database config from a file named "database.php". Now, in the production server, I am planning to pass this database.php as a secret file.

My question is whether my PHP application will read the secret file(database.php) as a normal file(because it is not in file storage, but in RAM), or if the read will be slower as the container has to request the secret from SWARM Manager.

A similar example is in docker docs where they have passed index.html as a secret file. -> link to docs

Swastik Roy
  • 198
  • 1
  • 13

1 Answers1

1

My question is whether my PHP application will read the secret file(database.php) as a normal file(because it is not in file storage, but in RAM)

Yes, to the PHP application this will appear as a normal file, it does not need any extra handling.

or if the read will be slower as the container has to request the secret from SWARM Manager.

The read will not be any slower, since the secret will be mounted (and thus copied into memory), and this will be done only once.

Uku Loskit
  • 40,868
  • 9
  • 92
  • 93
  • Thanks that clears my concern. It seems like this is the best way to pass the DB config file. There is no example over the internet where they have passed a 'code' file(.php here) as secret, which is why I was doubtful. – Swastik Roy Dec 03 '18 at 23:09