implementation of community package manager

29
Implementation of Community Package Manager Dmitry Maslennikov Timur Safin

Upload: timur-safin

Post on 16-Jul-2015

135 views

Category:

Software


4 download

TRANSCRIPT

Implementation of Community Package Manager

Dmitry Maslennikov

Timur Safin

We have full cycle in

CPM

(publish – install)

Where we are today?

Create/

modify

package

Export

XML/JSON

to staging

area

npm

publish to

repo

Package

search in

repo

Install

package

from repo

Creating Caché Package ManagerImplementation Update

• Which container format is the suitable for our packages?

– ZIP would be ideal

– But even Studio Project XML will fit the purpose

• even now it handles all interesting file types (CLS, RTN, INC, CSP, ZEN, CSS, GIF, etc.)

• Yes, XML is very inefficient, bloated, and keeps binary data as base64

(i.e. 3/2x length increase)

• But it’s not a big deal for initial step;

Container Format

Plans – December 2014

Which

Container?

ZIP

XML

Plans – December 2014

• What information should be in metadata?

– At least dependency on other packages (name, version, url);

– Anything from Node.js package.json could be reused by us, but;

• JSON is not yet natively supported now,

so could start from XML serialization of the same information (metainfo.xml)

Metadata File

{ "dependencies" :

{ "foo" : "1.0.0 - 2.9999.9999"

, "bar" : ">=1.0.2 <2.1.2"

, "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"

, "asd" : "http://asdf.com/asdf.tar.gz"

, "til" : "~1.2"

, "elf" : "~1.2.3"

, "lat" : "latest"

, "dyl" : "file:../dyl"

}

}

Reality – March 2015

• We decided to use npm services for publishing to the server;

• It accepts package.json as metadata description;

• npm packs generated XML file to the .TGZ container which is being published to the repo;

Container and metadata formats

export /minor

package

CPMpackage/package.json

package/package.xml

package/package.tgz

NPM/-/all/ - JSON index

CouchDB

Plans – December 2014

• There is tough problem to handle – dependency on a system packages which may be

presented only on some product flavors:

– iKnow,

– Ensemble

– DeepSee,

– TrakCare,

– HealthShare,

– particular version of product

• May mark this dependency in the general dependency list as “iKnow”, “Ensemble

2013.1+”, etc.

• But it’s too early to handle in the 1st iteration - we will revisit this later.

Dependency on a system classes

Dependencies

Not in V0.1

Reality – March 2015

Plans – December 2014

• From the practical prospective, taking into accountmultiple Caché platforms we should handle equallywell (Windows, Linux, Mac OS X, or even VMS), andthe fact that these FFI mechanisms are not yet officiallysupported, we should admit that they are not readyyet, and could not be recommended as a way tohandle deploymenut of mixed C/COS packages.

• We are not implementing them in v1.0

[Cross-platform] binary modules

Not in V0.1

Reality – March 2015

[Cross-platform] binary modules

Plans – December 2014

• Having built-in mechanism for unit-testing has impacted positively the whole stability of

CPAN ecosystem.

– Package will not be installed at the user system unless it’s passing internal testing;

• V1.0 will ignore unit-testing for a moment, but later, for binary modules deployment we

should have unit-testing working

Unit-testing

Unit-testing

Not in V0.1

Reality – March 2015

Plans – December 2014

• User experience is a big success booster, if system is inconvenient then it may be

left unnoticed*

• So both ways to invoke package manager should be working

– To invoke package manager shell from any namespace in Cache’ terminal, .e.g

– To install COS packages from command-line, e.g.

• Eventually these operation might be wrapped in GUI. Not in V1.0

Command-line access

do ^%CPM>install TOML-Parser

cpm install deepsee-mobile-server

• Command-line wrapper

created for Windows cpm.bat,

which invokes default Caché

instance with the command-

line options entered;

• Only single running instance

handled today;

Command-line access

Reality – March 2015

C:\Users\Timur\Documents\Intersystems\src\CPM\bin>cpm list

cpm-installer-sample 0.5.2simple-proj 0.4.2

C:\Users\Timur\Documents\Intersystems\src\CPM\bin>cpm list /verbose

