-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deployment: optimized build process & fix action status (#128)
- Loading branch information
1 parent
602e8e2
commit ce99217
Showing
6 changed files
with
143 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Start Server | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
#push: | ||
#pull_request: | ||
|
||
jobs: | ||
start-server: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Install dependencies | ||
run: | | ||
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc \ | ||
| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \ | ||
&& echo "deb https://ngrok-agent.s3.amazonaws.com buster main" \ | ||
| sudo tee /etc/apt/sources.list.d/ngrok.list | ||
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg | ||
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list | ||
sudo apt update | ||
sudo apt install ngrok cloudflare-warp fish | ||
ngrok config add-authtoken ${{ secrets.NGROK_AUTHTOKEN }} | ||
warp-cli --accept-tos connect | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
#- name: Run ngrok SSH | ||
# id: ngrok | ||
# uses: tmshkr/ngrok-ssh@latest | ||
# with: | ||
# SSH_CLIENT_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | ||
# NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }} | ||
|
||
- name: Reverse proxy | ||
run: | | ||
#Cloudflare | ||
################ | ||
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o cloudflared.deb | ||
sudo dpkg -i cloudflared.deb | ||
cd server/cloudflare | ||
unzip -P "${{ secrets.CLOUDFLARE_ZIP_PASSWORD }}" .cloudflared.zip | ||
mv .cloudflared ~/ | ||
cd ~/.cloudflared | ||
sudo mkdir -p /etc/cloudflared | ||
sudo cp * /etc/cloudflared/ | ||
sudo cloudflared service install | ||
sudo service cloudflared start | ||
|
||
- name: Set up Docker Build | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Set up Docker | ||
run: | | ||
docker pull mcr.microsoft.com/mssql/server | ||
docker pull tomcat:latest | ||
|
||
- name: Run MSSQL container | ||
run: | | ||
docker run --network host -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd" -p 1433:1433 -d mcr.microsoft.com/mssql/server:latest | ||
sleep 10 | ||
sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q "ALTER LOGIN [sa] WITH PASSWORD= '${{ secrets.SQLPASSWORD }}', CHECK_POLICY = OFF" | ||
|
||
- name: Run Tomcat container | ||
run: | | ||
docker run --network host -d --name tomcat -p 8080:8080 -e "PAYMENT_CODE=${{ secrets.PAYMENT_CODE }}" -e "PAYMENT_SECRET=${{ secrets.PAYMENT_SECRET }}" -e "SQLPASSWORD=${{ secrets.SQLPASSWORD }}" -e "EMAIL_ADDRESS=${{ secrets.EMAIL_ADDRESS }}" -e "EMAIL_PASSWORD=${{ secrets.EMAIL_PASSWORD }}" -e "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" tomcat:latest | ||
mv ./server/tomcat/dist/*.war ./server/tomcat/dist/ROOT.war | ||
docker cp ./server/tomcat/dist/ROOT.war `docker ps -q --filter ancestor=tomcat`:/usr/local/tomcat/webapps/ | ||
docker restart `docker ps -q --filter ancestor=tomcat` | ||
env: | ||
SQLPASSWORD: ${{ secrets.SQLPASSWORD }} | ||
|
||
- name: Create database | ||
run: | | ||
echo "creating database" | ||
sqlcmd -S localhost -U sa -P ${{ secrets.SQLPASSWORD }} -i ./server/mssql/reset.sql | ||
echo "creating tables" | ||
sqlcmd -S localhost -d major -U sa -P ${{ secrets.SQLPASSWORD }} -i ./server/mssql/table.sql | ||
echo "creating procedures" | ||
sqlcmd -S localhost -d major -U sa -P ${{ secrets.SQLPASSWORD }} -i ./server/mssql/procedure.sql | ||
echo "inserting data" | ||
sqlcmd -S localhost -d major -U sa -P ${{ secrets.SQLPASSWORD }} -i ./server/mssql/insert.sql | ||
|
||
- name: Show tomcat Logs | ||
timeout-minutes: 60 | ||
run: docker logs -f `docker ps -q --filter ancestor=tomcat` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM tomcat:10.0 | ||
|
||
RUN apt-get update && apt-get install -y ant | ||
|
||
WORKDIR /root | ||
COPY tomcat tomcat | ||
WORKDIR /root/tomcat | ||
|
||
RUN ant -Dj2ee.server.home=/usr/local/tomcat/ -Dlibs.CopyLibs.classpath=copylibs | ||
RUN mv dist/*.war /usr/local/tomcat/webapps/ROOT.war |