Skip to content

Commit

Permalink
tec!: Move the uploads directory under var by default
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Dec 11, 2024
1 parent 52e39f5 commit f51a61a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/docs/
/node_modules/
/tests/
/uploads/
/var/
/vendor/
/public/dev_assets/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

/public/dev_assets/*

/uploads/
/var/cache
/var/data
/var/log
/var/settings/*
!/var/settings/.keep
/var/uploads/*
!/var/uploads/.keep

/.phpunit.result.cache
/phpunit.xml
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog of Bileto

## unreleased

### Breaking change

The `uploads/` directory is now placed under `var/` by default.
If you uploaded files on your instance of Bileto, you must either set the `APP_UPLOADS_DIRECTORY` environment variable to the previous `uploads/` directory, or move the directory under `var/`.
If you move it under `var/`, you no longer need to mount a dedicated Docker volume on `uploads/` as you should already have one mounter on `var/`.

## 2024-11-22 - 0.12.0-beta

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
parameters:
env(VERSION_FILE): '%kernel.project_dir%/VERSION.txt'

app.default_uploads_directory: '%kernel.project_dir%/uploads'
app.default_uploads_directory: '%kernel.project_dir%/var/uploads'
app.public_directory: "%kernel.project_dir%/public"
app.uploads_directory: '%env(default:app.default_uploads_directory:APP_UPLOADS_DIRECTORY)%'
app.version: '%env(trim:file:VERSION_FILE)%'
Expand Down
2 changes: 1 addition & 1 deletion docker/production/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ RUN chown -R www-data:www-data .
# Install the dependencies as www-data
USER www-data

RUN mkdir var uploads
RUN mkdir var var/uploads var/settings
RUN composer install --no-dev --optimize-autoloader --no-scripts
2 changes: 1 addition & 1 deletion docs/administrators/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ mariadb bileto_production < backup-bileto.sql
You should also backup two more folders and a file:

- `var/data/` stores an encryption key used to encrypt secrets;
- `uploads/` (or any other folder if you changed `APP_UPLOADS_DIRECTORY`) stores the documents uploaded by the users;
- `var/uploads/` (or any other folder if you changed `APP_UPLOADS_DIRECTORY`) stores the documents uploaded by the users;
- `.env.local` stores the configuration of Bileto.

When you restore Bileto, make sure to set the correct owner of these files:
Expand Down
3 changes: 0 additions & 3 deletions docs/administrators/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ services:
ports:
- "8000:80"
volumes:
- uploads:/var/www/html/uploads
- var:/var/www/html/var
env_file:
- .env.app
Expand All @@ -79,7 +78,6 @@ services:
command: php bin/console messenger:consume async scheduler_default -vv
entrypoint: ""
volumes:
- uploads:/var/www/html/uploads
- var:/var/www/html/var
env_file:
- .env.app
Expand All @@ -101,7 +99,6 @@ services:
retries: 30

volumes:
uploads:
var:
```
Expand Down
2 changes: 1 addition & 1 deletion env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ APP_BASE_URL=https://example.org
# APP_DEFAULT_LOCALE=fr_FR

# The path to the upload directory.
# Default is uploads/ in the root directory.
# Default is var/uploads/ in the root directory.
# APP_UPLOADS_DIRECTORY=/path/to/uploads

#################################
Expand Down
Empty file added var/uploads/.keep
Empty file.

0 comments on commit f51a61a

Please sign in to comment.