Difference between revisions of "Parts"

From NURDspace

Jump to: navigation, search
(Todo)
(Todo)
Line 29: Line 29:
 
* <s>Move container from dhcp range to vm.nurd.space range (fixed IP from IPAM)</s>
 
* <s>Move container from dhcp range to vm.nurd.space range (fixed IP from IPAM)</s>
 
* Fix postgres container or install a new one with the old database (it has issues starting services and has 3 postgres versions installed).
 
* Fix postgres container or install a new one with the old database (it has issues starting services and has 3 postgres versions installed).
* Print missing drawers
+
* Print missing drawers (13x small, 2x medium, 1x large)
 
* Print missing barcodes
 
* Print missing barcodes
 
* Put barcodes on the right drawers
 
* Put barcodes on the right drawers
 
* Rename original RED cabinet to RED-K
 
* Rename original RED cabinet to RED-K
 
+
*<s>Put labelled drawers in right position</s>
=== Put labelled drawers in right position ===
+
*RED-A
+
*RED-B
+
*RED-C
+
*RED-D
+
*RED-E
+
*RED-F
+
*RED-G
+
*RED-H
+
*RED-I
+
*RED-J
+
*RED-K
+
  
 
== Installation log ==
 
== Installation log ==

Revision as of 19:03, 1 February 2020

Parts
Partkeepr logo.png
Participants
Skills postgres, php, sysadminning
Status Production
Niche Infra
Purpose Infra
Tool Yes
Location Coherence
Cost
Tool category

Parts

Partkeepr_logo.png {{#if:Yes | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:Yes | [[Tool Cost:: | }}


What

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

Cannot login?

Try clearing browser cache.

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)
  • Fix postgres container or install a new one with the old database (it has issues starting services and has 3 postgres versions installed).
  • Print missing drawers (13x small, 2x medium, 1x large)
  • Print missing barcodes
  • Put barcodes on the right drawers
  • Rename original RED cabinet to RED-K
  • Put labelled drawers in right position

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.

 
Our site is hosted by Site4U
Site4U
Our connectivity is made available by BIT
To BIT's website