Migrating a group from eLAS 3.x to eLAND
- Upload the SQL dump file to the server:
scp mysystemdumpfile.sql firstname.lastname@example.org:mysystemdumpfile.sql
In eLAND all Systems are stored as schemas in one database. First create an empty public schema where the dump will be imported into.
Log into postgres:
dokku postgres:connect databasename
create schema public;
You can import a dump file you made previously with pg_dump with options --no-acl --no-owner (no custom format).
Or, use on of the dokku-postgres commands according to the format of the file.
The tables of the imported System are now in the default schema named public. You can truncate the city_distance table which is not used anymore and which is more than a 1M rows big.
TRUNCATE TABLE city_distance;
In eLAS there are only 2 levels of access for contacts. Public and private. In eLAND public is further divided in 'members' and 'interSystem'. To keep consistent the 'public' access level of eLAS should be transformed into the 'interSystem' access level of eLAND.
UPDATE contact SET flag_public = 2 where flag_public = 1;
Coming from eLAS +3.6 run also the following to undo some database changes:
alter table users add column "PictureFile" character varying(128); alter table msgpictures add column "PictureFile" character varying(128); update users u set "PictureFile" = trim(leading 'userpictures/' from f.path) from files f where f.fileid = u.pictureid; update msgpictures m set "PictureFile" = trim(leading 'msgpictures/' from f.path) from files f where f.fileid = m.pictureid; update parameters set value = '31000' where parameter = 'schemaversion';
Rename then the public schema to the System code
ALTER SCHEMA public RENAME TO abc;
This way of importing Systems leaves the already present Systems data untouched. This can not be done with the Heroku tools.
- Match a subdomain to a schema with config variable
In domain all characters must be converted to uppercase.
dokku config:set appname SCHEMA_FLUPKE=flupke
matches flupke.my-domain.com to database schema flupke.
The overall domain my-domain.com was set with
dokku config:set appname OVERALL_DOMAIN=my-domain.com
- Resize all image files from folders msgpictures and userpictures (image files in eLAS were up to 2MB) at least down to 200kB, but keep the same filename (the extension may be renamed to one of jpg, JPG, jpeg, JPEG).
You can use imagemagick for this:
cd userpictures mogrify -resize 400x400 -quality 100 -path ../imgs *.jpg cd ../msgpictures mogrify -resize 400x400 -quality 100 -path ../imgs *.jpg
Upload the image files to your S3 bucket (no directory path. The image files are prefixed automatically in the next step). Make the image files public. Use the awscli
cd ../imgs aws s3 sync . s3://img.letsa.net
The aws s3 sync command can also be used to take a backup on your local machine:
cd destination-directory aws s3 sync s3://img.letsa.net .
- Log in with admin rights to your website (you can use the master login and password) go to path
/init.phpThe image files get renamed with a new hash and orphaned files will be cleaned up.
The files get prefixed with the schema name and the user or message id. All extensions become jpg. ie. abc_u_41_c533e0ef9491c7c0b22fdf4a385ab47e1bb49eec.jpg abc_m_71_a84d14fb1bfbd1f9426a2a9ca5f5525d1e46f15e.jpg
- The init procudure copies the images and gives them a new name. The original images, the filename not starting with a schema name but with a number, can be removed manually from the S3 bucket, with the AWS webinterface.