Skip to content

Commit

Permalink
Merge pull request #530 from khs1994-docker/dev
Browse files Browse the repository at this point in the history
Support satis #479
  • Loading branch information
khs1994 authored May 29, 2018
2 parents f5fd6be + 97bbc71 commit e010125
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .khsci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
workspace:
base: /data/lnmp

pipeline:
test:
image: khs1994/php-fpm:7.2.6-alpine3.7
command:
- ./lnmp-docker.sh
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
!.env.*
!my_second_app
!my_other_app
!satis-demo
2 changes: 1 addition & 1 deletion app/demo
22 changes: 22 additions & 0 deletions app/satis-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Composer 私有化解决方案 Satis

* 问题反馈 https://github.com/khs1994-docker/lnmp/issues/479

* https://github.com/composer/satis

* https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#satis

## GitGub API 等的频率限制

```bash
Could not fetch https://api.github.com/repos/khs1994-docker/libdocker, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+7b6ead567709+2018-05-29+1134
to retrieve a token. It will be stored in "/composer/auth.json" for future use by Composer.
Token (hidden):
```

加上 `token` 解除限制

* https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens

生成 `token` 之后,在提示处粘贴 `token` 回车即可。
23 changes: 23 additions & 0 deletions app/satis-demo/satis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "My Composer",
"homepage": "http://packagist.example.com",
"repositories": [{
"type": "vcs",
"url": "https://github.com/khs1994-docker/libdocker"
},
{
"type": "vcs",
"url": "https://github.com/khs1994-docker/libregistry"
},
{
"type": "vcs",
"url": "https://github.com/khs1994-php/tencent-ai"
}
],
"require-all": true,
"archive": {
"directory": "dist",
"format": "tar",
"skip-dev": false
}
}
1 change: 1 addition & 0 deletions cli/completion/bash/lnmp-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ complete -W "acme.sh \
restart \
registry \
registry-down \
satis \
ssl \
ssl-self \
swarm-build \
Expand Down
1 change: 1 addition & 0 deletions cli/completion/fish/lnmp-docker.sh.fish
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ complete -c lnmp-docker.sh -n "__fish_use_subcommand" -f -a swarm-pull -d
complete -c lnmp-docker.sh -n "__fish_use_subcommand" -f -a swarm-push -d 'Push Swarm mode LNMP images (nginx php7 etc)'
complete -c lnmp-docker.sh -n "__fish_use_subcommand" -f -a swarm-update -d 'Print update LNMP service example'
complete -c lnmp-docker.sh -n "__fish_use_subcommand" -f -a systemd -d 'Manage Docker LNMP by systemd(Only Support Linux x86_64)'
complete -c lnmp-docker.sh -n "__fish_use_subcommand" -f -a satis -d 'Build Satis'

complete -c lnmp-docker.sh -n "__fish_use_subcommand" -f -a toolkit-docs -d 'Up local docs Server'

Expand Down
2 changes: 1 addition & 1 deletion config/nginx
Submodule nginx updated 1 files
+8 −0 demo-satis.conf
14 changes: 14 additions & 0 deletions lnmp-docker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Commands:
init Init LNMP environment
restore Restore MySQL databases
restart Restart LNMP services
satis Build Satis
update Upgrades LNMP
upgrade Upgrades LNMP
update-version Update LNMP soft to latest vesion
Expand Down Expand Up @@ -267,6 +268,15 @@ Function clusterkit_bash_cli($env, $service, $command){
$command
}

Function satis(){
if(!(Test-Path app/satis)){
cp -Recurse app/satis-demo app/satis
Write-Warning "Please modify app/satis/satis.json"
}

docker run --rm -it -v $PWD/app/satis:/build -v lnmp_composer_cache-data:/composer composer/satis
}

# main

env_status
Expand Down Expand Up @@ -372,6 +382,10 @@ switch($first){
'Import ./config/nginx/ssl-self/root-ca.crt to Browsers,then set hosts in C:\Windows\System32\drivers\etc\hosts'
}

satis {
satis
}

httpd-cli {
_bash_cli httpd sh
}
Expand Down
15 changes: 15 additions & 0 deletions lnmp-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Commands:
restart Restart LNMP services
registry Start Docker Registry
registry-down Stop Docker Registry
satis Build Satis
update Upgrades LNMP
upgrade Upgrades LNMP
update-version Update LNMP soft to latest vesion
Expand Down Expand Up @@ -226,6 +227,15 @@ When Docker for Desktop Start Kubernetes Success, you must remove this local ser
"
}

_satis(){
if ! [ -d app/satis ];then
cp -r app/satis-demo app/satis
print_warning "Please modify app/satis/satis.json\n"
fi

docker run --rm -it -v $PWD/app/satis:/build -v lnmp_composer_cache-data:/composer composer/satis
}

_local_docs_server(){
if ! [ -d app/khsdocs/k8s ];then
git clone --depth=1 -b gh-pages [email protected]:khs1994-website/kubernetes-handbook.git app/khsdocs/k8s
Expand Down Expand Up @@ -1137,6 +1147,11 @@ For information please run $ docker service update --help
"
;;

satis )
_satis

;;

build )
run_docker
init
Expand Down

0 comments on commit e010125

Please sign in to comment.