forked from wangbo/easyai
fix(deploy): 保留旧部署鉴权与命名卷配置
This commit is contained in:
@@ -20,7 +20,7 @@ with tempfile.TemporaryDirectory(prefix='easyai-legacy-update-') as directory:
|
||||
base = Path(directory)
|
||||
root = base / 'easyai'
|
||||
root.mkdir()
|
||||
(root / 'docker-compose.yml').write_text('services:\n easyai-server:\n image: server:old\n environment:\n - EXISTING=keep\n watchtower:\n image: watcher:old\n')
|
||||
(root / 'docker-compose.yml').write_text('services:\n easyai-server:\n image: server:old\n environment:\n - EXISTING=keep\n watchtower:\n image: watcher:old\n environment:\n - WATCHTOWER_HTTP_API_TOKEN=${LEGACY_TOKEN}\n')
|
||||
(root / '.gitignore').write_text('.env\ndata/\n')
|
||||
(root / '.env').write_text('VERSION=old\nCONFIG_JWT_SECRET=keep-this-private-key\n')
|
||||
for args in [['git','init','-q'], ['git','config','user.name','Update test'], ['git','config','user.email','test@example.invalid'], ['git','add','.'], ['git','commit','-qm','test: 旧部署基准']]:
|
||||
@@ -41,6 +41,8 @@ with tempfile.TemporaryDirectory(prefix='easyai-legacy-update-') as directory:
|
||||
- MODEL_CONVERSION_WORKER_TOKEN=${MODEL_CONVERSION_WORKER_TOKEN}
|
||||
watchtower:
|
||||
image: watcher:new
|
||||
environment:
|
||||
- WATCHTOWER_HTTP_API_TOKEN=${WATCHTOWER_API_KEY}
|
||||
easyai-updater:
|
||||
image: updater:new
|
||||
environment:
|
||||
@@ -55,6 +57,8 @@ with tempfile.TemporaryDirectory(prefix='easyai-legacy-update-') as directory:
|
||||
image: worker:new
|
||||
networks:
|
||||
easyai: {}
|
||||
volumes:
|
||||
accepted-data: {}
|
||||
''')
|
||||
(seed / 'scripts').mkdir()
|
||||
(seed / 'scripts/init-security-env.sh').write_text('# modern security initializer\n')
|
||||
@@ -74,7 +78,8 @@ networks:
|
||||
(root / 'scripts').mkdir()
|
||||
(root / 'scripts/init-security-env.sh').write_text('# local legacy initializer\n')
|
||||
(root / 'demo.example.conf').write_text('# custom nginx source; active copy elsewhere\n')
|
||||
original = (root / 'docker-compose.yml').read_bytes()
|
||||
original = (root / 'docker-compose.yml').read_bytes().replace(b' environment:\n - WATCHTOWER_HTTP_API_TOKEN=${LEGACY_TOKEN}\n', b'')
|
||||
(root / 'docker-compose.yml').write_bytes(original)
|
||||
bins = base / 'bin'
|
||||
bins.mkdir()
|
||||
docker = bins / 'docker'
|
||||
@@ -110,6 +115,8 @@ networks:
|
||||
assert config['services']['easyai-updater']['networks']['easyai']['ipv4_address']=='172.21.0.31'
|
||||
assert config['services']['easyai-updater']['environment']['UPDATE_MANIFEST_FILE']=='/state/custom.json'
|
||||
assert 'model-conversion-worker' in config['services']
|
||||
assert 'accepted-data' in config['volumes']
|
||||
assert 'WATCHTOWER_HTTP_API_TOKEN' in config['services']['watchtower']['environment']
|
||||
repeat=run(['python3',str(source/'scripts/prepare-update-repository.py'),str(root)],root,env)
|
||||
assert repeat.returncode==0
|
||||
assert len(list((root/'data/deployment-backups').glob('legacy-update-*')))==1
|
||||
|
||||
Reference in New Issue
Block a user