Edit files on Heroku

How do I edit the json files when the bot is hosted as Docker at Heroku?

1 Like

You need to go to the Heroku console and run the bash command. This way you enter the docker container where the bot is running.

Heroku / more (button) / Run console

But changed files will be rewritten with the default ones when the bot restarts, or some changes will not even apply.

But if I enter the connection data to Facebook like appSecret and verifyToken into the file channel-messenger.json then it must be permanent. How do I do it?

I have no experience with deploying to messenger, but if you want to enter the Heroku container you do it in Heroku console with bash.

If you want to edit files inside the container then you must install nano and other packages to the Docker container, meaning that you must extend the Botpress docker image. But there must certainly be another way to accomplish what you are trying to do.

I’m just guessing that you are trying to add the appSecret and Token to the bot, isn’t there a config file that should have the information before you deploy?

Maybe someone else could help you with this matter…

@Hariko50

When you want to change files permanently, then you need to rebuild, re-upload and re-release your docker container… Please check the Heroku Docs on how to do that.

/Crixx

Is this indeed the only way to do it? Seems a bit clumsy if I just want to change a single option in a single JSON file to then have to redeploy the whole thing, no?

As said:

  • do it with the command line and loose all your changes on reboot (be aware that this is also the case if e.g. heroku shifts your apps to other hosts)

  • setup an appropriate CI/CD pipeline and do it permanently, transparently and versioned

/crixx

Thanks!

By pipeline, do you mean what is described here?

If my understanding is correct, this is only available with a pro license, which currently cannot be obtained as I was informed. Also, going by the description, this is to publish different versions of the bot itself. But what I am lookign at is, for examole, how do I push changes liek changes to global config JSON files? From what I see this pipeline mechanism is not suitabel for that.

Your insight is appreciated!

Steve

If you setup Postgres as the DB and set BP_PRODUCTION=true, then the changes you make to the files will be persisted across reboots.

You can change the data/global/config/code-editor.json file to allow changing hooks and config from the GUI-based code editor, which will greatly reduce the number of files you need to change via SSH (if any).

1 Like

Thank you!

Unfortunately I cannot get the code editor to work. I enable it by making the necessary changes in JSON locally, I copy the modified JSON file to my Docker deployment folder, I push and release, but on the server the JSON config file just does not seem to get updated, whatever I seem to do. And indeed, when I pull (bp.exe pull) from my Heroku based instance to my local one, I see the old, unchanged JSON files. Unfortunately the docs are missing instructions on how to UPDATE an instance pushed previously. How to modify existing files in the image on the server, how to delete files.

Any pointers would be appreciated.