cpm-installer-sample 0.5.2Sample.Address.clsSample.Company.clsSample.Customer.clsSample.Employee.clsSample.Person.clsSample.USZipCode.clsSample.Utils.clsSample.Vendor.clssimple.prj

simple-proj 0.4.2Sample.Address.CLSSample.Company.CLSSample.Customer.CLSSample.Employee.CLSSample.Person.CLS

Plans – December 2014

• There used to be old-dark times when every site had to handle DDoS on their own way,

and to keep geo-spread mirror network for their purposes;

• Now all is easily handled by VM host providers or special CDN providers:

– Amazon Azure, Google Cloud, etc;

– Amazon CloudFront, MaxCDN, etc;

• Once we have static files (distributions files, static html descriptions, static images, etc) it

could be easily handled by CDN;

• But… for community site we supposed to have some dynamic part which will work with

authors and new contributions

Advices are welcome how to handle this mix easily and in most effective way

Mirroring and CDN

Reality – March 2015

• We have selected CouchDB database hosting for keeping packages metadata and their

content;

• CouchDB is the JSON database store accessible via full RESTful API;

• Same/similar database store is used for keeping NPM.js repository;

– Thus we could use npm command-line utility for operations with this store if repository

redefined to ours;

Mirroring and CDN CouchDB repository

CouchDB repository

Reality – March 2015

There is fancy web yet!

Plans – December 2014

Suggested usage cases for V1.0

Package User COS System COS Binaries Good for v1.0

iKnowSocial Yes No No Good

Atom-COS-Studio Yes Yes Yes

(Atom +

extension)

Bad

WebTerminal No Yes No Good

CNA Yes No Yes

(callout module)

Bad

Coslint Yes

(deployed

OBJ code)

No No Probably

(deployed)

Actual usage cases for V0.1

Reality – March 2015

Package User COS System COS

Cache-tort-git Yes Yes

iKnowSocial Yes No

Monlbl-viewer Yes No

WebTerminal Yes Yes

Simple-proj Yes No

Cpm-installer-sample Yes No

• Help, H, ?

• Quit, Q

CPM Shell Commands

• List, L

CPM Shell Commands

• List /verbose

CPM Shell Commands

• Install, I

– From repo

– From local file(s)

CPM Shell Commands

• Package, P

– /create /from

– /description

– /author

CPM Shell Commands

CPM:CPM>> package /create cache-tort-git /author adaptun/from \path\to\cache-tort-git\Load of directory started on 03/16/2015 15:11:45

Loading file C:\Users\Timur\Documents\GitHub\cache-tort-git\cache-tort-git.prj…Imported project: cache-tort-git.prjLoading file C:\Users\Timur\Documents\GitHub\cache-tort-git\%SourceControl\Git…Imported class: %SourceControl.GitLoading file C:\Users\Timur\Documents\GitHub\cache-tort-git\%SourceControl\Git…Imported class: %SourceControl.Git.UtilsLoading file C:\Users\Timur\Documents\GitHub\cache-tort-git\csp\gitprojectset…Imported CSP/CSR or file: csp/cpm/gitprojectsettings.csp

Compilation started on 03/16/2015 15:11:46 with qualifiers 'ck', compiling 2 classes, using 4 worker jobsCompiling class %SourceControl.Git.UtilsCompiling class %SourceControl.Git

• Export, E

– /minor

– /major

CPM Shell Commands

CPM:CPM>> export /major cache-tort-gitcache-tort-git version set to: 0.1.1

Exporting package files to: C:\InterSystems\CacheLatest\.cpm\cache-tort-gitDeleted all files in the directory:

Exporting to XML started on 03/16/2015 15:12:04Exporting class: %SourceControl.Git.UtilsExporting class: %SourceControl.GitExporting project: cache-tort-git.prjExporting CSP/CSR or file: /csp/cpm/gitprojectsettings.cspExport finished successfully.

• Npm publish

Command-Line

C:\InterSystems\CacheLatest\.cpm\cache-tort-git>npm publish --registry http://cpmiscregistry.couchappy.com+ [email protected]

CPM: Contributors [Still] Invited!

• Every respected repository has good name and an appropriate avatar;

• We will appreciate any suggestion about CPM URL name and avatar!

Name and avatar suggestions

Идём!