diff --git a/.github/workflows/BG.yml b/.github/workflows/BG.yml new file mode 100644 index 00000000..fbf4ac0e --- /dev/null +++ b/.github/workflows/BG.yml @@ -0,0 +1,48 @@ +name: Industrialisation continue sur le serveur AWS (Tomcat) +on: push +jobs: + build: + name: Package AWS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - run: | + jar cvf Senthilkumar.war * + - name: copy file via ssh password + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST_DNS }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.EC2_SSH_KEY }} + port: ${{ secrets.DEPLOY_PORT }} + source: "Senthilkumar.war" + target: "/opt/tomcat/webapps" + + deploy: + name: SAV IPFS + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@master + - run: | + jar cvf Senthilkumar.war * + - uses: jirutka/setup-alpine@v1 + with: + branch: v3.15 + - run: | + apk add go-ipfs + ipfs init + ipfs daemon & + shell: alpine.sh --root {0} + - name: Sauvegarde fichier war sur IPFS + run: | + ls -la + ipfs swarm peers + ipfs add Senthilkumar.war > ipfs_key.txt + shell: alpine.sh --root {0} + - name: Notification Discord + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + run: | + ipfs_key=$(cat ipfs_key.txt | awk '{print $2}') + curl -X POST -H "Content-Type: application/json" -d "{\"content\": \"Sadish.S: Le workfl-vousetespasfatigueronestpasfatiguer IPFS est terminé. Clé IPFS : $ipfs_key\"}" $DISCORD_WEBHOOK diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..486403db --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,19 @@ +name: Industrialisation continue sur le serveur AWS +on: push +jobs: + Deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - run: | + jar cvf sadish.war * + - name: copy file via ssh password + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST_DNS }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.EC2_SSH_KEY }} + port: ${{ secrets.DEPLOY_PORT }} + source: "sadish.war" + target: "/opt/tomcat/webapps" diff --git a/.github/workflows/new.yml b/.github/workflows/new.yml new file mode 100644 index 00000000..f92cd948 --- /dev/null +++ b/.github/workflows/new.yml @@ -0,0 +1,65 @@ +name: Continuous Deployment and Database Backup + +on: push + +jobs: + setup_and_backup: + name: Setup SSH and Backup Database + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v2 + + + - name: Setup SSH Keys + run: | + mkdir -p ~/.ssh + echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan ${{ secrets.HOST_DNS }} >> ~/.ssh/known_hosts + + + - name: Create SSH Tunnel + run: | + ssh -i ~/.ssh/id_rsa -L 3307:127.0.0.1:3306 admin@${{ secrets.HOST_DNS }} -N & + SSH_TUNNEL_PID=$! + sleep 10 + if ps -p $SSH_TUNNEL_PID > /dev/null; then + echo "SSH tunnel established, PID: $SSH_TUNNEL_PID" + else + echo "SSH tunnel failed" + exit 1 + fi + + + - name: Dump MySQL Database + env: + MYSQL_PWD: ${{ secrets.MYSQLDUMP_PASSWORD }} + run: | + mysqldump -ucnam -h127.0.0.1 -P3307 --password="${MYSQL_PWD}" films > sauvegarde_films.sql + if [ $? -ne 0 ]; then + echo "Failed to dump MySQL" + exit 1 + fi + + + - name: Kill SSH Tunnel + if: always() + run: | + kill $SSH_TUNNEL_PID || echo "SSH tunnel fin." + + + - name: Install IPFS + run: | + wget https://dist.ipfs.io/go-ipfs/v0.9.1/go-ipfs_v0.9.1_linux-amd64.tar.gz + tar xvfz go-ipfs_v0.9.1_linux-amd64.tar.gz + cd go-ipfs + sudo bash install.sh + ipfs init + + + - name: Add to IPFS + run: | + ipfs daemon --init & + sleep 10 + ipfs add sauvegarde_films.sql diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..b242572e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "githubPullRequests.ignoredPullRequestBranches": [ + "main" + ] +} \ No newline at end of file diff --git a/images/cartoon.ogg b/images/cartoon.ogg new file mode 100644 index 00000000..f1ce5fdb Binary files /dev/null and b/images/cartoon.ogg differ diff --git a/index.html b/index.html index fe61a15f..ff8e15f6 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,21 @@
-
|
-Sample "Hello, World" Application-This is the home page for a sample application used to illustrate the -source directory organization of a web application utilizing the principles -outlined in the Application Developer's Guide. + Allo salut saidsh. + + + |