ErrorException: copy(/tmp/composer_archive60e5622111255.tar): Failed to open stream: No such file or directory
hannius opened this issue · comments
Hello,
I've deployed a satis instance using the satis.json from k8s :
1、the configmap file is below:
apiVersion:` v1
kind: ConfigMap
metadata:
name: satis-config-cm
namespace: martin-test
data:
satis.json: |-
{
"name": "martin/composer-repository",
"homepage": "https://satis.martin.com",
"require": {
"guzzlehttp/guzzle": "^6.5",
"illuminate/redis": "5.7.*",
"jenssegers/mongodb": "3.4.*",
"laravel/lumen-framework": "5.7.*",
"lcobucci/jwt": "^3.3",
"overtrue/socialite": "^2.0",
"predis/predis": "^1.1",
"ramsey/uuid": "^3.9",
"vlucas/phpdotenv": "~2.2",
"fzaninotto/faker": "~1.4",
"mnabialek/laravel-sql-logger": "^2.2",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0",
"yiisoft/yii2": ">=2.0.13",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"feehi/yii2-swoole": ">=0.0.5",
"feehi/yii2-cdn" : "*",
"yiisoft/yii2-imagine": "^2.1",
"qcloudsms/qcloudsms_php": "0.1.*",
"kartik-v/yii2-widget-select2": "@dev",
"moonlandsoft/yii2-phpexcel": "*",
"kartik-v/yii2-export":"*",
"kartik-v/yii2-widget-datetimepicker":"*",
"kartik-v/yii2-date-range":"dev-master",
"yiisoft/yii2-redis": "^2.0",
"sizeg/yii2-jwt": "^2.0",
"yiisoft/yii2-queue": "^2.3",
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1",
"guzzlehttp/guzzle": ">=4.1.4 <7.0",
"fxp/composer-asset-plugin": "*",
"bower-asset/yii2-pjax": "~2.0.1",
"bower-asset/typeahead.js": "0.10.* | ~0.11.0",
"bower-asset/punycode": "1.3.*",
"bower-asset/jquery": "3.4.*",
"bower-asset/inputmask": "~3.2.2 | ~3.3.5",
"bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*",
"encore/laravel-admin": "1.6.13",
"fideloper/proxy": "~3.3",
"intervention/image": "^2.5",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"maatwebsite/excel": "2.1.30 | 3.0.1 | 3.1.10 | 3.1.15 | 3.1.16 | 3.1.17",
"nesbot/carbon": "^1.29.1",
"qcloud/cos-sdk-v5": "2.0.3",
"filp/whoops": "~2.0",
"symfony/thanks": "^1.0",
"tencentcloud/tencentcloud-sdk-php": ">=3.0.400 < 3.0.410",
"tymon/jwt-auth": "^1.0",
"php-ffmpeg/php-ffmpeg": "^0.18.0"
},
"archive": {
"directory": "dist",
"format": "tar",
"prefix-url": "https://satis.martin.com",
"skip-dev": true
},
"require-all": false,
"require-dependencies": true,
"require-dev-dependencies": true,
"repositories": [
{ "type": "composer", "url": "https://mirrors.aliyun.com/composer/" },
{ "type": "composer", "url": "https://asset-packagist.cn" }
]
}
and i have deployed the satis pod using the persistent volumn that is the way of hostpath
2、the deployment file is below:
apiVersion: apps/v1
kind: Deployment
metadata:
name: satis-app
namespace: martin-test
labels:
app: satis-app
spec:
replicas: 1
selector:
matchLabels:
app: satis-app
template:
metadata:
labels:
app: satis-app
spec:
hostAliases:
- ip: "10.0.3.90"
hostnames:
- "git.martin.com"
- ip: "10.0.3.40"
hostnames:
- "satis.martin.com"
containers:
- name: composer
image: composer/satis:latest
#imagePullPolicy: Always
workingDir: /build
volumeMounts:
- name: build-data
mountPath: /build/output
- name: satis-config-cm
mountPath: /build/satis.json
subPath: satis.json
- name: satis-composer-cm
mountPath: /composer/composer.json
subPath: composer.json
env:
- name: TZ
value: "Asia/Shanghai"
- name: nginx
image: "nginx:1.17.9"
#imagePullPolicy: Always
workingDir: /etc/nginx/conf.d
env:
- name: TZ
value: "Asia/Shanghai"
volumeMounts:
- mountPath: /data/wwwroot/satis
name: build-data
- mountPath: /etc/nginx/conf.d/
name: satis-nginx-cm
- mountPath: /data/logs/nginx
name: satis-logs-pvc
#subPath: nginx
ports:
- name: http
containerPort: 80
protocol: TCP
imagePullSecrets:
- name: qcloudregistrykey
- name: tencenthubkey
volumes:
- name: build-data
#emptyDir: {}
#persistentVolumeClaim:
# claimName: satis-data-pvc
hostPath:
#path: /var/lib/docker/satis_data_modify
path: /var/lib/docker/satis_data
- name: satis-logs-pvc
emptyDir: {}
- name: satis-nginx-cm
configMap:
name: satis-nginx
- name: satis-config-cm
configMap:
name: satis-config-cm
- name: satis-composer-cm
configMap:
name: satis-composer-cm
nodeSelector:
satis: "true"
but when the pod is running, i find the error logs:
could you help me to solve the problem, thanks very much!
I have similar error with similar deployment:
docker-compose:
version: '3'
services:
satis:
image: composer/satis
volumes:
- ./docker-data/build:/build
- ./satis.json:/build/satis.json
- ./ssh-keys:/root/.ssh
- ./docker-data/satis-composer:/composer
- ./auth.json:/composer/auth.json
satis.json:
{
"name": "zzz/www",
"homepage": "https://XXXX",
"repositories": [
{ "type": "vcs", "url": "git@gitlab.com:xxx/yyy.git" }
],
"require": {
"xxx/yyy": "*"
},
"require-all": false,
"require-dependencies": false,
"require-dev-dependencies": false,
"archive": {
"directory": "dist",
"skip-dev": true,
"prefix-url": "https://XXXX",
"checksum": false
}
}
The problem appers somewhere from 2021-07-02 13:30:00 (GMT+0200) (our last successfull build)
EDIT:
I have also some previous error (which I fixed by changing "name" in satis.json):
In RootPackageLoader.php line 76:
[RuntimeException]
Your package name XXX Composer Repository is invalid, it should hav
e a vendor name, a forward slash, and a package name. The vendor and packag
e name can be words separated by -, . or _. The complete name should match
"^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".
the problem appears after updating the latest image of satis
I have similar error with similar deployment:
docker-compose:
version: '3' services: satis: image: composer/satis volumes: - ./docker-data/build:/build - ./satis.json:/build/satis.json - ./ssh-keys:/root/.ssh - ./docker-data/satis-composer:/composer - ./auth.json:/composer/auth.json
satis.json:
{ "name": "zzz/www", "homepage": "https://XXXX", "repositories": [ { "type": "vcs", "url": "git@gitlab.com:xxx/yyy.git" } ], "require": { "xxx/yyy": "*" }, "require-all": false, "require-dependencies": false, "require-dev-dependencies": false, "archive": { "directory": "dist", "skip-dev": true, "prefix-url": "https://XXXX", "checksum": false } }
The problem appers somewhere from 2021-07-02 13:30:00 (GMT+0200) (our last successfull build)
EDIT:
I have also some previous error (which I fixed by changing "name" in satis.json):In RootPackageLoader.php line 76: [RuntimeException] Your package name XXX Composer Repository is invalid, it should hav e a vendor name, a forward slash, and a package name. The vendor and packag e name can be words separated by -, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".
Do you resolved the problem?
Could it be? Yes perhaps.. Is it? I have no idea, sorry.
I do not use satis in kubernetes nor do I have access to any kubernetes environments at the moment.
I was however able to reproduce this locally.
The following satis.json produces no errors for me:
{
"name": "my/repo",
"homepage": "http://localhost",
"repositories": [
{ "type": "vcs", "url": "https://github.com/thephpleague/iso3166" },
{ "type": "vcs", "url": "https://github.com/alcohol/iso4217" }
]
}
However, the moment I add custom archive options, things break. The following satis.json did manage to reproduce the issue:
{
"name": "my/repo",
"homepage": "http://localhost",
"archive": {
"directory": "dist",
"format": "tar",
"prefix-url": "http://localhost",
"skip-dev": true
},
"repositories": [
{ "type": "vcs", "url": "https://github.com/thephpleague/iso3166" },
{ "type": "vcs", "url": "https://github.com/alcohol/iso4217" }
]
}
I'm guessing there is something broken in the way archives are created.
@GromNaN Sorry to put this on you again; but is there any chance you could take the time to see if and why the Composer 2.0 changes might have broken this?
The paths here don't line up with the exception, but it could very well be that even in very very verbose mode we're missing one or two steps in the output. Also the unzip command is mentioned as being async; which is something Composer 2.0 introduced if I am not mistaken.
Dumping package 'alcohol/iso4217' in version '1.0.2'.
- Downloading alcohol/iso4217 (1.0.2)
Downloading https://api.github.com/repos/alcohol/iso4217/zipball/6c7d7b552765f479a2a1a82cba0dcfcd3b5b9dce
[302] https://api.github.com/repos/alcohol/iso4217/zipball/6c7d7b552765f479a2a1a82cba0dcfcd3b5b9dce
Following redirect (1) https://codeload.github.com/alcohol/iso4217/legacy.zip/6c7d7b552765f479a2a1a82cba0dcfcd3b5b9dce
[200] https://codeload.github.com/alcohol/iso4217/legacy.zip/6c7d7b552765f479a2a1a82cba0dcfcd3b5b9dce
Writing /composer/cache/files/alcohol/iso4217/fc6334ec9028712a759f50be0364ab535dd79415.zip into cache from /build/vendor/composer/tmp-821d89fe4a0f453b645d33bed3368778
- Installing alcohol/iso4217 (1.0.2): Extracting archive
Executing async command (CWD): '/usr/bin/unzip' -qq '/build/vendor/composer/tmp-821d89fe4a0f453b645d33bed3368778' -d '/build/vendor/composer/16f01bc8'
In Filesystem.php line 352:
[ErrorException]
copy(/tmp/composer_archive60ebe85c10f00.tar): Failed to open stream: No such file or directory
I think the problem is caused by $promise = $this->process->executeAsync($command); here https://github.com/composer/composer/blob/master/src/Composer/Downloader/ZipDownloader.php#L119. $promise->then is never called. Maybe https://github.com/composer/composer/blob/master/src/Composer/Package/Archiver/ArchiveManager.php#L192 is called before the async process is finished? If async command is replaced by $status = $this->process->execute($command); it seems to work
There was definitely a bug in ArchiveManager there, which is fixed by composer/composer@b602b19 - I don't know if that fixes the issue here or not though.
I just patched a Satis instance hitting this bug with the fix @Seldaek pushed and it fixed the bug there.
As soon as a new minor or patch version of composer/composer
is released, I'll update the .lock file of Satis.
tks, i will update for checking
there is a workaround here: I built the docker image myself from this commit 4d42fc6 and it works
You can do the same or use my built docker image here temporarily until a new official docker image is updated for the fix https://hub.docker.com/layers/hoatle/satis/4d42fc6/images/sha256-c06491e6a5b8bbf551ca5adce89d38f0d6e29e919c94d2e194cdcdf5f2fc4b09?context=repo
There was definitely a bug in ArchiveManager there, which is fixed by composer/composer@b602b19 - I don't know if that fixes the issue here or not though.
It fixes for me... But @Seldaek do you know when the next release of composer/composer with your fix will come out?
Probably next week
Nice :)
Thank you
I am still seeing a similar error even with the latest commits. I am guessing this here https://github.com/composer/satis/blob/main/src/Builder/ArchiveBuilder.php#L200 only creates a promise which needs to be dealt with.
I tried this
$promise = $downloader->download($package, $downloadDir);
\Composer\Util\SyncHelper::await($this->composer->getLoop(), $promise);
but that didn't seem to work.
@fooman if you are confident it is the same issue, we can reopen this. If not, please open a new issue. Include relevant stack traces and logs, and ideally a reproducible scenario.