cancel
Showing results for 
Search instead for 
Did you mean: 

Changing DB password in Docker composition without breaking access

nicospor
Champ on-the-rise
Champ on-the-rise

Hi,

I have a running Docker instance of Alfresco Community 6.0 in production and I would like to change the password to connect to the Postgres database.

This seems to be feasible by simply changing the respective variables in the docker-compose.yml file, that is:

Ddb.username
Ddb.password
POSTGRES_PASSWORD

However, I was wondering if by doing this the Share application will no longer be able to access the database, i.e. existing accounts will no longer work.

I've tried this in a test environment (by first rebuilding and recreating the composition), and I was no longer able to access with the admin account.

Since the database and content library hasn't yet been populated that much (and also existing users are few), maybe I should just recreate everything and restore the backup?

Many thanks.

1 ACCEPTED ANSWER

fedorow
Elite Collaborator
Elite Collaborator

Grate, you do all right.

docker-compose down stops and remove all conteiners. docker-compose up create new and start all containers. docker-compose stop <service> stops the exact service.

Again:

1. Stop all containers exept database.

sudo docker-compose stop share
sudo docker-compose stop solr6
sudo docker-compose stop ...
sudo docker-compose stop alfresco

2. Change database password

3. Stop and remove all docker-compose instances.

sudo docker-compose down

4. Edit password into alfresco-global properties and into docker-compose.yml

5. Make shure update alfresco-global.properties in your alfresco image or connect updated alfresco-global.properties to alfresco container. It depends of your docker-compose.yml configuration and your Dockerfile-s. I don't see it and can't give exact recomendations.

6. Restart docker compose by

sudo docker-compose up

Besides it's very important in production to clearly understand the docker-compose: images / conteiners / services / volumes / network.

View answer in original post

6 REPLIES 6

jljwoznica
Star Collaborator
Star Collaborator

Share only accesses the repository application which in turn accesses the database. Are you familiar with starting and stopping containers? This is possible, but there are some nuances.

Hi, thanks.

I'm new to Docker, I usually stop all containers with

docker-compose down

and start them all up again with

docker-compose up --force-recreate

I guess I could just stop/start invididual containers with docker-compose stop/start.

Should I first stop only the database container with changed password and then start it again? Should I also edit the alfresco-global.properties config file, rather than just the YAML file?

Thanks again for your help.

fedorow
Elite Collaborator
Elite Collaborator

Production envoriment must have named volumes for at least: alfresco repository, solr indexes and database. All data will stored into hosts folders independently of docker containers. So rebuilding and restarting of containers don't influens on data.

DB password present in alfresco-global.properties and docker-compose.yml. So as I understend theoreticaly you should:

  • stop all containers exept postgres;
  • connect to database in an accessible to you way and change password of alfresco database.
  • edit the password in the alfresco-global.properties and docker-compose.yml
  • rebuild containers
  • restart docker-compose

I give you only the way to go on.

nicospor
Champ on-the-rise
Champ on-the-rise

The environment does indeed have named volumes mounted on the host for alf repo, solr and database data. The data seem to be stored there correctly.

I'll try running psql to change the password by executing it in the container through docker.

When you say "rebuild containers" do you mean "docker-compose build" for indivudal containers?

Could I rebuild and restart everything by doing the following?

docker-compose up --build --force-recreate

Many thanks for your help.