Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I fixed my 1-Click Packer build #184

Open
Cristy94 opened this issue Apr 16, 2024 · 1 comment
Open

How I fixed my 1-Click Packer build #184

Cristy94 opened this issue Apr 16, 2024 · 1 comment

Comments

@Cristy94
Copy link
Contributor

I am working on my 1-Click App, and I spent 1 week trying to make, using Packer, an image that actually works.

I am deploying from Windows, and I had to fix multiple issues from the current template/guide.

Those were the fixes I had to debug and implement:

  • Add rm -rf /opt/digitalocean to 90-cleanup.sh
  • Use ubuntu-20-04 because with ubuntu-22-04 packer fails SSH connection
  • Fix CRLF/LF newline issues. I wrote my scripts and ran packer on Windows, when uploading the newline characters where wrong. I had to make sure all scripts/files have the right LF line endings.
  • Fix file permissions. The 001_onboot and 99-one-click MOTD scripts were not executed, because files copied by packer don't have execute permissions.
    I have added this to marketplace-image.json, after the files are copied:
        {
          "type": "shell",
          "inline": [
            "chmod +x /var/lib/cloud/scripts/per-instance/001_onboot",
            "chmod +x /etc/update-motd.d/99-one-click"
          ]
        },
    
@Cristy94
Copy link
Contributor Author

Oh, and the MOTD IP retrieval was wrong. The hostname command used in the template just returns 127.0.0.1

I wrote this instead in 99-one-click: myip=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1 | head -n 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant