[PR #886] [MERGED] Configurable file storage locations #1135

Closed
opened 2026-02-04 21:52:36 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/plankanban/planka/pull/886
Author: @mtstickney
Created: 9/20/2024
Status: Merged
Merged: 9/20/2024
Merged by: @meltyshev

Base: masterHead: configurable_file_locations


📝 Commits (2)

  • 94a8011 feat: Make logfile location customizable
  • 13f0a68 feat: Support alternate storage locations for uploaded files

📊 Changes

11 files changed (+151 additions, -43 deletions)

View changed files

📝 server/.env.sample (+2 -0)
📝 server/api/controllers/attachments/create.js (+1 -11)
📝 server/api/controllers/boards/create.js (+1 -11)
📝 server/api/controllers/projects/update-background-image.js (+1 -10)
📝 server/api/controllers/users/update-avatar.js (+1 -10)
server/api/helpers/utils/receive-file.js (+41 -0)
📝 server/config/custom.js (+3 -0)
📝 server/config/routes.js (+65 -0)
📝 server/package-lock.json (+33 -0)
📝 server/package.json (+1 -0)
📝 server/utils/logger.js (+2 -1)

📄 Description

I wanted to package planka for deployment as a regular system service on linux (not in a container). Packaging standards and the filesystem conventions on linux require static code, configuration, and writable data directories to be separated.

Specifically, the directories for user-uploaded files (project backgrounds, user avatars), card attachments, and the server logfile need to be outside the main directory.

There are already custom-config properties to set the location of the upload directories, but they are served with the default static-file route in Sails, which means they can only be in subdirectories of the public/ directory (this contains the app code, so in a normal deploy this directory isn't going to be writable).

To fix that, I've added two custom routes that will serve project backgrounds and user avatars from the configured directories (card attachments are already handled by a separate controller), which can now reside outside the app dir.

To make the file-upload directory configurable, I added a helper to receive files, which uses an optional custom config property to control that directory -- this gets us a configurable location for all uploaded files, including backgrounds, avatars, attachments and import files.

Finally, I added an environment variable to control the location the server tries to write logs (this doesn't seem to actually get used, but it will still try to create the file).

With those things in place, and with the right overrides of them, the app can be run from a write-only directory, with all the file-writing done elsewhere, as it would in a normal linux deployment. Without customizing any of the custom properties, the behavior should be the same as it was previously, so running it from a checkout in dev or in a container shouldn't be affected.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/plankanban/planka/pull/886 **Author:** [@mtstickney](https://github.com/mtstickney) **Created:** 9/20/2024 **Status:** ✅ Merged **Merged:** 9/20/2024 **Merged by:** [@meltyshev](https://github.com/meltyshev) **Base:** `master` ← **Head:** `configurable_file_locations` --- ### 📝 Commits (2) - [`94a8011`](https://github.com/plankanban/planka/commit/94a8011bd61eb18bf278447b0bc77a0b41b4f472) feat: Make logfile location customizable - [`13f0a68`](https://github.com/plankanban/planka/commit/13f0a685236c45159f6139a7014d89db676a3d25) feat: Support alternate storage locations for uploaded files ### 📊 Changes **11 files changed** (+151 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `server/.env.sample` (+2 -0) 📝 `server/api/controllers/attachments/create.js` (+1 -11) 📝 `server/api/controllers/boards/create.js` (+1 -11) 📝 `server/api/controllers/projects/update-background-image.js` (+1 -10) 📝 `server/api/controllers/users/update-avatar.js` (+1 -10) ➕ `server/api/helpers/utils/receive-file.js` (+41 -0) 📝 `server/config/custom.js` (+3 -0) 📝 `server/config/routes.js` (+65 -0) 📝 `server/package-lock.json` (+33 -0) 📝 `server/package.json` (+1 -0) 📝 `server/utils/logger.js` (+2 -1) </details> ### 📄 Description I wanted to package planka for deployment as a regular system service on linux (not in a container). Packaging standards and the filesystem conventions on linux require static code, configuration, and writable data directories to be separated. Specifically, the directories for user-uploaded files (project backgrounds, user avatars), card attachments, and the server logfile need to be outside the main directory. There are already custom-config properties to set the location of the upload directories, but they are served with the default static-file route in Sails, which means they can only be in subdirectories of the `public/` directory (this contains the app code, so in a normal deploy this directory isn't going to be writable). To fix that, I've added two custom routes that will serve project backgrounds and user avatars from the configured directories (card attachments are already handled by a separate controller), which can now reside outside the app dir. To make the file-upload directory configurable, I added a helper to receive files, which uses an optional custom config property to control that directory -- this gets us a configurable location for all uploaded files, including backgrounds, avatars, attachments and import files. Finally, I added an environment variable to control the location the server tries to write logs (this doesn't seem to actually get used, but it will still try to create the file). With those things in place, and with the right overrides of them, the app can be run from a write-only directory, with all the file-writing done elsewhere, as it would in a normal linux deployment. Without customizing any of the custom properties, the behavior should be the same as it was previously, so running it from a checkout in dev or in a container shouldn't be affected. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-04 21:52:36 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#1135