aizu's Knowledge Base
    • Go to: aizu.my Homepage
    • Recent
    • Tags
    • Register
    • Login

    Sample bitbucket pipeline for deploy to Linux

    Linux
    1
    1
    60
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aizu
      last edited by aizu

      File: bitbucket-pipelines.yml

      image: node:20
      
      pipelines:
        branches:
          main:
            - step:
                name: Deploy to Linux
                script:
                  - ssh [email protected] "cd /var/www && git pull && npm i && npm run build && pm2 restart 1"
      

      Need to copy Bitbucket's id_rsa key to server's authorised_keys.

      1. Go to Repository Settings (of the particular repo)
      2. Pipeline > SSH Keys

      Generate key.

      ff7d9e1c-1431-498d-a9d9-a53b8a5639e8-image.png

      Copy the generated key to authorised_keys in target server.

      1. Get the server's fingerprint, so Bitbucket can keep it. - enter the server IP, and click "Fetch"

      ceae856d-4353-480b-81b3-7459795ea85a-image.png

      1 Reply Last reply Reply Quote 0
      • First post
        Last post