Reformat to use 4 spaces

This commit is contained in:
Varakh 2021-05-21 01:03:02 +02:00
parent 6b13226a2d
commit 75c76f77c3
5 changed files with 75 additions and 54 deletions

6
.editorconfig Normal file
View file

@ -0,0 +1,6 @@
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

View file

@ -1,5 +1,6 @@
# CHANGELOG
## 2021-01-30
* Updated docker image to include latest alpine package changes
* Fixed start of `crond` in s6 overlay, included `crontab` file will be run every 15 minutes correctly now
* Fixed start of `crond` in s6 overlay, included `crontab` file will be run every 15 minutes correctly now

View file

@ -2,17 +2,22 @@
A docker image for [FileBin](https://github.com/Bluewind/filebin) to have it up and running in seconds.
Visit project on [GitHub](https://github.com/v4rakh/docker-filebin) or [Docker Hub](https://hub.docker.com/r/varakh/filebin).
Visit project on [GitHub](https://github.com/v4rakh/docker-filebin)
or [Docker Hub](https://hub.docker.com/r/varakh/filebin).
## Getting started
The recommended way to get started is to use the example `docker-compose.yml` file and make yourself familiar with the environment variables which can be set. Defaults should do as a starting point.
The recommended way to get started is to use the example `docker-compose.yml` file and make yourself familiar with the
environment variables which can be set. Defaults should do as a starting point.
_Be sure to read persisting volumes_ section and execute the required command.
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.
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.
After your database and the application docker container is up and running, add a first user by executing a command within the docker container:
After your database and the application docker container is up and running, add a first user by executing a command
within the docker container:
```
docker exec -it filebin_app /bin/sh
@ -26,7 +31,8 @@ You'll probably want the `uploads/` folder to be persistent across container res
Here's an example on how to persist the `data/uploads/` folder of the application.
* Create folder: `mkdir -p ./filebin_data`
* Afterwards, adjust permissions so that the folder can be used within the docker container: `chown -R 65534:102 <host-mount>` (`nobody:nginx`)
* Afterwards, adjust permissions so that the folder can be used within the docker
container: `chown -R 65534:102 <host-mount>` (`nobody:nginx`)
* Reference the folder as a docker volume, e.g. with `./filebin_data:/var/www/data/uploads`
### Cron jobs
@ -35,33 +41,41 @@ Application specific cron jobs are run every 15 minutes.
### Advanced configuration: customize non-exposed configuration variables
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.
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.
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.
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.
```
docker cp filebin_app:/var/www/application/config/ ./filebin_config
chown -R 65534:102 ./filebin_config
```
Add the `./filebin_config` folder as a host bind to the application docker container, e.g. with `./filebin_config:/var/www/application/config/`
Add the `./filebin_config` folder as a host bind to the application docker container, e.g.
with `./filebin_config:/var/www/application/config/`
### Available environment variables
Please have a look into `Dockerfile` for available environment variables, they're all exposed there.
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.
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.
There are two environment variables introduced by this image:
* `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`
* `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`
### Setting up a nginx proxy
Be sure to set the environment variable `BASE_URL` to the same where you expose it, e.g. `BASE_URL=https://fb.domain.tld`.
Be sure to set the environment variable `BASE_URL` to the same where you expose it,
e.g. `BASE_URL=https://fb.domain.tld`.
An example nginx configuration might look like the following.
@ -115,8 +129,8 @@ Just use a newly released image version. Configuration should be compatible.
Backup the host binds for `uploads/` and the database manually.
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:
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:
```
docker exec filebin_db bash -c "/usr/bin/pg_dumpall -U fb|gzip -c > /filebin_db.sql.gz";
@ -139,4 +153,4 @@ export FILEBIN_VERSION=3.6.0;
mkdir -p build;
git clone --branch ${FILEBIN_VERSION} https://github.com/Bluewind/filebin --depth=1 build/;
sudo docker build --no-cache -t varakh/filebin:${FILEBIN_VERSION} -t varakh/filebin:latest .;
```
```

View file

@ -1,41 +1,41 @@
version: "3"
networks:
fb:
external: false
fb:
external: false
services:
db:
image: postgres:11
container_name: filebin_db
environment:
- POSTGRES_PASSWORD=fb
- POSTGRES_USER=fb
- POSTGRES_DB=fb
volumes:
- ./filebin_db/:/var/lib/postgresql/data # persist postgres data on the host
restart: always
networks:
- fb
db:
image: postgres:11
container_name: filebin_db
environment:
- POSTGRES_PASSWORD=fb
- POSTGRES_USER=fb
- POSTGRES_DB=fb
volumes:
- ./filebin_db/:/var/lib/postgresql/data # persist postgres data on the host
restart: always
networks:
- fb
app:
image: varakh/filebin:latest
container_name: filebin_app
ports:
- 127.0.0.1:181:80 # exposed port :80 mapped to :181 on only this host. 181 should then be used in proxy
environment:
- BASE_URL=https://fb.domain.tld/ # with trailing slash
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=fb
- DB_USER=fb
- DB_PASS=fb
- ENCRYPTION_KEY= # REQUIRED: set a 32 character long sequence
volumes:
- "./filebin_data:/var/www/data/uploads" # persist filebin data on the host
stdin_open: true
tty: true
restart: always
networks:
- fb
command: sh -c 'sh /wait-for.sh $$DB_HOST:$$DB_PORT -- php /configure.php && exec s6-svscan /etc/s6/'
app:
image: varakh/filebin:latest
container_name: filebin_app
ports:
- 127.0.0.1:181:80 # exposed port :80 mapped to :181 on only this host. 181 should then be used in proxy
environment:
- BASE_URL=https://fb.domain.tld/ # with trailing slash
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=fb
- DB_USER=fb
- DB_PASS=fb
- ENCRYPTION_KEY= # REQUIRED: set a 32 character long sequence
volumes:
- "./filebin_data:/var/www/data/uploads" # persist filebin data on the host
stdin_open: true
tty: true
restart: always
networks:
- fb
command: sh -c 'sh /wait-for.sh $$DB_HOST:$$DB_PORT -- php /configure.php && exec s6-svscan /etc/s6/'

View file

@ -10,4 +10,4 @@ if (getenv('SMTP_ENABLED') === 'true') {
'smtp_user' => %%%SMTP_USER%%%,
'smtp_pass' => %%%SMTP_PASS%%%,
];
}
}