-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into remove_instanceid
- Loading branch information
Showing
4 changed files
with
147 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Ant Media Server Cloudformation Deployment | ||
|
||
on: | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 1' | ||
|
||
|
@@ -77,3 +77,23 @@ jobs: | |
run: | | ||
aws cloudformation delete-stack --stack-name ${{ env.STACK_NAME }} | ||
aws cloudformation wait stack-delete-complete --stack-name ${{ env.STACK_NAME }} | ||
- name: Send Slack Notification on Failure | ||
if: failure() | ||
uses: slackapi/[email protected] | ||
with: | ||
method: chat.postMessage | ||
token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
payload: | | ||
channel: ${{ secrets.SLACK_CHANNEL_ID }} | ||
text: "<@murat> CloudFormation deployment failed! :x:\nWorkflow: ${{ github.workflow }}\nJob: ${{ github.job }}\nCheck the logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
- name: Send Slack Notification on Success | ||
if: success() | ||
uses: slackapi/[email protected] | ||
with: | ||
method: chat.postMessage | ||
token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
payload: | | ||
channel: ${{ secrets.SLACK_CHANNEL_ID }} | ||
text: "CloudFormation deployment completed successfully! :white_check_mark:\nWorkflow: ${{ github.workflow }}\nJob: ${{ github.job }}" |
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,97 @@ | ||
name: Test Dockerfile with supervisor and without supervisor | ||
|
||
on: [push] | ||
env: | ||
DEBUG: true | ||
|
||
jobs: | ||
test-docker-builds: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
supervisor: [ true, false] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Download the latest version of Ant Media Server | ||
run: curl -L -o ant-media-server-community.zip $(curl -s https://api.github.com/repos/ant-media/Ant-Media-Server/releases/latest | grep "browser_download_url" | cut -d '"' -f 4) | ||
|
||
- name: Build with Supervisor=${{ matrix.supervisor }} | ||
run: | | ||
docker build -f docker/Dockerfile_Process \ | ||
--build-arg UseSupervisor=${{ matrix.supervisor }} \ | ||
--build-arg AntMediaServer=ant-media-server-community.zip \ | ||
-t antmedia:${{ matrix.supervisor }} . | ||
- name: Test Container (Supervisor=${{ matrix.supervisor }}) | ||
run: | | ||
docker images | ||
export LICENSE_KEY="test-test" | ||
docker run -d -p 5080:5080 --name antmedia-${{ matrix.supervisor }} antmedia:${{ matrix.supervisor }} -l $LICENSE_KEY | ||
docker ps -a | ||
docker logs antmedia-${{ matrix.supervisor }} | ||
sleep 30 | ||
docker ps | ||
AMS_PID=$(docker exec antmedia-${{ matrix.supervisor }} pgrep -f "antmedia") | ||
if [ "${{ matrix.supervisor }}" = "true" ]; then | ||
# With supervisor: AMS should NOT run with PID 1 | ||
if [ "$AMS_PID" = "1" ]; then | ||
echo "Error: Ant Media Server is running with PID 1 when supervisor is enabled" | ||
docker logs antmedia-${{ matrix.supervisor }} | ||
exit 1 | ||
else | ||
echo "Success: Ant Media Server is running with PID $AMS_PID (with supervisor)" | ||
# we dont check license key when supervisor is enabled because passing command line parameters has not been supported yet | ||
fi | ||
else | ||
# Without supervisor: AMS should run with PID 1 | ||
if [ "$AMS_PID" = "1" ]; then | ||
echo "Success: Ant Media Server is running with PID 1 (without supervisor)" | ||
AMS_LICENSE_KEY=$(docker exec antmedia-${{ matrix.supervisor }} cat /usr/local/antmedia/conf/red5.properties | grep "server.licence_key" | cut -d'=' -f2) | ||
echo "AMS_LICENSE_KEY: $AMS_LICENSE_KEY" | ||
#check if the license key is set correctly. It validates that docker file accepts the parameters from command line | ||
if [ "$AMS_LICENSE_KEY" != "$LICENSE_KEY" ]; then | ||
echo "Error: License key mismatch" | ||
exit 1 | ||
fi | ||
else | ||
echo "Error: Ant Media Server is not running with PID 1 when supervisor is disabled" | ||
docker logs antmedia-${{ matrix.supervisor }} | ||
exit 1 | ||
fi | ||
fi | ||
# Additional validation: Check if supervisor is running when enabled | ||
if [ "${{ matrix.supervisor }}" = "true" ]; then | ||
SUPERVISOR_RUNNING=$(docker exec antmedia-${{ matrix.supervisor }} pgrep -f "supervisord" || echo "") | ||
if [ -z "$SUPERVISOR_RUNNING" ]; then | ||
echo "Error: Supervisor process not found when it should be enabled" | ||
exit 1 | ||
fi | ||
fi | ||
- name: Check Ant Media Server health with a timeout | ||
run: | | ||
timeout=120 | ||
start_time=$(date +%s) | ||
until wget http://localhost:5080 -O index.html; do | ||
current_time=$(date +%s) | ||
elapsed_time=$((current_time - start_time)) | ||
if [ $elapsed_time -gt $timeout ]; then | ||
echo "Timeout reached. Ant Media Server did not start within $timeout seconds." | ||
exit 1 | ||
fi | ||
echo "Waiting for Ant Media Server to start..." | ||
sleep 10 | ||
done | ||
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