Part-DB.Part-DB-server/docs/installation/installation_docker.md

52 lines
2.8 KiB
Markdown
Raw Normal View History

---
title: Installation using Docker
layout: default
parent: Installation
2023-02-08 00:52:45 +01:00
nav_order: 2
---
# Installation of Part-DB via docker
2023-02-08 00:52:45 +01:00
{: .warning }
> The methods described here, configure PHP without HTTPS and therefore should only be used locally in a trusted network.
> If you want to expose Part-DB to the internet, you have to configure a reverse proxy with an SSL certificate!
## Docker-compose
Part-DB can be installed via docker. A pre-built docker image is available under [jbtronics/part-db1](https://hub.docker.com/repository/docker/jbtronics/part-db1/).
In the moment the master tag should be used (which is built from the latest commits in the master branch), as no tagged releases are available yet.
2021-03-14 23:46:34 +01:00
The easiest way to use it is to use the docker-compose.yml available [here](https://raw.githubusercontent.com/Part-DB/Part-DB-symfony/master/docs/docker/docker-compose.yaml):
2023-02-08 00:52:45 +01:00
1. Install docker and docker-compose like described under https://docs.docker.com/compose/install/
2. Create a folder where the Part-DB data should live
3. Download docker-compose.yml and move it to the folder created above
4. Inside the folder, run
```bash
docker-compose up -d
```
5. Create the inital database with
```bash
docker exec --user=www-data partdb php bin/console doctrine:migrations:migrate
```
and watch for the password output
6. Part-DB is available under `http://localhost:8080` and you can log in with username `admin` and the password shown before
The docker image uses a SQLite database and all data (database, uploads and other media) is put into folders relative to the docker-compose.yml.
## Direct use of docker image
You can use the `jbtronics/part-db1:master` image directly. You have to expose the port 80 to a host port and configure volumes for `/var/www/html/uploads` and `/var/www/html/public/media`.
If you want to use SQLite database (which is default), you have to configure Part-DB to put the database file in a mapped volume via the `DATABASE_URL` environment variable.
For example if you set `DATABASE_URL=sqlite:///%kernel.project_dir%/var/db/app.db` then you will have to map the `/var/www/html/var/db/` folder to the docker container (see docker-compose.yaml for example).
You also have to create the database like described above in step 4.
## Running console commands
You can run the console commands described in README by executing `docker exec --user=www-data -it partdb bin/console [command]`
## Troubleshooting
*Login not possible. Login page is just reloading and no error message is shown or something like "CSFR token invalid"*:
Clear all cookies in your browser or use a inkognito tab for Part-DB.
This related to the fact that Part-DB can not set cookies via HTTP, after some webpage has set cookies before under localhost via https. This is a security mechanism of the browser and can not be bypassed by Part-DB.