Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
Gampaha
Thenya Mishel
menuka2000
Updated:
Yesterday at 10:48 PM
Handmade Character Soft Toy Bluey Bingo
anil1961
Updated:
Aug 3, 2026
Colombo
Dahua POE Switch 8 Ports (DH-PFS3010-8ET-65)
hashaz2012
Updated:
Aug 3, 2026
Ad icon
Singapore V2Ray VPN for Tunneling
hu KANNA
Updated:
Jul 31, 2026
Dating Website & Online Chat Room
hotvideo
Updated:
Jul 30, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Ansible GitHub action and DevOps වැඩ්ඩනි පොඩි උදව්වක් ඔනේ
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="DevOps_Boy" data-source="post: 29442407" data-attributes="member: 584464"><p>මම මේ දවස් වල ඔෆිස් එකේ ප්රොජෙක්ට් එකක හිර වෙලා ඉන්නේ. මට මේකට මේකෙ ඉන්න DevOps engineers or මෙවා ගැන දන්න කවුරු හරි උදව්වක් දෙන්නකෝ. මේකයි case එක.</p><p>මට NodeJS application එකක් තියනවා ගිට් එකෙන් කෝඩ් එක අරන් බිල්ඩ් කරලා remote server එකකට deploy කරන්න. අනිත් එක තමයි ගිට් රිපෝ එකක තියන war files දෙකක් අරන් ඒකත් tomcat Apache (inside of the webapp directory) එකක ඩිප්ලෝයි කරන්න. හැබැයි ඊට කලින් ඩේටබේස් එකෙයි තව directories කීපයක බැකප් ග්න්නත් ඔනේ. ඒකට මම ඇන්සිබ්ල් script එක්කින් කරන්න බැලුවේ. හැබැයි මේ සිටුවේශන් දෙකම එක පාර ඒ කිව්වෙ සම්හර වෙලාවට NodeJS or WAR file දෙකෙන් එකක් හෝ දෙකම එක පාර deploy කරන්න පුලුව්න් වෙන්නත් ඔනේ ඒ කිව්වෙ මට ඒක චූස් කරන්න තිබ්බොත් හොදයි.. හැබැයි මේකේ ගිට් URL දෙකක් තියෙන්නෙ. එකක UI and එකක WAR file තියනවා. මම දැනට ට්ර්යි කලේ මන් ගාව තිය්නව github self runner server එකක්. ඒකට ansible දාලා එකෙන් කරන්න බැලුවේ. එත් එකේදි මාර එරර්ස් ගොඩක් එන්වා. මම දැනට ජිතබ් එකේ github action ස්ක්රිප්ට් එකක් හදලා එකෙන් ansible script එක run කරලා බැලුවට errors එනවා මාරෙට. මට හිතගන්න බැරුව ඉන්නේ. මම ට්ර්යි කරපු github action script එකයි ansible script එකයි දන්නම් පහලින්. මට දැනගනන් ඔනේ මේක කරන්න තව effective widiyak thiyeda? නැත්තම් මේකෙ මොන්වද අඩුපාඩු?</p><p>guys මට මේක ගොඩ දාගන්න පොඩි සප් එකක් දෙන්නකෝ.</p><p></p><p>Github Action Script</p><p>[CODE=yaml]name: Integrated Deployment</p><p></p><p>on:</p><p> push:</p><p> branches:</p><p> - main</p><p></p><p>jobs:</p><p> deploy_and_backup:</p><p> runs-on: self-hosted</p><p></p><p> env:</p><p> #TARGET_SERVER_IP: ${{ secrets.TARGET_SERVER_IP }}</p><p> UI_REPOSITORY: "https://github.com/dev-test/Daily_Releases_UI.git"</p><p> WAR_REPOSITORY: "https://github.com/dev-test/Daily_Releases_WAR.git"</p><p></p><p> steps:</p><p> - name: Checkout code</p><p> uses: actions/checkout@v2</p><p> with:</p><p> repository: dev-test/Daily_Releases_UI</p><p> ref: ${{ github.event.before }}</p><p></p><p></p><p> - name: Run Ansible playbook for backup</p><p> run: ansible-playbook /etc/ansible/playbook/backup.yml</p><p></p><p> - name: Deploy NodeJS Application or War files</p><p> run: |</p><p> if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then</p><p> if [ "${{ inputs.deployment-type }}" == "UI" ] || [ "${{ inputs.deployment-type }}" == "Both" ]; then</p><p> # Your NodeJS deployment steps here</p><p> echo "Deploying NodeJS Application..."</p><p> steps:</p><p> - name: Get code</p><p> uses: actions/checkout@v4</p><p> - name: Install NodeJS</p><p> uses: actions/setup-node@v3</p><p> with:</p><p> node-version: 10</p><p> - name: Install dependencies</p><p> run: NODE_OPTIONS=--max_old_space_size=4096 npm install</p><p> - name: Check Nodejs</p><p> run: npx browserslist@latest --update-db</p><p> - name: Build project</p><p> run: NODE_OPTIONS=--max_old_space_size=4096 npm run build</p><p> - name: Deploy to the server.</p><p> uses: easingthemes/ssh-deploy@main</p><p> with:</p><p> SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_DEPLOYER_TESTING }}</p><p> SOURCE: "build/*"</p><p> REMOTE_HOST: "50.35.45.55"</p><p> REMOTE_USER: "deployer"</p><p> TARGET: "/var/www/html/"</p><p> fi</p><p> fi</p><p> if [ "${{ github.event_name }}" == "repository_dispatch" ] && [ "${{ inputs.deployment-type }}" == "War" ]; then</p><p> # Your War files deployment steps here</p><p> echo "Deploying War files..."</p><p> git clone --branch ${{ github.event.client_payload.branch }} ${{ env.WAR_REPOSITORY }} /tmp/war-files</p><p> # Continue with your War files deployment steps using the contents in /tmp/war-files</p><p> rsync -av /tmp/war-files/ deployer@50.35.45.55:/usr/local/tomcat/webapps/</p><p> ssh -i ${{ secrets.SSH_PRIVATE_KEY_DEPLOYER_TESTING }} -p 22 deployer@50.35.45.55 "cd /usr/local/tomcat/bin && ./shutdown.sh && ./startup.sh"</p><p> fi[/CODE]</p></blockquote><p></p>
[QUOTE="DevOps_Boy, post: 29442407, member: 584464"] මම මේ දවස් වල ඔෆිස් එකේ ප්රොජෙක්ට් එකක හිර වෙලා ඉන්නේ. මට මේකට මේකෙ ඉන්න DevOps engineers or මෙවා ගැන දන්න කවුරු හරි උදව්වක් දෙන්නකෝ. මේකයි case එක. මට NodeJS application එකක් තියනවා ගිට් එකෙන් කෝඩ් එක අරන් බිල්ඩ් කරලා remote server එකකට deploy කරන්න. අනිත් එක තමයි ගිට් රිපෝ එකක තියන war files දෙකක් අරන් ඒකත් tomcat Apache (inside of the webapp directory) එකක ඩිප්ලෝයි කරන්න. හැබැයි ඊට කලින් ඩේටබේස් එකෙයි තව directories කීපයක බැකප් ග්න්නත් ඔනේ. ඒකට මම ඇන්සිබ්ල් script එක්කින් කරන්න බැලුවේ. හැබැයි මේ සිටුවේශන් දෙකම එක පාර ඒ කිව්වෙ සම්හර වෙලාවට NodeJS or WAR file දෙකෙන් එකක් හෝ දෙකම එක පාර deploy කරන්න පුලුව්න් වෙන්නත් ඔනේ ඒ කිව්වෙ මට ඒක චූස් කරන්න තිබ්බොත් හොදයි.. හැබැයි මේකේ ගිට් URL දෙකක් තියෙන්නෙ. එකක UI and එකක WAR file තියනවා. මම දැනට ට්ර්යි කලේ මන් ගාව තිය්නව github self runner server එකක්. ඒකට ansible දාලා එකෙන් කරන්න බැලුවේ. එත් එකේදි මාර එරර්ස් ගොඩක් එන්වා. මම දැනට ජිතබ් එකේ github action ස්ක්රිප්ට් එකක් හදලා එකෙන් ansible script එක run කරලා බැලුවට errors එනවා මාරෙට. මට හිතගන්න බැරුව ඉන්නේ. මම ට්ර්යි කරපු github action script එකයි ansible script එකයි දන්නම් පහලින්. මට දැනගනන් ඔනේ මේක කරන්න තව effective widiyak thiyeda? නැත්තම් මේකෙ මොන්වද අඩුපාඩු? guys මට මේක ගොඩ දාගන්න පොඩි සප් එකක් දෙන්නකෝ. Github Action Script [CODE=yaml]name: Integrated Deployment on: push: branches: - main jobs: deploy_and_backup: runs-on: self-hosted env: #TARGET_SERVER_IP: ${{ secrets.TARGET_SERVER_IP }} UI_REPOSITORY: "https://github.com/dev-test/Daily_Releases_UI.git" WAR_REPOSITORY: "https://github.com/dev-test/Daily_Releases_WAR.git" steps: - name: Checkout code uses: actions/checkout@v2 with: repository: dev-test/Daily_Releases_UI ref: ${{ github.event.before }} - name: Run Ansible playbook for backup run: ansible-playbook /etc/ansible/playbook/backup.yml - name: Deploy NodeJS Application or War files run: | if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then if [ "${{ inputs.deployment-type }}" == "UI" ] || [ "${{ inputs.deployment-type }}" == "Both" ]; then # Your NodeJS deployment steps here echo "Deploying NodeJS Application..." steps: - name: Get code uses: actions/checkout@v4 - name: Install NodeJS uses: actions/setup-node@v3 with: node-version: 10 - name: Install dependencies run: NODE_OPTIONS=--max_old_space_size=4096 npm install - name: Check Nodejs run: npx browserslist@latest --update-db - name: Build project run: NODE_OPTIONS=--max_old_space_size=4096 npm run build - name: Deploy to the server. uses: easingthemes/ssh-deploy@main with: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_DEPLOYER_TESTING }} SOURCE: "build/*" REMOTE_HOST: "50.35.45.55" REMOTE_USER: "deployer" TARGET: "/var/www/html/" fi fi if [ "${{ github.event_name }}" == "repository_dispatch" ] && [ "${{ inputs.deployment-type }}" == "War" ]; then # Your War files deployment steps here echo "Deploying War files..." git clone --branch ${{ github.event.client_payload.branch }} ${{ env.WAR_REPOSITORY }} /tmp/war-files # Continue with your War files deployment steps using the contents in /tmp/war-files rsync -av /tmp/war-files/ deployer@50.35.45.55:/usr/local/tomcat/webapps/ ssh -i ${{ secrets.SSH_PRIVATE_KEY_DEPLOYER_TESTING }} -p 22 deployer@50.35.45.55 "cd /usr/local/tomcat/bin && ./shutdown.sh && ./startup.sh" fi[/CODE] [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom