This commit is contained in:
62
.drone.yml
Normal file
62
.drone.yml
Normal file
@ -0,0 +1,62 @@
|
||||
kind: pipeline # 定义一个管道
|
||||
type: docker # 当前管道的类型
|
||||
name: build # 当前管道的名称
|
||||
|
||||
steps: # 定义管道的执行步骤
|
||||
# - name: build-project # 步骤名称
|
||||
# image: node:18-bullseye # 当前步骤使用的镜像
|
||||
# volumes:
|
||||
# - name: node_modules
|
||||
# path: /drone/src/node_modules
|
||||
# commands: # 当前步骤执行的命令
|
||||
# - pwd
|
||||
# - npm config set registry https://registry.npm.taobao.org
|
||||
# - npm i
|
||||
|
||||
- name: build-image
|
||||
image: plugins/docker
|
||||
depends_on: [clone]
|
||||
settings:
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_passwd
|
||||
dockerfile: Dockerfile
|
||||
registry: https://git.hiiragi.club:8081
|
||||
repo: git.hiiragi.club:8081/mol/middle-server
|
||||
auto_tag: true
|
||||
|
||||
---
|
||||
kind: pipeline # 定义一个管道
|
||||
type: docker # 当前管道的类型
|
||||
name: deploy # 当前管道的名称
|
||||
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: deploy-project
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: host
|
||||
username:
|
||||
from_secret: server_username # 使用secrets
|
||||
key:
|
||||
from_secret: server_key
|
||||
port: 22
|
||||
command_timeout: 2m
|
||||
secrets: [docker_username, docker_passwd]
|
||||
script:
|
||||
- echo ==-----==开始部署==-----==
|
||||
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWD git.hiiragi.club:8081
|
||||
- docker pull git.hiiragi.club:8081/mol/middle-server:latest
|
||||
- list=$(docker ps -a | grep middle_server* | awk '{print $1}')
|
||||
- test "$list" = "" && echo "none middle_server containers running" || docker stop $list && docker container rm $list
|
||||
# 过滤出dockerImages的id, 删除none镜像
|
||||
- docker run -d -p 15000:80 --name=middle_server_${DRONE_TAG} git.hiiragi.club:8081/mol/middle-server:latest
|
||||
- docker rmi $(docker images | grep "none" | awk '{print $3}')
|
||||
- echo ==-----==部署成功==-----==
|
141
.gitignore
vendored
141
.gitignore
vendored
@ -1 +1,140 @@
|
||||
temp/*
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
|
@ -6,7 +6,7 @@ def getPlaylist(token):
|
||||
headers = {
|
||||
'x-nd-authorization': f'Bearer {token}'
|
||||
}
|
||||
res = requests.get(f'{host}/api/playlist?_end=50&_order=ASC&_sort=id&_start=0', headers = headers)
|
||||
res = requests.get(f'{host}/music/api/playlist?_end=50&_order=ASC&_sort=id&_start=0', headers = headers)
|
||||
resJson = res.json()
|
||||
return resJson
|
||||
|
||||
@ -15,13 +15,13 @@ def downloadPlayList(palyListId, token):
|
||||
'Accept': 'audio/x-mpegurl',
|
||||
'x-nd-authorization': f'Bearer {token}'
|
||||
}
|
||||
res = requests.get(f'{host}/api/playlist/{palyListId}/tracks', headers = headers)
|
||||
res = requests.get(f'{host}/music/api/playlist/{palyListId}/tracks', headers = headers)
|
||||
return res.content
|
||||
|
||||
def delPlaylist(playlistId, token):
|
||||
headers = {
|
||||
'x-nd-authorization': f'Bearer {token}'
|
||||
}
|
||||
res = requests.delete(f'{host}/api/playlist/{playlistId}', headers = headers)
|
||||
res = requests.delete(f'{host}/music/api/playlist/{playlistId}', headers = headers)
|
||||
resJson = res.json()
|
||||
return resJson
|
@ -2,6 +2,6 @@ import requests
|
||||
|
||||
def getToken():
|
||||
body = { 'username': 'mol', 'password': 'c!UxnePTkwBMb7' }
|
||||
res = requests.post('https://music.hiiragi.club:8081/auth/login', json = body)
|
||||
res = requests.post('http://192.168.124.12:4533/music/auth/login', json = body)
|
||||
resJson = res.json()
|
||||
return resJson.get('token')
|
8
start.py
8
start.py
@ -17,7 +17,7 @@ class GatewayServer():
|
||||
"service_name": "music_server",
|
||||
"methods": ["POST"],
|
||||
"path": "/music/api/playlist/<playlist_id>/tracks",
|
||||
"upstream_path": "/api/playlist/<playlist_id>/tracks",
|
||||
"upstream_path": "/music/api/playlist/<playlist_id>/tracks",
|
||||
"pipelines": {
|
||||
"outbound": [{ "name": "plugin.MusicHandler.MusicHandler" }]
|
||||
}
|
||||
@ -28,7 +28,7 @@ class GatewayServer():
|
||||
"service_name": "music_server",
|
||||
"methods": ["DELETE"],
|
||||
"path": "/music/api/playlist/<playlist_id>/tracks",
|
||||
"upstream_path": "/api/playlist/<playlist_id>/tracks",
|
||||
"upstream_path": "/music/api/playlist/<playlist_id>/tracks",
|
||||
"pipelines": {
|
||||
"outbound": [{ "name": "plugin.MusicHandler.MusicHandler" }]
|
||||
}
|
||||
@ -39,7 +39,7 @@ class GatewayServer():
|
||||
"service_name": "music_server",
|
||||
"methods": ["DELETE"],
|
||||
"path": "/music/api/playlist/<playlist_id>",
|
||||
"upstream_path": "/api/playlist/<playlist_id>",
|
||||
"upstream_path": "/music/api/playlist/<playlist_id>",
|
||||
"pipelines": {
|
||||
"outbound": [{ "name": "plugin.MusicHandler.MusicHandler" }]
|
||||
}
|
||||
@ -50,7 +50,7 @@ class GatewayServer():
|
||||
"service_name": "music_server",
|
||||
"methods": ["POST"],
|
||||
"path": "/music/api/playlist",
|
||||
"upstream_path": "/api/playlist",
|
||||
"upstream_path": "/music/api/playlist",
|
||||
"pipelines": {
|
||||
"outbound": [{ "name": "plugin.MusicHandler.MusicHandler" }]
|
||||
}
|
||||
|
Reference in New Issue
Block a user