feat: add deploy shell ✌️

This commit is contained in:
2020-09-29 19:18:34 +08:00
parent c8d083686d
commit 4941bed2a3
3 changed files with 103 additions and 66 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.idea
.vscode
.DS_Store
*.txz
*.tar.*

66
.idea/workspace.xml generated
View File

@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="7bf2ac79-ff38-4256-a9a9-058b7de02f4e" name="默认的" comment="">
<change afterPath="$PROJECT_DIR$/configs/caddy/sealms-ui.conf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/configs/mysql8/my.cnf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
<change afterPath="$PROJECT_DIR$/stack/readme.md" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="GOROOT" path="$USER_HOME$/sdk/go_v1.15.2" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1iBDJXkbNH4d6ad87rPiVvjuaGx" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="go.import.settings.migrated" value="true" />
<property name="go.sdk.automatically.set" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="WindowStateProjectService">
<state x="2134" y="791" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1601374943720">
<screen x="42" y="23" width="3318" height="1867" />
</state>
<state x="2134" y="791" key="#com.intellij.fileTypes.FileTypeChooser/42.23.3318.1867@42.23.3318.1867" timestamp="1601374943720" />
</component>
</project>

97
shell/allcmd.sh Normal file
View File

@@ -0,0 +1,97 @@
#!/usr/bin/env bash
function pull_rsync_all() {
cd /data/databanks/seal-ms/sealms-ui
git pull origin develop
cd /data/databanks/seal-ms/sealms
git pull origin develop
sleep 1
rsync -auvz --exclude=".git/" /data/databanks/seal-ms/ /data/databanks/build-sync/seal-ms/
}
function ui_rsync() {
rsync -auvz /data/databanks/build-sync/seal-ms/sealms-ui/dist/ /data/www-root/seal-ms/sealms-ui/
}
function go_rsync() {
rsync -auvz /data/databanks/build-sync/seal-ms/sealms/release/ /data/www-root/seal-ms/sealms/release/
}
function ui_build() {
cmd="cd /data/seal-ms/sealms-ui; yarn build:stage"
bash -c "docker exec -i build-node sh -c '${cmd}'"
}
function go_build() {
cmd="/data/seal-ms/sealms/build.sh linux"
bash -c "docker exec -i build-golang sh -c '${cmd}'"
}
function go_restart() {
bash -c "docker restart App-Sealms"
}
function help() {
echo "-h --help Help "
echo " "
echo "0|prall git -> rsync all project src "
echo " "
echo "a1|api-build only build Api "
echo "a2|api-rsync only rsync Api "
echo "a3|api-restart only restart docker Container "
echo "aa|api-all only build -> rsync -> restart Api "
echo " "
echo "ub|ui-build only build frontend "
echo "ur|ui-rsync only build frontend ToRsync"
echo "ua|ui-all only build frontend ToRsync"
echo " "
echo "all git -> rsync -> build -> ToRsync -> restart all project "
echo " "
}
case $1 in
""|"-h"|"--help")
help;;
"0"|"prall")
pull_rsync_all;;
"a1"|"api-build")
pull_rsync_all
go_build
;;
"a2"|"api-rsync")
go_rsync
;;
"a3"|"api-restart")
go_restart
;;
"aa"|"api-all")
pull_rsync_all
sleep 1
go_build
sleep 1
go_rsync
go_restart
;;
"ub"|"ui-build")
pull_rsync_all
ui_build
;;
"ur"|"ui-rsync")
ui_rsync
;;
"ua"|"ui-all")
pull_rsync_all
sleep 1
ui_build
sleep 1
ui_rsync
;;
"all")
pull_rsync_all
go_build
go_rsync
go_restart
ui_build
ui_rsync
;;
esac