ace-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Offermans <marcel.offerm...@luminis.nl>
Subject Re: Where does Ace server store everything?
Date Tue, 06 Aug 2013 21:34:25 GMT
Hello Matthew,

On Aug 6, 2013, at 23:10 PM, Matthew Bishop <matt@thebishops.org> wrote:

> On Tue, Aug 6, 2013 at 1:58 PM, Marcel Offermans <
> marcel.offermans@luminis.nl> wrote:
> 
>> To give you another example, we recently automated our continuous build
>> system so for each succesful build it takes the artifacts that come out of
>> that build and (through a GoGo Shell script) upload them to a repository
>> and then create all the metadata in ACE. The end result is that we can
>> automatically deploy such code directly to our QA and demo environments,
>> completely automated.
> 
> Is this gogo script checked into ACE somewhere? It is definitely an
> interesting part of the story. I am working my backwards from the end
> deployment story to the developer, as we did it developer-first and ended
> up with pax and maven on the production server. Not cool.

It is not, because it is specific to our environment. The GoGo commands are something we only
very recently added, so they're not documented well yet.

However, I have adapted the script we use a bit (taking out the specific bits). It probably
requires some more context to be fully understood, and probably Bram can answer some more
detailed questions about it (he wrote the script). Basically it takes the artifacts from a
build, checks if they are really different from the ones we already deployed the previous
time, uploads all changed artifacts and configures ACE. We run this script with a client jar
from the ACE distribution, and configure it as the startup script. As soon as the script is
done, we shutdown this client again.


#
# Continuous deployment gogo script
#

# environment variables we import here
targetrepourl = "$DEPLOYMENT_TARGETOBR_URL"
releaserepourl = "$DEPLOYMENT_RELEASEOBR_URL"
autoconfurl = "$DEPLOYMENT_AUTOCONF_URL"

sourceindex = (repo:index /tmp/ace-cdeploy)
sourcerepo  = (repo:repo R5 $sourceindex)
targetrepo = (repo:repo OBR $targetrepourl)
releaserepo = (repo:repo OBR $releaserepourl)

echo "Deploying release resources"
deployed = repo:cd $releaserepo $sourcerepo $targetrepo

echo "Ensuring autoconf resource"
autoconf = (coll:first ($targetrepo find "(osgi.identity=org.apache.felix.deployment.rp.autoconf)"))
if { $autoconf } { echo " -> exists" } \
{ 
  repo:d $targetrepo $autoconfurl
  autoconf = (coll:first ($targetrepo find "(osgi.identity=org.apache.felix.deployment.rp.autoconf)"))
  echo " -> deployed"
} 

echo "Opening client workspace"
workspace = (ace:cw)

echo "Ensuring cdtarget exists"
target = (coll:first ($workspace lt "(id=cdtarget)"))
if { $target } { echo " -> exists" } \
{ 
  $workspace ct "cdtarget"; 
  target = (coll:first ($workspace lt "(id=cdtarget)"))
  echo " -> created" 
}

echo "Ensuring cdtarget is registered"
if { $target isRegistered } { } { $target register }

echo "Ensuring cdtarget is !autoapprove"
$target setAutoApprove false

# here we set some specific properties used by our configurations (anonymized)
$target addTag "domain" "foo.com"
$target addTag "ip-address" "127.0.0.1" 
$target addTag "timezone" "Europe/Amsterdam"

echo "Ensuring cdfeature exists"
if { (coll:first ($workspace lf "(name=cdfeature)")) } { echo " -> exists" } { $workspace
cf "cdfeature"; echo " -> created" }

echo "Ensuring cddistribution exists"
if { (coll:first ($workspace ld "(name=cddistribution)")) } { echo " -> exists" } { $workspace
cd "cddistribution"; echo " -> created" }

echo "Ensuring f2d association"
if { (coll:first ($workspace lf2d "(leftEndpoint=*name=cdfeature*)")) } { echo " -> exists"
} { $workspace cf2d "(name=cdfeature)" "(name=cddistribution)" "1" "1"; echo " -> created"
}

echo "Ensuring a2f association"
if { (coll:first ($workspace la2f "(rightEndpoint=*name=cdfeature*)")) } { echo " -> exists"
} { $workspace ca2f "(cdartifact=true)" "(name=cdfeature)" "10000" "1"; echo " -> created"
}

echo "Ensuring d2t association"
if { (coll:first ($workspace ld2t "(leftEndpoint=*name=cddistribution*)")) } { echo " ->
exists" } \
  { $workspace cd2t "(name=cddistribution)" "(id=*)" "1" "1000"; echo " -> created" }

echo "Ensuring autoconf artifact"
if { (coll:first ($workspace lrp)) } { echo " -> exists" } \
{ 
  identity = $autoconf getIdentity
  version = $autoconf getVersion
  name = "$identity - $version"
  url = $autoconf getUrl
  mimetype = $autoconf getMimetype
  $workspace ca [ artifactName="$name" url="$url" mimetype="$mimetype" Bundle-SymbolicName="$identity"
Bundle-Version="$version" Deployment-ProvidesResourceProcessor="org.osgi.deployment.rp.autoconf"
]
  echo " -> created"
}

echo "Purging old artifacts"
artifacts = ($workspace la)
each $artifacts {
  $workspace da $it
}

echo "Creating new artifacts"
each $deployed {
  identity = $it getIdentity
  version = $it getVersion
  name = "$identity - $version"
  url = $it getUrl
  mimetype = $it getMimetype
  if { $mimetype equals "application/xml:osgi-autoconf" } \
  { $workspace ca [ artifactName="$name" url="$url" mimetype="$mimetype" filename="$name"
processorPid="org.osgi.deployment.rp.autoconf" ] [ cdartifact="true" ] } \
  { $workspace ca [ artifactName="$name" url="$url" mimetype="$mimetype" Bundle-SymbolicName="$identity"
Bundle-Version="$version" ] [ cdartifact="true"] }
}

echo "Ensuring approval on target"
if { $target needsApprove } { echo " approving"; $target approve } { echo " no changes" }

echo "Committing workspace"
$workspace commit

# Let events settle
misc:sleep 2000
ace:rw $workspace

# Let events settle
misc:shutdown 2000


Greetings, Marcel


Mime
View raw message