Setting up a vagrant with a digitalocean image

前端 未结 2 1822
情歌与酒
情歌与酒 2021-02-19 20:37

I dont know if this should be posted here or on another stack community so please let me know if its wrong posting it here.

How do I get a local (i.e. on my laptop) VM t

2条回答
  •  囚心锁ツ
    2021-02-19 21:09

    I was hoping to run a DigitalOcean droplet in a VM recently while researching a project based on immutable server design.

    I am planning on using Packer to build properly provisioned images for each of my servers. I would then utilize Vagrant to test my environment locally in VirtualBox prior to blessing the image for use in integration, stage, and production environments.

    While reading the Packer - Getting Started for Vagrant Boxes tutorial I noticed this line:

    If you followed along in the previous page and setup DigitalOcean, Packer can't currently make Vagrant boxes for DigitalOcean, but will be able to soon.

    This appears to have been on the documentation for some time now so who knows when "soon" will be, but I haven't found any official information on this yet.

    I later came across this blog post that discusses two possible ways to work around this limitation.

    1. Manually Convert a Digital Ocean Droplet to a VMware VM
    2. Settle for simply emulating a Digital Ocean environment and work from a similar base image

    I read through the instructions for (1) and it does sound legitimate although it is a rather time consuming and error prone endeavor. It sounds like emulating the setup is the best bet for now.

    If anyone is aware of any recent developments here please comment below.

    EDIT:

    I haven't tested it yet and the last update was from several years ago, but it sounds like this blog post and referenced git repo may be a good start. It still doesn't seem to be actually building the image from the DO image, but it is a pretty good example of (2) above by closely emulating.

    Oddly enough the documentation for Packer's Vagrant post-processor seems to indicate that it CAN create a vagrant box from a DigitalOcean image. If this is true then a perfectly sane flow would be to use Packer to build a provisioned vagrant box from DO to test at the same time building a DO image to spin up (on integration/stage) after verification it works as advertised in VM locally. Then you can promote the DO image through the rest of your live environments.

提交回复
热议问题