2019-12-18 18:39:33 +00:00
|
|
|
# FileBin 🐋
|
|
|
|
|
2022-07-05 15:15:46 +00:00
|
|
|
A docker image for [FileBin](https://git.server-speed.net/users/flo/filebin/) to have it up and running in seconds.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
2022-07-05 15:15:46 +00:00
|
|
|
Visit project on [https://git.myservermanager.com/varakh/docker-filebin](https://git.myservermanager.com/varakh/docker-filebin)
|
2021-05-20 23:03:02 +00:00
|
|
|
or [Docker Hub](https://hub.docker.com/r/varakh/filebin).
|
2019-12-18 18:39:33 +00:00
|
|
|
|
2022-07-05 20:10:24 +00:00
|
|
|
The main git repository is hosted at _[https://git.myservermanager.com/varakh/docker-filebin](https://git.myservermanager.com/varakh/docker-filebin)_.
|
|
|
|
Other repositories are mirrors and pull requests, issues, and planning are managed there.
|
|
|
|
|
|
|
|
Contributions are very welcome!
|
|
|
|
|
2019-12-18 18:39:33 +00:00
|
|
|
## Getting started
|
|
|
|
|
2021-11-09 16:43:24 +00:00
|
|
|
The recommended way to get started is to use the example `docker-compose.yml` file and use *Docker*. Before, make
|
|
|
|
yourself familiar with the environment variables which can be set. Defaults should do as a starting point.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
2019-12-18 18:51:33 +00:00
|
|
|
_Be sure to read persisting volumes_ section and execute the required command.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
Default database is PostgreSQL. Other databases are supported and can be configured via exposed environment variables.
|
|
|
|
Please refer to the original documentation of the application for further details. PHP modules for MySQL are included in
|
|
|
|
the image.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
After your database and the application docker container is up and running, add a first user by executing a command
|
|
|
|
within the docker container:
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
docker exec -it filebin_app /bin/sh
|
|
|
|
php /var/www/index.php user add_user
|
|
|
|
```
|
|
|
|
|
2021-11-09 16:43:24 +00:00
|
|
|
_Alternatively_ you can also use *Podman* for a root-less deployment, e.g. with something similar to:
|
|
|
|
|
|
|
|
```
|
|
|
|
podman run -e POSTGRES_PASSWORD=fb -e POSTGRES_USER=fb -e POSTGRES_DB=fb -p 5432:5432 docker.io/postgres:11
|
|
|
|
podman run -e BASE_URL=http://localhost:8080 -e DB_HOST=your_host -e DB_PORT=5432 -e DB_NAME=fb -e DB_USER=fb -e DB_PASS=fb -e ENCRYPTION_KEY=your_32_long_secret -p 8080:80 docker.io/varakh/filebin:latest
|
|
|
|
```
|
|
|
|
|
2019-12-18 18:39:33 +00:00
|
|
|
### Persisting volumes
|
|
|
|
|
|
|
|
You'll probably want the `uploads/` folder to be persistent across container restarts.
|
|
|
|
|
|
|
|
Here's an example on how to persist the `data/uploads/` folder of the application.
|
|
|
|
|
|
|
|
* Create folder: `mkdir -p ./filebin_data`
|
2024-01-21 17:40:43 +00:00
|
|
|
* Afterward, adjust permissions so that the folder can be used within the docker
|
2021-05-20 23:03:02 +00:00
|
|
|
container: `chown -R 65534:102 <host-mount>` (`nobody:nginx`)
|
2019-12-18 18:39:33 +00:00
|
|
|
* Reference the folder as a docker volume, e.g. with `./filebin_data:/var/www/data/uploads`
|
|
|
|
|
|
|
|
### Cron jobs
|
|
|
|
|
|
|
|
Application specific cron jobs are run every 15 minutes.
|
|
|
|
|
|
|
|
### Advanced configuration: customize non-exposed configuration variables
|
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
If you need to make frequent changes or adapt configuration values which are not exposed as environment variables, you
|
|
|
|
probably want the `config-local.php` and `database.php` or the entire `config/` folder on the hosts file system.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
In order to do so, first _extract_ the current configuration, e.g. by extracting only the required `.php` files or by
|
|
|
|
extracting the entire `config/` folder. In this example we'll just use entire folder.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
docker cp filebin_app:/var/www/application/config/ ./filebin_config
|
|
|
|
chown -R 65534:102 ./filebin_config
|
|
|
|
```
|
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
Add the `./filebin_config` folder as a host bind to the application docker container, e.g.
|
|
|
|
with `./filebin_config:/var/www/application/config/`
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
### Available environment variables
|
|
|
|
|
|
|
|
Please have a look into `Dockerfile` for available environment variables, they're all exposed there.
|
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
All variables to FileBin itself should be self-explaining. You should also be familiar with the `php.ini` variables.
|
|
|
|
They're only inserted on build, if you like to increase the file limit above the used php variable values of this image,
|
|
|
|
you'll need to rebuild the docker image.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
There are two environment variables introduced by this image:
|
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
* `RECONFIGURE`: If all defined environment should be re-applied to the provided `.tpl` files within the image. You
|
|
|
|
probably want this to be `1` unless you mounted your `config/` folder on the host
|
|
|
|
* `MIGRATE`: Calls FileBin database migration every time the container is started and updates dependencies
|
|
|
|
via `composer`
|
|
|
|
* `SMTP_ENABLED`: Set to `true` in order to enable sending mails via an external SMTP server, set to `false` to use
|
|
|
|
PHP's internal mailer, see other `SMTP_` variables in the `Dockerfile`
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
### Setting up a nginx proxy
|
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
Be sure to set the environment variable `BASE_URL` to the same where you expose it,
|
|
|
|
e.g. `BASE_URL=https://fb.domain.tld`.
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
An example nginx configuration might look like the following.
|
|
|
|
|
|
|
|
```
|
|
|
|
upstream filebin {
|
2021-11-09 16:43:24 +00:00
|
|
|
server 127.0.0.1:8080;
|
2019-12-18 18:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name fb.domain.tld;
|
|
|
|
return 301 https://fb.domain.tld$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
|
|
|
server_name fb.domain.tld;
|
|
|
|
|
|
|
|
ssl_certificate /etc/letsencrypt/live/fb.domain.tld/fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/fb.domain.tld/privkey.pem;
|
|
|
|
|
|
|
|
gzip on;
|
|
|
|
access_log off;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_pass http://filebin;
|
|
|
|
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-Ssl on;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-Frame-Options SAMEORIGIN;
|
|
|
|
|
|
|
|
client_body_buffer_size 128k;
|
|
|
|
|
|
|
|
proxy_buffer_size 4k;
|
|
|
|
proxy_buffers 4 32k;
|
|
|
|
proxy_busy_buffers_size 64k;
|
|
|
|
proxy_temp_file_write_size 64k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Updates
|
|
|
|
|
|
|
|
Just use a newly released image version. Configuration should be compatible.
|
|
|
|
|
|
|
|
## Backup
|
|
|
|
|
|
|
|
Backup the host binds for `uploads/` and the database manually.
|
|
|
|
|
2021-05-20 23:03:02 +00:00
|
|
|
If you're using the provided `docker-compose.yml` file you probably can do something like the following and afterwards
|
|
|
|
backup the extracted file from `/tmp` of your host system:
|
2019-12-18 18:39:33 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
docker exec filebin_db bash -c "/usr/bin/pg_dumpall -U fb|gzip -c > /filebin_db.sql.gz";
|
2019-12-19 00:07:00 +00:00
|
|
|
docker cp filebin_db:/filebin_db.sql.gz /tmp/;
|
2019-12-18 18:39:33 +00:00
|
|
|
docker exec filebin_db bash -c "rm /filebin_db.sql.gz";
|
|
|
|
```
|
2019-12-18 20:32:57 +00:00
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
Steps:
|
|
|
|
|
|
|
|
* Clone to local `build/` folder which is later added
|
|
|
|
* Build image
|
|
|
|
* Push to registry or use locally
|
|
|
|
|
2023-03-25 08:07:43 +00:00
|
|
|
Call `local_build.sh` and export `FB_VERSION=$versionTag` before, e.g. `FB_VERSION=3.6.2`.
|