We have a PartKeepr running in the space.
Install
- Create container (debian 9, 8GB, 1 core, 1GB ram)
- Create separate volume for the install/data, this needs extra inodes because symfony2 caches everything on disk (lots of tiny files), so with regular use the fs will run out:
lvcreate -n parts_data -V 10G --thinpool vmstore vmdata mkfs -t ext4 -N 3000000 /dev/mapper/vmdata-parts_data
Mount the data-volume in the container:
mp0: volume=/dev/mapper/vmdata-parts_data,mp=/srv/partkeepr
Disable apt-recommends in /etc/apt/apt.conf:
APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;
Install needed packages:
apt-get install git nginx php7.0 php7.0-fpm php7.0-ldap php7.0-bcmath php7.0-gd php7.0-xml php7.0-curl php7.0-pgsql php7.0-intl
Grab partkeepr source:
git clone https://github.com/partkeepr/PartKeepr.git # clones PartKeepr in the PartKeepr subdirectory. cd PartKeepr cp app/config/parameters.php.dist app/config/parameters.php # copies the default parameters to ensure composer can run.
Install composer and run:
cd /srv/partkeepr/PartKeepr/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" ./composer.phar install # Installs all PartKeepr requirements
Make sure dirs are writeable (somehow symlinks didn't work):
chown -R www-data:www-data app/ chown -R www-data:www-data web/ chown -R www-data vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/ chown -R www-data src/PartKeepr/ImageBundle/Resources/public/ chown -R www-data vendor/brainbits/fugue-icons-bundle/src/Brainbits/FugueIconsBundle/Resources/public/ chown -R www-data src/PartKeepr/FrontendBundle/Resources/public/ chown -R www-data src/PartKeepr/MobileFrontendBundle/Resources/public/ chown -R www-data vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/public/ chown -R www-data src/PartKeepr/MimetypeIconsBundle/Resources/public/
Migration from ancient install
Postgres-db is old, needs some special fields with default values:
ALTER TABLE tempuploadedfile ADD created TALTER TABLE siprefix ADD base INT NOT NULL DEFAULT 0; ALTER TABLE partkeepruser ADD legacy BOOLEAN NOT NULL DEFAULT False; ALTER TABLE partkeepruser ADD active BOOLEAN NOT NULL DEFAULT False; ALTER TABLE partkeepruser ADD protected BOOLEAN NOT NULL DEFAULT False; ALTER TABLE footprintimage ADD created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL DEFAULT current_timestamp; ALTER TABLE footprintattachment ADD created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL DEFAULT current_timestamp; ALTER TABLE footprintcategory ADD lvl INT NOT NULL DEFAULT 0; ALTER TABLE part ADD removals BOOLEAN NOT NULL DEFAULT False; ALTER TABLE part ADD lowStock BOOLEAN NOT NULL DEFAULT False; UPDATE part SET averageprice = 0 WHERE averageprice IS NULL; ALTER TABLE partcategory ADD lvl INT NOT NULL default 0; ALTER TABLE partattachment ADD created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL default current_timestamp; ALTER TABLE manufacturericlogo ADD created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL default current_timestamp;