m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-08 05:03:49 -05:00

12 Commits

Author SHA1 Message Date
Sergio
90af772dd7 chore: bump project version 2025-10-14 18:06:50 +03:00
makonde-on-git
6ab06db5cb feat: allow usage without a daemon (#142) 2025-10-14 18:05:11 +03:00
Sergio
547d418401 docs: fix incorrect compose example with environment variables 2025-09-28 21:49:35 +03:00
Sergio
54f00c6c61 add a full stop 2025-09-10 11:57:42 +03:00
Sergio
b55ddfd3ad reword README 2025-09-10 11:57:17 +03:00
Sergio
14887cb766 add notice 2025-09-10 11:24:24 +03:00
Sergio
b0d0a02182 docs: update example homepage widget to conform to latest config spec
Co-authored-by: Valdr687 <106614142+Valdr687@users.noreply.github.com>
2025-08-29 17:42:56 +03:00
Sergio
c351a38642 docs: update homepage widget example
Remove usage of non-default port 9000 and change server ip placeholder to hostname instead
2025-08-25 19:11:59 +03:00
Sergio
ebb7c18bca fix: include OCI image manifest MIME type in Accept header when
checking for a digest update

Closes #132
2025-08-11 13:01:53 +03:00
Sergio
b542f1bac5 chore: bump project version 2025-05-27 14:51:48 +03:00
Sergio
34ae9cb36f fix: ignore empty refresh interval 2025-05-27 14:51:48 +03:00
Sergio
e015afbaca chore: update project version in Cargo.lock
This should have happened automatically when Cargo.toml was updated
2025-05-27 14:51:13 +03:00
11 changed files with 67 additions and 21 deletions

2
Cargo.lock generated
View File

@@ -376,7 +376,7 @@ dependencies = [
[[package]]
name = "cup"
version = "3.3.0"
version = "3.4.2"
dependencies = [
"bollard",
"chrono",

View File

@@ -1,6 +1,6 @@
[package]
name = "cup"
version = "3.4.0"
version = "3.4.3"
edition = "2021"
[dependencies]

17
NOTICE.md Normal file
View File

@@ -0,0 +1,17 @@
Hello,
I have an important announcement to make.
### The situation
You may have noticed that the last few months Cup's development has stalled. I had very little time to work on it. Tomorrow, the 11th of September, 2025, I am starting my last year of school. It is very important to me to get into a good university, so I will be studying all day, with no time to work on my projects.
What this means for you is that the development of Cup is paused, at least until June 2026. That means no new features and no bugfixes. If Cup works fine for you and you're comfortable with not getting any updates (this does _not_ mean Cup is suddenly insecure by the way), you can keep using it. Otherwise, there are many alternatives you can look at, which are actively maintained and may provide the features you need.
### How you can help
If you're a Rust developer, I would really appreciate it if you could start contributing to Cup. There are a bunch of open issues that need to be worked on. I can find some time to review PRs. You can also fork the repository and do your own thing, if you prefer.
I've also left a few new features in the `v4` branch and a rewrite I started in `rewrite`, because I feel like the code is unmaintainable in its current state. I'd love it if someone could help work on that.
That's all I had to say. I'm sorry if I let you down, this was a really hard decision to make. I would like to thank all of you for your help and support, it really means a lot to me. I hope I can continue working on the project once I'm done with my final exams!

View File

@@ -7,6 +7,8 @@
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/sergi0g/cup)
[![Discord](https://img.shields.io/discord/1337705080518086658)](https://discord.gg/jmh5ctzwNG)
> [!IMPORTANT]
> There have been some important changes regarding Cup's development. Read more [here](./NOTICE.md).
Cup is the easiest way to check for container image updates.

View File

@@ -70,7 +70,7 @@
},
"socket": {
"type": "string",
"description": "The path to the unix socket you would like Cup to use for communication with the Docker daemon. Useful if you're trying to use Cup with Podman.",
"description": "The path to the unix socket you would like Cup to use for communication with the Docker daemon. Useful if you're trying to use Cup with Podman. To disable use \"none\" as value.",
"minLength": 1
},
"servers": {

View File

@@ -51,29 +51,24 @@ Credit: [@agrmohit](https://github.com/agrmohit)
```yaml
widget:
type: customapi
url: http://<SERVER_IP>:9000/api/v3/json
url: http://<SERVER_HOSTNAME>/api/v3/json
refreshInterval: 10000
method: GET
mappings:
- field:
metrics: monitored_images
- field: metrics.monitored_images
label: Monitored images
format: number
- field:
metrics: up_to_date
- field: metrics.up_to_date
label: Up to date
format: number
- field:
metrics: updates_available
- field: metrics.updates_available
label: Available updates
format: number
- field:
metrics: unknown
- field: metrics.unknown
label: Unknown
format: number
```
Preview:
<Image src={widget2} />
Credit: [@remussamoila](https://github.com/remussamoila)
Credit: [@remussamoila](https://github.com/remussamoila) and [@Valdr687](https://github.com/Valdr687)

View File

@@ -23,7 +23,7 @@ For example, if using Podman, you might do
$ cup -s /run/user/1000/podman/podman.sock check
```
This option is also available in the configuration file and it's best to put it there.
This option is also available in the configuration file and it's best to put it there. If both are defined the CLI `-s` option takes precedence.
<Cards.Card
icon={<IconPlug />}
@@ -31,6 +31,8 @@ This option is also available in the configuration file and it's best to put it
href="/docs/configuration/socket"
/>
To disable Docker/Podman socket use "none" as value.
## Configuration file
Cup has an option to be configured from a configuration file named `cup.json`.
@@ -131,11 +133,11 @@ services:
ports:
- 8000:8000
environment:
- CUP_AGENT: true
- CUP_IGNORE_UPDATE_TYPE: major
- CUP_REFRESH_INTERVAL: "0 */30 * * * *"
- CUP_SOCKET: tcp://localhost:2375
- CUP_THEME: blue
CUP_AGENT: "true"
CUP_IGNORE_UPDATE_TYPE: major
CUP_REFRESH_INTERVAL: "0 */30 * * * *"
CUP_SOCKET: tcp://localhost:2375
CUP_THEME: blue
```
<Callout>

View File

@@ -17,3 +17,12 @@ You can also specify a TCP socket if you're using a remote Docker host or a [pro
// Other options
}
```
Or use the "none" value to disable any Docker/Podman query:
```jsonc
{
"socket": "none"
// Other options
}
```

View File

@@ -1,5 +1,6 @@
use rustc_hash::FxHashMap;
use serde::Deserialize;
use serde::Deserializer;
use std::env;
use std::mem;
use std::path::PathBuf;
@@ -64,6 +65,7 @@ pub struct Config {
pub agent: bool,
pub ignore_update_type: UpdateType,
pub images: ImageConfig,
#[serde(deserialize_with = "empty_as_none")]
pub refresh_interval: Option<String>,
pub registries: FxHashMap<String, RegistryConfig>,
pub servers: FxHashMap<String, String>,
@@ -151,3 +153,15 @@ impl Default for Config {
Self::new()
}
}
fn empty_as_none<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
where
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
if s.is_empty() {
Ok(None)
} else {
Ok(Some(s))
}
}

View File

@@ -41,6 +41,9 @@ pub async fn get_images_from_docker_daemon(
ctx: &Context,
references: &Option<Vec<String>>,
) -> Vec<Image> {
if ctx.config.socket.as_deref() == Some("none") {
return vec![];
}
let client: Docker = create_docker_client(ctx.config.socket.as_deref());
let mut swarm_images = match client.list_services::<String>(None).await {
Ok(services) => services
@@ -96,6 +99,10 @@ pub async fn get_images_from_docker_daemon(
}
pub async fn get_in_use_images(ctx: &Context) -> Vec<String> {
if ctx.config.socket.as_deref() == Some("none") {
return vec![];
}
let client: Docker = create_docker_client(ctx.config.socket.as_deref());
let containers = match client

View File

@@ -58,7 +58,7 @@ pub async fn get_latest_digest(
protocol, &image.parts.registry, &image.parts.repository, &image.parts.tag
);
let authorization = to_bearer_string(&token);
let headers = [("Accept", Some("application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.index.v1+json")), ("Authorization", authorization.as_deref())];
let headers = [("Accept", Some("application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json")), ("Authorization", authorization.as_deref())];
let response = client.head(&url, &headers).await;
let time = start.elapsed().unwrap().as_millis() as u32;