Using an 'artifact' repo results in bad links and bad dist files
Using an artifact repository results in bad links, and misnamed files in the dist directory.
{
"name": "My Repository",
"homepage": "http://localhost/artifacts",
"repositories": [
{ "type": "artifact", "url": "./packages" }
],
"archive": {
"directory": "dist",
"format": "tar"
},
"require-all": true
}
creates links like: http://localhost/artifacts/dist/local-mypackage-1.0.5.7-local-mypackage-1.0.5.7.zip.tar as well as the corresponding .zip.tar files in dist
What do you mean by links? I don't see how the homepage is connected to the artifact repo at all.. Or is the problem only occurring when creating archives? Please give more details.
Ah nevermind I missed the fact that this was reported on the satis repo, it makes more sense now ;)
Is this still an issue?
The problem lies in the fact that the artifact repository's url parameter, which represents the path the artifacts reside in on the filesystem, is being used to form the package URL. Since the artifacts need to be exposed in the webroot (ie. the output dir for the satis build command), there's a mismatch between the physical location on the filesystem and the relative path to the package from Satis' web root.
I've tagged this issue in a commit on a fork I made of this repo. The fix is by far complete; I'm new to Satis and this is what I've been able to come up with after an hour or so trying to reverse engineer the way it works. Maybe the commit illustrates the problem and someone's able to come up with a more robust fix.
is this merged? facing the same issue!
Merged? This is an issue, not a pull-request.
Yep. I thought @leonboot would have already sent the pull request, as he fixed it over a year ago! :)
@jtanmay-dev I haven't filed a pull request, since I'm not sure the fix is complete or even correct. I haven't studied the innards of Satis well enough, so I thought I'd share what I did as a pointer for someone more qualified. But given the fact it's been over a year ago, I might have to consider having a second go at it and improve upon the fix and file a PR.
Here's a workaround to use the fix @leonboot made:
git remote add nedbase https://github.com/nedbase/satis.git
git pull all
git cherry-pick fb54ffc2b5
Note: You have to add a url-prefix for the location of the zips, eg:
{ "type": "artifact", "url": "zips", "url-prefix": "https://your.url.here/zips/" },
I created a sh script that replaces the relative url with an absolute url after generating the package lists
cd satisfy && /opt/plesk/php/7.1/bin/php bin/satis build satis.json web \;
cd web/include && find . -type f -exec sed -i 's#"url": "packages/#"url": "https://packages.example.org/packages/#g' {} \;
Hi I found a workaround without using fix or additional scripts
I created a folder /data where I put module zip files
I have the following satis configuration:
{
"name": "My Composer Repo",
"homepage": "http://satis.mydomain.com/" ,
"repositories": [
{
"type": "artifact",
"url": "/data"
}
],
"archive": {
"directory": "data",
"format": "zip",
"prefix-url": "http:/satis.mydomain.com"
},
"require-all":true,
"require-dependencies":true,
"require-dev-dependencies":true,
"minimum-stability":"dev"
}
This way satis finds the zips and indexes them. But at this point you are not able to download a zip file.
You also have to add a symlink: ln -s /data/ /satisfy/web/
Now everything works.