Currently Ghost writes to the local file system for:
- Creation of database backups
- Uploading themes (currently hard-coded to use the local file storage adapter)
- Unzipping directories
This isn't ideal as the user may not have the permissions to do this (in the case of immutable hosts such as Now), or these changes may be lost on server restart (in the case of ephemeral hosts such as Heroku).
These are taken from the master branch.
Is used in the writeExportFile
function of core/server/data/migration/backup.js
.
Is used in the zipFolder
function of core/server/utils/zip-folder.js
.
Is used in the cleanUp
function of core/server/data/importer/index.js
.
Is used in the extractZip
function of core/server/data/importer/index.js
.
The ideal solution is to allow the user to define storage adapters for all tasks that manipulate the local file system.
This is partially implemented, but currently only for images, and database.
The storage adapter system still needs to be applied to:
- Database backups
- Themes (currently hard-coded to use the local file storage adapter)
- Logging (@kirrg001 is currently working on this)
- Apps (currently only setup to read from app path?)
- Temporary storage?
It might be nice to abstract storage adapters. For example, a file storage adapter shouldn't care about what type of file it is writing/reading. It should only know how to write/read/delete a file.
One idea would be something like @vdemedes' suggestion. This would allow us to define the same storage adapter for multiple tasks.
storage: {
active: {
apps: 's3',
backups: 's3',
images: 's3',
logs: 'loggly',
themes: 's3',
},
loggly: {},
s3: {
rootDir: {
apps: 'apps',
backups: 'backups',
images: 'images',
themes: 'themes',
},
},
}
I also agree that we should remove the responsibility of serving assets from storage adapters.