Parts: Difference between revisions

From NURDspace
No edit summary
Line 1: Line 1:
== What ==
== What ==
We have a [https://partkeepr.org PartKeepr] running in the space. For user/login see partkeepr pc.
We have a [https://partkeepr.org PartKeepr] running in the space. For user/login see partkeepr pc.
You can find it at https://parts.dhcp.nurd.space (within space) or https://parts.nurdspace.nl/ (outside).
You can find it at https://parts.vm.nurd.space (within space) or https://parts.nurdspace.nl/ (outside).


== Updating inventory ==
== Updating inventory ==
Line 11: Line 11:


== Todo ==
== Todo ==
* Move container from dhcp range to vm.nurd.space range (fixed IP from IPAM)
* <s>Move container from dhcp range to vm.nurd.space range (fixed IP from IPAM)</s>
* Run https://parts.nurdspace.nl/setup/ again (user henk, pass the usual)
* Run https://parts.nurdspace.nl/setup/ again (user henk, pass the usual)
* For the above, we need to fix a timeout setting, it times out after 60 secs while checking prerequisites
* For the above, we need to fix a timeout setting, it times out after 60 secs while checking prerequisites

Revision as of 21:21, 29 January 2020

What

We have a PartKeepr running in the space. For user/login see partkeepr pc. You can find it at https://parts.vm.nurd.space (within space) or https://parts.nurdspace.nl/ (outside).

Updating inventory

When you grab or add parts, please update the inventory of the little drawer of the red cabinets. A lot of them still needs to be updated. To check the inventory of a drawer:

  • Click on Storage Location field in Filter view @ bottom of the screen
  • Scan drawer barcode with hand scanner attached to the pc
  • Click apply

Todo

  • Move container from dhcp range to vm.nurd.space range (fixed IP from IPAM)
  • Run https://parts.nurdspace.nl/setup/ again (user henk, pass the usual)
  • For the above, we need to fix a timeout setting, it times out after 60 secs while checking prerequisites
  • Fix postgres container or install a new one with the old database (it has issues starting services and has 2 postgres versions installed)

Installation log

  • 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:

cd /srv/partkeepr/
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 in the current dir and run:

./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/

Mod /etc/php/7.0/fpm/php.ini:

date.timezone = Europe/Amsterdam

Configure nginx (please update this config if you make modifications!):

server{
        # from: https://wiki.partkeepr.org/wiki/KB00005:Web_Server_Configuration

        listen 80;
        #listen 443;
        server_name parts parts.nurd.space parts.dhcp.nurd.space;
        root /srv/partkeepr/PartKeepr/web/;
        index app.php index.html;

        charset utf-8;

#       access_log off;
#       log_not_found off;

        access_log /var/log/nginx/parts.access_log;
        error_log /var/log/nginx/parts.error_log;

        sendfile off;

        rewrite ^/setup/webserver-test$ /setup/tests/webservercheck.json;

        location / {
                try_files $uri $uri/ /app.php?$query_string;
        }

        location /setup {
                try_files $uri $uri/ /setup.php?$query_string;
        }

        location ~* \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix://run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
                include fastcgi_params;
#               fastcgi_param HTTPS off;
                fastcgi_intercept_errors off;
                fastcgi_buffer_size 16k;
                fastcgi_buffers 4 16k;
        }

#       location ~ /\.ht {
#               deny all;
#       }
}

See below for the migrations from ancient times, otherwise go to the next step.

Browse to

parts.nurd.space/setup

and fill in all required details.

Fix shit that comes up and update this page with anything you find that doesn't work.

Migration from ancient install

First backup the database!

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;

Copy the

data/

dir from the old install exc. the

proxies

dir.

Parsing legacy config.php didn't work for us, go through setup manually.