friendica / docker

Docker image for Friendica

Home Page:https://friendi.ca

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker container is hard to upgrade

zem opened this issue · comments

commented

In the docker container /var/www/html is a volume containing the main program binaries and the configuration.

This makes automatic software upgrades a pain as it means that you have to extract the config and delete the volume on upgrade.

Most container deployments expect volumes to keep all the data needed to run.
Deploying a new container means recreating it and mount in its data volumes. If those data volumes keep a copy of the application, a simple update strategy is not possible.

It's possible to separate program binaries and the configuration. I'll create a PR for it.

Nevertheless, the upgrade process for this images are already set and working. You just need to pull a newer image and the sources either already at /usr/src/friendica directory (for stable images) or will be downloaded into this directory per GIT (yet). Afterwards they are syncd per rsync to /var/www/html by using a upgrade.exclude.

This system worked well for the last 1,5 years :)

Something that I encountered for the first time with the upgrade to 2021.09, my config/local.config.php got overwritten. I see that it is included in the /usr/src/friendica folder and it's contents are:

/var/www/html $ cat /usr/src/friendica/config/local.config.php
<?php

// Local configuration

// If you're unsure about what any of the config keys below do, please check the static/defaults.config.php for detailed
// documentation of their data type and behavior.

return [
	'database' => [
		'hostname' => 'localhost',
		'username' => 'friendica',
		'password' => 'friendica',
		'database' => 'friendica',
		'charset' => 'utf8mb4',
	],

	// ****************************************************************
	// The configuration below will be overruled by the admin panel.
	// Changes made below will only have an effect if the database does
	// not contain any configuration for the friendica system.
	// ****************************************************************

	'config' => [
		'php_path' => '/usr/bin/php',
		'admin_email' => 'admin@friendica.local',
		'sitename' => 'Friendica Social Network',
		'hostname' => 'friendica.local',
		'register_policy' => \Friendica\Module\Register::OPEN,
		'max_import_size' => 200000,
	],
	'system' => [
		'urlpath' => '',
		'url' => 'http://friendica.local',
		'ssl_policy' => 2,
		'basepath' => '/vagrant',
		'default_timezone' => 'UTC',
		'language' => 'en',
		'debugging' => '1',
		'loglevel' => 'notice',
		'logfile' => 'friendica.log',
	],
];

This is the first time I had this issue and I can easily restore it from my backup. All the previous updates have been working well in that regard and left my local config untouched (using a volume for the /var/www/html, as described above).

@zem with the new release, both the stable and the develop images are now supporting the environment variable FRIENDICA_CONFIG_DIR for setting a different config directory, so if you want, you can try it.

I'm currently testing other parts of Friendica, so it will take a while before I change it ;-)

I'm closing this issue because the variable is now set and you could use it if wanted :)
@zem - Please don't hesitate to reopen it in case the change doesn't work like expected