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

chore: add registry auth to docker image apps #4187

Draft
wants to merge 15 commits into
base: next
Choose a base branch
from

Conversation

OSINTRoach
Copy link

@OSINTRoach OSINTRoach commented Nov 8, 2024

Changes

  • Added docker login and logout for docker images application with registry url, username and token/password input on frontend

@OSINTRoach
Copy link
Author

OSINTRoach commented Nov 8, 2024

I would like some input on this, I have some questions ex:

  • Password/token is shown on debug logs, should it be like that
  • Should i encrypt token ?
  • I can't fully test because I have some problems with my local deployment on my mac so not fully tested so I need help with that

@OSINTRoach OSINTRoach marked this pull request as draft November 8, 2024 12:58
@OSINTRoach OSINTRoach marked this pull request as ready for review November 8, 2024 17:57
@peaklabs-dev
Copy link
Member

peaklabs-dev commented Nov 8, 2024

Password/token is shown on debug logs, should it be like that

No it should only show like on GitHub actions for example -> Like REGISTRY_SECRET only show the env or so not the value

Should i encrypt token

Yes please - all sensitive data needs to be encrypted (passwords tokens etc), very simple to implement thanks to Laravel

I can't fully test because I have some problems with my local deployment on my mac so not fully tested so I need help with that

What issues are you facing, maybe DM me or open discussion on Discord

@peaklabs-dev peaklabs-dev self-assigned this Nov 10, 2024
@peaklabs-dev peaklabs-dev added the 🛠️ Feature Issues requesting a new feature. label Nov 10, 2024
@peaklabs-dev
Copy link
Member

Thanks for taking the time to improve the PR. Overall the PR is coming along nicely.
If you have time, I would like to see the following adjustments:

  1. Add a new database table for registrations (they should be stored in a separate table)
  2. Move the UI for adding registries to a new section called Images in the sidebar (the sidebar on the left) and once clicked there will be a page with two horizontal tabs (on top - like on the new server view) the first tab is called Images (nothing there yet) and the second tab is called Registries. And there we should have an add button and then a form for different registries for the most popular registries like docker hub, grc (google), ghrc.io (GitHub container registry), quay and so on.
  3. On deployment, dockerfile, docker images, nixpacks etc everywhere add the checkbox you have already added (so each deployment type can use a custom/ private registry) and then instead of giving the fields once the checkbox is enabled add a dropdown where the user can select from one of the registries added in the registries tab.

If you need help with anything just let me know.

@peaklabs-dev peaklabs-dev added 💤 Waiting for feedback Issues awaiting a response from the author. and removed 💤 Waiting for feedback Issues awaiting a response from the author. labels Nov 10, 2024
@OSINTRoach OSINTRoach marked this pull request as draft November 11, 2024 09:55
public ?string $username = null;
public ?string $token = null;

protected $rules = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the new validation attribute of Livewire as this syntax is deprecated. https://livewire.laravel.com/docs/validation#validate-attributes

try {
// setup
$this->dockerImage = $this->application->docker_registry_image_name;
if (str($this->application->docker_registry_image_tag)->isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker_registry_image_tag why do we call it docker registry image tag I think dockerImageTag will be sufficient as this is available on all repos (would be great if you could rename it.

public ?string $username = null;
public ?string $token = null;

protected $rules = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also use the new validate attribute syntax

<div class="w-fit">
<x-forms.checkbox wire:model.live="application.docker_use_custom_registry"
id="application.docker_use_custom_registry"
helper="Select a registry to pull the image from." label="Use Private Registry" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add the private registry section to all git deploy types under docker image:
image
-> Somewhere down here (Nixpacks, docker Image and Dockerfile have this).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing: A dropdown is a bit limited, if you have docker hub and ghrc private images it should probably be a multiselect so you can select multiple private registries and these will be used.

@peaklabs-dev
Copy link
Member

peaklabs-dev commented Nov 13, 2024

  • The first Images tab will be for displaying all the docker images on the user's system (all servers or maybe per server would be better) and also offer to delete them individually or remove all the unused images with the click of a button, also it should show the total storage used by images somewhere on top. And when you click on an image you can see details like the architecture it supports, the size of the image and so on.

@peaklabs-dev
Copy link
Member

peaklabs-dev commented Nov 14, 2024

I also found an Icon you can use, same one as in docker desktop: https://tablericons.com/icon/cube-3d-sphere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ Feature Issues requesting a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants