-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next round of refactoring #35
Merged
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fc7fe1d
fix: namespaces and package info
line-o cbeaa09
feat: backup and restore existing configuration
line-o c94469b
fix: expath package dependencies, bump version
line-o 86d0301
fix(api): error constructing status xml
line-o 1229819
refactor: rename blacklist to ignore
line-o 96287f9
refactor: optmise api handlers
line-o 9d439dc
fix(api): check collection parameter value
line-o e1d2713
fix(api): several issues with deployment
line-o 262567e
chore: remove unused files
line-o c10fbcd
style: min-height for main page
line-o 84d8926
fix(controller): tighten security, remove cruft
line-o 4d85d75
chore(app): rename one function
line-o 8acbc8a
chore: fix xqdoc
line-o 39a97ff
doc(api): clarify function purpose
line-o e4c209e
doc(api): clarify code checking for errors
line-o 8ca00a7
fix(controller): tighten security for api.json
line-o 4cd2919
fix(controller): cache-control for static files
line-o File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
xquery version "3.1"; | ||
|
||
declare namespace sm="http://exist-db.org/xquery/securitymanager"; | ||
|
||
(: TODO: $target is not set in cleanup phase :) | ||
declare variable $configuration-collection := "/db/apps/tuttle/data/"; | ||
declare variable $backup-collection := "/db/tuttle-backup/"; | ||
declare variable $configuration-filename := "tuttle.xml"; | ||
|
||
(: backup tuttle configuration :) | ||
if (not(xmldb:collection-available($backup-collection))) | ||
then ((: move/copy to collection :) | ||
util:log("info", "Creating configuration backup collection"), | ||
xmldb:create-collection("/db", "tuttle-backup"), | ||
sm:chmod(xs:anyURI($backup-collection), "rwxr-x---") | ||
) | ||
else () | ||
, | ||
util:log("info", "Backing up configuration"), | ||
xmldb:move($configuration-collection, $backup-collection, $configuration-filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<tuttle> | ||
<repos> | ||
<collection name="tuttle-sample-data"> | ||
<!-- optional: make _one_ repository the default | ||
for endpoints without {collection} | ||
--> | ||
<default>true</default> | ||
|
||
<!-- which sercive to connect to --> | ||
<type>github</type> | ||
<baseurl>https://api.github.com/</baseurl> | ||
|
||
<!-- necessary to provide for GitHub --> | ||
<owner>eeditiones</owner> | ||
<repo>tuttle-sample-data</repo> | ||
|
||
<!-- branch to pull from --> | ||
<ref>next</ref> | ||
|
||
<!-- authenticate against remote service, | ||
can also be read from environment variables --> | ||
<token>XXX</token> | ||
|
||
<!-- only necessary if you need the service to call tuttle --> | ||
<hookuser>admin</hookuser> | ||
<hookpasswd></hookpasswd> | ||
</collection> | ||
|
||
<collection name="tuttle-sample-gitlab"> | ||
<!-- which sercive to connect to --> | ||
<type>gitlab</type> | ||
<baseurl>https://gitlab.com/api/v4/</baseurl> | ||
|
||
<!-- this is not needed for Gitlab but can be added for human consumption --> | ||
<owner>line-o</owner> | ||
<repo>tuttle-sample-data</repo> | ||
|
||
<!-- necessary to provide for Gitlab --> | ||
<project-id>50872175</project-id> | ||
|
||
<!-- branch to pull from --> | ||
<ref>main</ref> | ||
|
||
<!-- authenticate against remote service, | ||
can also be read from environment variables --> | ||
<token>XXX</token> | ||
|
||
<!-- only necessary if you need the service to call tuttle --> | ||
<hookuser>admin</hookuser> | ||
<hookpasswd></hookpasswd> | ||
</collection> | ||
</repos> | ||
|
||
<!-- these files will not be extracted from archives and left untouched when cleaning up --> | ||
<ignore> | ||
<file>existdb.json</file> | ||
<file>build.xml</file> | ||
<file>README.md</file> | ||
<file>.gitignore</file> | ||
<file>expath-pkg.xml.tmpl</file> | ||
<file>repo.xml.tmpl</file> | ||
<file>build.properties.xml</file> | ||
</ignore> | ||
|
||
<!-- prefix, suffix, lock and apikeys can usually be left as-is --> | ||
<config prefix="/db/apps/" suffix="-stage" lock="git-lock.xml" apikeys="/db/system/auth/tuttle-token.xml"> | ||
<!-- | ||
The permissions the deployed data gets assigned, if no expath-pkg.xml is found. | ||
The initial setting is safe, but this can and should be adapted to your requirements. | ||
--> | ||
<sm user="admin" group="dba" mode="rw-r-----"/> | ||
</config> | ||
</tuttle> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package | ||
xmlns="http://expath.org/ns/pkg" | ||
name="http://e-editiones.org/tuttle" | ||
abbrev="tuttle" version="1.2.0" spec="1.0"> | ||
<title>Tuttle - Git for eXist-db</title> | ||
<dependency processor="http://exist-db.org" semver-min="5.5.1"/> | ||
<dependency package="http://e-editiones.org/roaster" semver-min="1.0.0"/> | ||
<dependency package="http://exist-db.org/apps/shared" semver-min="0.9.1"/> | ||
<dependency package="http://expath.org/ns/crypto" semver-min="5.0.0"/> | ||
<package xmlns="http://expath.org/ns/pkg" spec="1.0" | ||
name="http://e-editiones.org/tuttle" abbrev="tuttle" version="2.0.0"> | ||
<title>Tuttle - Git for eXist-db</title> | ||
<dependency processor="http://exist-db.org" semver-min="5.5.1" semver-max="6" /> | ||
<dependency package="http://e-editiones.org/roaster" semver-min="1.0.0"/> | ||
<dependency package="http://expath.org/ns/crypto" semver-min="5.0.0"/> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
xquery version "3.1"; | ||
|
||
declare namespace sm="http://exist-db.org/xquery/securitymanager"; | ||
|
||
(: the target collection into which the app is deployed :) | ||
declare variable $target external; | ||
|
||
declare variable $configuration-collection := $target || "/data/"; | ||
declare variable $backup-collection := "/db/tuttle-backup/"; | ||
declare variable $configuration-filename := "tuttle.xml"; | ||
|
||
(: look for backed up tuttle configuration :) | ||
if (doc-available($backup-collection || $configuration-filename)) | ||
then ((: move/copy to collection :) | ||
util:log("info", "Restoring tuttle configuration from backup."), | ||
xmldb:move($backup-collection, $configuration-collection, $configuration-filename), | ||
xmldb:remove($backup-collection) | ||
) | ||
else ((: copy example configuration when no backup was found :) | ||
util:log("info", "No previous tuttle configuration found."), | ||
xmldb:copy-resource( | ||
$configuration-collection, "tuttle-example-config.xml", | ||
$configuration-collection, $configuration-filename | ||
) | ||
) | ||
, | ||
(: tighten security for configuration file :) | ||
sm:chmod(xs:anyURI($configuration-collection || $configuration-filename), "rw-r-----") | ||
, | ||
(: set gid for API :) | ||
sm:chmod(xs:anyURI($target || "/modules/api.xql"), "rwxr-sr-x") | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment on mattermost, I d really prefer a collection name that is more flexible for other apps as well, and won't lead to one collection per app with similar demands. so far we only have
system
andapp
following thedb
root collection. Lets create a third location for this kind of backup filesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do favour a broader solution as well. Please understand that this is not the right moment to set de-facto standards and the collection in this case is very short-lived. The entire
/db/tuttle-backup
is removed after installation.And I would also prefer to discuss a general solution within the community not just among us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy to discuss a general solution with the community. I just don't see what we gain there, by adopting a single use solution now, instead of one that is open to extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we choose a collection name that is
a) the one other apps will be using then it needs extra protection from removal and will have to stay there even if unused
b) not the one we are choosing here, the code has to be changed anyway