Migrate your servers to Nebula

Thinking about moving your applications or code from a different provider to Nebula? This section provides 3 common methods you can use to set up your services on Nebula’s server instances.

The process of migration depends on how you want to use your server instance.

I deploy from GitHub

If you used GitHub actions to deploy to your previous provider, simply update the secret keys and destination IP to your Nebula instance.

For this example, we will create a simple GitHub action that logs in to your Nebula server using SSH, checks out your main branch from your GitHub repository into a work folder, and pulls changes. The action is triggered by pushes on your main branch.

Go to SettingsSecretsActions on GitHub, and create these secrets:

  • SSH_USER: your user to access the server via SSH. On Ubuntu, this is root by default.
  • SSH_PRIVATE_KEY: your private key. We recommend that you create a separate key for this GitHub action.
  • SSH_HOST: the IP address of your Nebula instance. You can find the server’s IP address in the Console’s Instances page.
  • WORK_DIR: the path to the directory where you want to pull the repository.
  • MAIN_BRANCH: the name of your main branch. We use main for this example.

You can use this sample code to create the action itself:

on:
  push:
    branches:
      - main
  workflow_dispatch:
  
jobs:
  run_pull:
    name: run pull
    runs-on: ubuntu-latest
    
    steps:
    - name: set up ssh key
      uses: webfactory/ssh-agent@v0.9.0
      with:
        ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
    - name: connect and pull from main branch
      run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && git checkout ${{ secrets.MAIN_BRANCH }} && git pull"

    - name: cleanup
      run: rm -rf ~/.ssh

Note that this sample code uses a version of an SSH agent that requires Node.js v20.

After you save the action, every time you push modifications to your main branch, the action should trigger and push updates to your Nebula server.

You’re done!


I use container images

If you run your applications in containerized environments, you can set up similar virtualization tools like Docker on your Nebula server. Docker enables you to push container images from your previous provider to Docker Hub, and then pull and deploy those images directly on your Nebula server.

This example utilizes standard Docker functions and assumes that you already have a published Docker image on Docker Hub. We will refer to Docker’s documentation to guide you.

  1. Use SSH to log in to your NebCompute instance. You can find the server’s IP address in the Instances page in the Console. On Ubuntu, the default user name is root. Create key pairs you can use for secure authentication on the Key pairs page in the Console.

    ssh -i /path/.ssh/my_private_key.pem root@nebula_server_ip -p 22
  2. Once you’re in, update the package index on the instance.

    sudo apt update
  3. Install Docker on your Nebula instance. Here is the Docker documentation for installing on Ubuntu.

    # Add Docker's official GPG key:
    sudo apt-get update
    sudo apt-get install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    
    # Add the repository to Apt sources:
    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
      $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update
    
    # Install latest version of Docker
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  4. Pull the Docker image from Docker Hub and deploy it on your Nebula instance.

    # Pull your image
    docker pull [my_image_name]:[tag]
    
    # Deploy your image
    docker run -d -p 80:80 --name my_awesome_deployment [my_image_name]:[tag]

You’re done!


I run my app directly on the server

If you want to migrate files or applications that you run directly on your previous server, you need to package your code first and then pull it into your Nebula instance. For this, we recommend using a tool like Docker.

This example utilizes standard Docker functions on a server running Ubuntu. We will refer to Docker’s documentation to guide you.

  1. Build and publish an image of your container from your previous server.

    Check out Docker’s guide here for the whole process.

  2. Use SSH to log into the NebCompute instance. You can find the server’s IP address in the Console’s Instances page. On Ubuntu, the default user name is root.

    ssh -i /path/.ssh/my_private_key.pem root@nebula_server_ip -p 22
  3. Once you’re in, update the package index on the instance.

    sudo apt update
  4. Install Docker on your Nebula instance. Here is Docker’s guide for installing on Ubuntu.

    # Add Docker's official GPG key:
    sudo apt-get update
    sudo apt-get install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    
    # Add the repository to Apt sources:
    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
      $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update
    
    # Install latest version of Docker
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  5. Pull the Docker image from Docker Hub and deploy it on your Nebula instance.

    # Pull your image
    docker pull [my_image_name]:[tag]
    
    # Deploy your image
    docker run -d -p 80:80 --name my_awesome_deployment [my_image_name]:[tag]

You’re done!


Need help?

If you have any technical questions or encounter any problems, get in touch with our Support team! We are here to help, and will provide support if you encounter any issues with NebCompute.