Maintaining Unified Push
Backup
All the data required to run the UnifiedPush Server is stored inside its database instance so that's all you need to backup. Currently supported databases are:
- PostgreSQL
- MySQL
Since the UnifiedPush Server runs on WILDFLY we can easily get information about the database by inspecting the standalone.xml file:
If you are running UnifiedPush Server from one of the provided docker images, the server is installed into the opt
folder.
To get the content of the standalone.xml
file, first we need to get the docker container id, then we must ask the content of the file
to docker:
CONTAINER_ID={YOUR CONTAINER ID}
READ_CONF="docker exec -it $CONTAINER_ID cat /opt/jboss/wildfly/standalone/configuration/standalone.xml"
bash -c "$READ_CONF"
The container must be up and running for this to work.
To get the CONTAINER_ID, use the docker ps
command and search for the UnifiedPush container.
If you are running UnifiedPush Server standalone in your own WILDFLY instance, then we just need to jump into the
WILDFLY home to read the standalone.xml
file:
WILDFLY_HOME=/path/to/your/wildfly
READ_CONF="cat $WILDFLY_HOME/standalone/configuration/standalone.xml"
bash -c "$READ_CONF"
note
We assigned the command to the READ_CONF
variable because it will comes handy to use it later. The command can, however, be run directly.
Now that we have the configuration file, we can get all the connection details. You can manually search for a datasource named
UnifiedPushDS or you can use a tool like xmlstarlet
:
- Connection URL:
CONNECTION_URL=`bash -c "$READ_CONF" | xmlstarlet sel -N x="urn:jboss:domain:datasources:5.0" -t -m "//x:datasource[@pool-name='UnifiedPushDS']//x:connection-url/text()" -c .`
- Username:
DB_USERNAME=`bash -c "$READ_CONF" | xmlstarlet sel -N x="urn:jboss:domain:datasources:5.0" -t -m "//x:datasource[@pool-name='UnifiedPushDS']//x:user-name/text()" -c .`
- Password:
DB_PASSWORD=`bash -c "$READ_CONF" | xmlstarlet sel -N x="urn:jboss:domain:datasources:5.0" -t -m "//x:datasource[@pool-name='UnifiedPushDS']//x:password/text()" -c .`
Values are now stored into the CONNECTION_URL, DB_USERNAME and DB_PASSWORD environment variables:
printf "CONNECTION_URL=$CONNECTION_URL \nUSERNAME=$DB_USERNAME \nPASSWORD=$DB_PASSWORD\n"
For detailed instructions on how to backup the database, look at the official documentation"