MightyMoud / sidekick

Bare metal to production ready in mins; your own fly server on your VPS.
https://www.sidekickdeploy.com
GNU General Public License v3.0
5.94k stars 97 forks source link

Launching fails silently when Sop is unable to parse an .env file #24

Closed adampresley closed 1 month ago

adampresley commented 1 month ago

The server machine:

Client machine is running MacOS Sequoia.

The application is a Go application. I have a Dockerfile that builds successfully, and a environment variables file named .env.production. Here is a screenshot (with redactions).

CleanShot 2024-09-25 at 15 34 26@2x

What I'm seeing is that the launch appears successful. However, looking at running Docker processes, I don't see my new app container.

CleanShot 2024-09-25 at 15 37 35@2x

So I looked over the code and see that you are using Sop to handle sending encrypted environment variables to the docker compose command. I tried running this manually and here is what I see.

CleanShot 2024-09-25 at 15 38 22@2x

Are there any "gotchas" I should be aware of when using Sop with an environment file?

MightyMoud commented 1 month ago

Hi @adampresley

I haven't come across this before. I'll replicate it tonight and do some testing.

But it seems to be reported before on sops side https://github.com/getsops/sops/issues/1128 & https://github.com/getsops/sops/issues/814

MightyMoud commented 1 month ago

@adampresley would this solve your issue? https://github.com/getsops/sops/issues/1157#issuecomment-1551548815 I am unable to replicate this issue currently. So it's really hard to work on it

BraydenGirard commented 1 month ago

I seem to get the issue no matter what I do. I tried wiping my server and starting fresh and after first deploy any subsequent deploy gives this issue. I don't believe it has anything to do with Windows line endings in my case as I am creating the project on Ubuntu 24.04 and deploying to a Ubuntu 24.04 server.

https://github.com/MightyMoud/sidekick/issues/34 is my issue, makes this unusable unfortunately as I can't seem to get around it

BraydenGirard commented 1 month ago

@MightyMoud if it helps I can add you onto my private repo so you can test with the same code base. Its a pocketbase project.

MightyMoud commented 1 month ago

@MightyMoud if it helps I can add you onto my private repo so you can test with the same code base. Its a pocketbase project.

That would be brilliant. Please do so. I'm struggling to replicate this.

BraydenGirard commented 1 month ago

@MightyMoud sent

MightyMoud commented 1 month ago

Thanks @BraydenGirard I'll have a look tomorrow evening

MightyMoud commented 1 month ago

@BraydenGirard just having a quick look at this, I can't seem to find the env file you are building with. Could we chat over email? m.mousa @ hey.com

BraydenGirard commented 1 month ago

@BraydenGirard just having a quick look at this, I can't seem to find the env file you are building with. Could we chat over email? m.mousa @ hey.com

Email sent

MightyMoud commented 1 month ago

I am able to replicate this now by adding single quotes around the timestamp inside of the encrypted.env file. This is mentioned here https://github.com/getsops/sops/issues/814 I'm still not sure how that single quote got there.

@adampresley can you run sops --version & age --version on your local and let me know what version do you have?

adampresley commented 1 month ago

@MightyMoud Sure. Sops: sops 3.9.0. I don't have "age".

MightyMoud commented 1 month ago

Alright I can replicate this now. Thanks gents. I'll push some changes soon. I think I will also overhaul the env handling method in Sidekick soon.

Stay tuned

MightyMoud commented 1 month ago

Alright this should now be fixed with v0.6.4 it would require you to have brew installed on your local. Which should be an easy requirement since that's how you, mostly, install Sidekick. It will also install sops for you on your local which is required. It will be on Brew in a couple of hours.

@adampresley please try again with latest version and let me know