Skip to content

Installallation on Raspberry Pi #6

Description

@coyan

I want to install on a Raspberry Pi (version 4 with 2GB of RAM) but I'm new with Docker. First I explain the steps to reproduce it and then I show what errors I found.

Installation

Download the Raspbian (aka: Raspberry Pi OS) from Raspberry Pi official webpage and flash on the microSD, and start pasting commands:

sudo raspi-config #configure things like: hostname, lang, enable SSH, VNC...
sudo reboot
sudo apt update && sudo apt upgrade
sudo reboot # VERY IMPORTANT

If you don't reboot after a firmware update docker fails to install, so reboot allways to be sure.

curl -fsSL https://get.docker.com -o get-docker.sh #Source: https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script
sudo sh get-docker.sh
sudo usermod -aG docker pi
sudo reboot #To apply last command
docker run --name hello-world hello-world
docker container ls -a
docker stop hello-world && docker rm hello-world

Now Docker is correctly installed and it is working (last line deletes the example dock). So we start to install Partkeepr, we can't use the instructions provided on this repository because the mariadb doesn't work on Raspberry Pi. The imported files will be stored on a folder, that we create (I copy the files using VNC and an USB flash memory):

docker network create partkeepr
cd ~ && mkdir partkeepr && cd partkeepr && mkdir containerfiles #And put on this folder your old data

Now we create the BD, on the network, using a docker that runs on Raspberry and using the 3310 port:

docker run --name pkdb --net partkeepr -p 3310:3306 -v /home/pi/partkeepr/containerfiles/db:/var/lib/mysql -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_DATABASE=partkeepr -e MYSQL_USER=partkeepr -e MYSQL_PASSWORD=partkeepr -d linuxserver/mariadb

Optionally install the phpmyadmin to see the BD and make the backups (webpage port 8081):

docker run --name pkdbadmin --net partkeepr -p 8081:80 --link pkdb:mysql -e PMA_HOST=pkdb phpmyadmin;

Finally start the partkeepr web on our Raspberry Pi:

docker run -p 8080:80 --name pkweb --net partkeepr --link pkdb:db -v /home/pi/partkeepr/containerfiles/data:/app/data/ -v /home/pi/partkeepr/containerfiles/config:/app/app/config -d f0rc3/partkeepr:multiarch-latest

Go to http://raspberrypi.local:8080/setup/ and install Partkeepr, on Database Parameters use this:
dbdata
Do not close your console, we still need some commands (last one is mandatory while the setup process):

docker exec -it pkweb php /app/app/console cache:warmup
docker exec -i pkweb chmod 777 -R /app/app/cache/  #Only when we import old data and if it fails
docker exec -i pkweb chmod 777 -R /app/data/       #Only when we import old data and if it fails
docker exec -i pkweb chmod 777 -R /app/app/config/ #Only when we import old data and if it fails
docker exec -it pkweb cat /app/app/authkey.php

Finally, if we reboot the Raspberry Pi, with this simple command we can start all again:
docker start pkdb pkweb pkdbadmin

Now found problems or possible improvements:

PHP warning on setup

I don't know how to fix this PHP error with APCu cache:
error apcu cache

Importing database

My old database is a 270KiB file, it fails to import using the phpmyadmin and importing using the Partkeepr setup (I think that is a timeout). I tried using the console with this command and takes about 45 minutes but it works:

docker exec -i pkdb mysql -upartkeepr -ppartkeepr partkeepr < /home/pi/partkeepr/containerfiles/db/database.sql

Importing files

I think that is related with the cache or maybe some timeout (it takes a lot of time "Warming up the cache") but I can't finish the install if I import my old data (10MiB the "data" folder and 110KiB the "config" folder):
error importing
When use next command it works, but there is any way to do this step default when we choose multiarch-latest?
docker exec -it pkweb php /app/app/console cache:warmup

Network

I made a network called partkeepr to improve the connection on setup but it doesn't work and on the DB step. It works when I use the router's network IP or the Raspberry hostname:
hostname

I'm very new on Docker I know that this install can be improved with your help (and fix some or all of problems that I found). If we make an easy instructions and provide some way to export the data to make regular backups it will be very useful to make this docker the better choice as main install of partkeepr (maybe when we finish this we can think on improve security using Let's Encrypt but now we will suppose that our internal network is secure and if we need external access we can use any VPN Docker to see the webpage).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions