Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent storage volumes #112

Open
PencilShavings opened this issue Apr 2, 2024 · 5 comments
Open

Persistent storage volumes #112

PencilShavings opened this issue Apr 2, 2024 · 5 comments

Comments

@PencilShavings
Copy link

PencilShavings commented Apr 2, 2024

What folders should be mapped for persistent storage? In the docs “Install using docker” it just says docker run -p 8080:80 vvveb/vvvebcms:latest.

@givanz
Copy link
Owner

givanz commented Apr 3, 2024

The folder that needs mapping is the apache htdocs folder /var/www/html

sudo docker volume create vvveb-volume
sudo docker run -p 8080:80 --mount source=vvveb-volume,target=/var/www/html vvveb/vvvebcms 

Or with docker compose

services:
  frontend:
    image: vvveb/vvvebcms:latest
    volumes:
      - vvveb-volume:/var/www/html
volumes:
  vvveb-volume:
	external: true

@PencilShavings
Copy link
Author

You have to mount the entire site? Is there not just a data/config folder that can be bound?

Is there a way to use bind mounts? I personalty don’t find named-volumes very tangible. Having the ability to place the content wherever on the system is a necessity.

@givanz
Copy link
Owner

givanz commented Apr 5, 2024

You can bind /config and /public/media folders for persistent assets and config.

If you use SQLite then you can also mount the database folder storage/sqlite/.

sudo docker run -p 8080:80  \
--mount type=bind,source="$(pwd)"/config,target=/var/www/html/config  \
--mount type=bind,source="$(pwd)"/media,target=/var/www/html/public/media \
vvveb/vvvebcms 

@PencilShavings
Copy link
Author

public/media/ & storage/sqlite/ seemed to have done part of the trick but mapping /var/www/html/config results in “Internal server error, please try again later.” with a bunch of other code. I am amusing because there are files in that directory that get removed when you mount a local directory to it.

Without it, every time I restart the container I get sent back to the initial setup process.

Error message if it’s useful:

Internal server error, please try again later. 
[Refresh page](http://localhost:8080/install//) 
Error
Error loading session driver 
File
/var/www/html/system/session.php on line 45 
Code
	public function __construct($driver, $expire = 3600) {
		$class = '\\Vvveb\\System\\Session\\' . $driver;

		if (class_exists($class)) {
			$options      = \Vvveb\config(APP . '.session', []);
			$this->driver = new $class($options);
		} else {
			throw new \Exception('Error loading session driver ' . $driver);	 // <==
		}

		return $this->driver;
	}

	public function get($key) {
Trace
#0 /var/www/html/system/session.php(33): Vvveb\System\Session->__construct(NULL)
#1 /var/www/html/system/functions.php(318): Vvveb\System\Session::getInstance()
#2 /var/www/html/install/controller/index.php(49): Vvveb\session('language')
#3 /var/www/html/system/core/frontcontroller.php(190): Vvveb\Controller\Index->__construct()
#4 /var/www/html/system/core/frontcontroller.php(298): Vvveb\System\Core\FrontController::call('Vvveb\\Controlle...', 'index', '/var/www/html/i...')
#5 /var/www/html/system/core/frontcontroller.php(364): Vvveb\System\Core\FrontController::redirect('Index', 'index')
#6 /var/www/html/system/core/startup.php(366): Vvveb\System\Core\FrontController::dispatch()
#7 /var/www/html/index.php(138): Vvveb\System\Core\start()
#8 /var/www/html/install/index.php(51): include('/var/www/html/i...')
#9 /var/www/html/public/install/index.php(26): include('/var/www/html/i...')
#10 {main}

@givanz
Copy link
Owner

givanz commented Apr 6, 2024

Docker does not copy the existing files into bind mounts, and because config/app.php is missing is throwing this error.

You need to connect to the container, download and unzip the cms files to copy the files to the empty bind mounts folders.

docker exec -it <mycontainer> bash
curl -Lo /tmp/vvveb.zip https://www.vvveb.com/download.php
unzip /tmp/vvveb.zip -d /var/www/html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants