Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.0.15] - Agente e tipos na lista
- **Pasta e arquivo diferenciados:** nas listas do que salvar e das exclusões, cada item tem ícone e etiqueta (Pasta, Arquivo, Atalho, Padrão), e as pastas terminam com `/`. Um caminho que não existe mais no agente aparece como **Não encontrado**.
- **Nomes:** a máquina onde o backup roda é sempre chamada de **agente** na interface, nos e-mails e no PDF. "Servidor" fica só para servidores SMTP, SFTP, FTP, SMB e de banco.

## [0.0.14] - Pasta local pelo painel
- **Segurança:** a pasta de dados do agente (credencial e jobs, com senhas de bancos e destinos) nunca entra num backup, mesmo selecionando o `/` inteiro.
- **Pasta do backup local escolhida no painel:** navegue pelos discos do servidor, crie a pasta e veja o **espaço livre** antes de escolher. Exige o novo volume `- /:/host-rw` na stack do agente (dá permissão de gravação no servidor; `CORUJA_BACKUP_ROOTS` limita onde). A origem continua somente leitura. Jobs antigos continuam na pasta padrão.
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN mkdir -p /src/internal/webui && npm run build
# Os estágios web e gobuild rodam na plataforma nativa do runner (sem emulação); só o binário é cruzado.
# --- binários Go -----------------------------------------------------------------------------------------------------
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS gobuild
ARG VERSION=0.0.14
ARG VERSION=0.0.15
ARG TARGETOS
ARG TARGETARCH
WORKDIR /src
Expand All @@ -32,7 +32,7 @@ RUN --mount=type=secret,id=google_client_secret --mount=type=secret,id=google_we

# --- Server ------------------------------------------------------------------------------------------------------------
FROM alpine:3.21 AS server
ARG VERSION=0.0.14
ARG VERSION=0.0.15
LABEL org.opencontainers.image.title="Coruja Backup Server" \
org.opencontainers.image.description="Backup centralizado: orquestração, agendamentos, nuvem e interface web" \
org.opencontainers.image.source="https://github.com/AprendendoLinux/corujabackup" \
Expand All @@ -48,7 +48,7 @@ ENTRYPOINT ["/usr/local/bin/coruja-server"]

# --- Agente ------------------------------------------------------------------------------------------------------------
FROM alpine:3.21 AS agent
ARG VERSION=0.0.14
ARG VERSION=0.0.15
LABEL org.opencontainers.image.title="Coruja Backup Agent" \
org.opencontainers.image.description="Agente leve do Coruja Backup (conecta ao Server por IP:porta)" \
org.opencontainers.image.source="https://github.com/AprendendoLinux/corujabackup" \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Sistema de backup **centralizado**, em Docker, gerenciado por **interface web**. Um **Server** orquestra tudo; **Agentes** leves rodam
nos servidores de destino e se conectam a ele informando só **IP:porta + token**.

> **Versão 0.0.14** · [Changelog](CHANGELOG.md) · [Instalação](docs/INSTALACAO.md) · [Operação](docs/OPERACAO.md) · [Segurança](docs/SEGURANCA.md) · [FAQ](docs/FAQ.md)
> **Versão 0.0.15** · [Changelog](CHANGELOG.md) · [Instalação](docs/INSTALACAO.md) · [Operação](docs/OPERACAO.md) · [Segurança](docs/SEGURANCA.md) · [FAQ](docs/FAQ.md)

## O que faz

Expand Down Expand Up @@ -69,4 +69,4 @@ docker run --rm --network SUA_REDE -e CORUJA_TEST_DSN='usuario:senha@tcp(db:3306
```

---
Coruja Backup - Versão 0.0.14 - Desenvolvido por [Henrique Fagundes](https://henrique.tec.br) · Licença MIT
Coruja Backup - Versão 0.0.15 - Desenvolvido por [Henrique Fagundes](https://henrique.tec.br) · Licença MIT
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.14
0.0.15
2 changes: 1 addition & 1 deletion deploy/docker-compose.agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Informe o endereço do canal dos agentes do Server e o token gerado na interface (Agentes > Novo agente; vale uma vez).
services:
agent:
image: ghcr.io/aprendendolinux/corujabackup-agent:0.0.14
image: ghcr.io/aprendendolinux/corujabackup-agent:0.0.15
container_name: corujabackup-agent
restart: always
environment:
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker-compose.server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
networks: [echelon]

server:
image: ghcr.io/aprendendolinux/corujabackup-server:0.0.14
image: ghcr.io/aprendendolinux/corujabackup-server:0.0.15
container_name: corujabackup-server
restart: always
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker compose -f docker-compose.dev.yml up -d --build -> http://187.110.161.52:8081
services:
server:
build: { context: ., target: server, args: { VERSION: "0.0.14" } }
build: { context: ., target: server, args: { VERSION: "0.0.15" } }
container_name: corujabackup-dev-server
restart: unless-stopped
ports: ["8081:8080", "8444:8443"] # 8081 = interface web · 8444 = canal dos agentes
Expand Down
1 change: 1 addition & 0 deletions docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [x] **Fase 9, parte 2 – Destinos de rede (0.0.12):** SFTP, FTP/FTPS, SMB e pasta local/volume do host (NFS e iSCSI).
- [x] **Usabilidade (0.0.13):** seleção de pastas e arquivos por clique (origem, exclusões e destinos), endereço público do canal dos agentes e botões de copiar funcionando em `http://IP`.
- [x] **Pasta local pelo painel (0.0.14):** servidor inteiro visível, pasta do backup local escolhida na interface com o espaço livre, e o que é do agente (backups, destinos e credenciais) fora dos backups.
- [x] **Clareza da interface (0.0.15):** a máquina do backup é sempre chamada de agente; pastas, arquivos, atalhos e padrões identificados nas listas.
- [ ] **Fase 9, parte 3:** vários destinos por job; compatíveis com S3; SharePoint.
- [ ] **Fase 10 – Full/Incremental e MikroTik (versão seguinte):** motor `tar.gz` em blocos com índice e catálogo; agenda full + incrementais; retenção por cadeia; jobs de MikroTik (SSH: `.rsc` e `.backup`).
- [ ] **Fase 11 – Restauração inteligente (versão posterior):** árvore de arquivos, linha do tempo de versões, restauração de arquivos selecionados e de bancos pela interface.
Expand Down
2 changes: 1 addition & 1 deletion internal/agentcore/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func New(cfg Config, st *State, log *slog.Logger) *Core {
if chosen, err = c.localDir(job.Subdir); err != nil {
return Result{}, err
}
h.log("info", "pasta do backup local no servidor: %s", job.Subdir)
h.log("info", "pasta do backup local: %s", job.Subdir)
}
if job.DB != nil {
if chosen != "" {
Expand Down
4 changes: 2 additions & 2 deletions internal/agentcore/localdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func CheckLocalDir(p string) (string, error) {
}
clean := path.Clean(p)
if clean == "/" {
return "", errors.New("escolha uma pasta: o backup não pode ser gravado direto na raiz do servidor")
return "", errors.New("escolha uma pasta: o backup não pode ser gravado direto na raiz do agente")
}
for _, f := range forbiddenLocalDirs {
if clean == f || strings.HasPrefix(clean, f+"/") {
Expand All @@ -41,7 +41,7 @@ func CheckLocalDir(p string) (string, error) {
return clean, nil
}

var errNoWriteMount = errors.New("este agente não pode gravar no servidor: adicione o volume \"- /:/host-rw\" à stack do agente e recrie o contêiner")
var errNoWriteMount = errors.New("este agente não pode gravar fora das próprias pastas: adicione o volume \"- /:/host-rw\" à stack do agente e recrie o contêiner")

// writeRoot devolve a raiz gravável do servidor, como o agente a enxerga.
func (c *Core) writeRoot() (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/httpapi/handlers_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (s *Server) applyJobIn(ctx context.Context, j *store.Job, in jobIn) string
} else {
j.DestSubdir = strings.TrimRight(j.DestSubdir, "/")
if !subdirRE.MatchString(j.DestSubdir) || strings.Contains(j.DestSubdir, "..") {
return "pasta de destino inválida: use um caminho completo do servidor ou um nome relativo (letras, números, ponto, hífen, sublinhado e /), sem .."
return "pasta de destino inválida: use um caminho completo do agente ou um nome relativo (letras, números, ponto, hífen, sublinhado e /), sem .."
}
}
if in.Keep != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/report/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (e RunEvent) HTML() string {
var sb strings.Builder
sb.WriteString(`<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="font-size:14px">`)
sb.WriteString(kv(b, "Job", "<b>"+esc(r.Job)+"</b>"))
sb.WriteString(kv(b, "Servidor", esc(r.Agent)))
sb.WriteString(kv(b, "Agente", esc(r.Agent)))
sb.WriteString(kv(b, "Estado", badge(b, r.Status)))
sb.WriteString(kv(b, "Início", esc(fmtTime(r.StartedAt, loc))))
sb.WriteString(kv(b, "Duração", esc(fmtDur(r.StartedAt, r.FinishedAt))))
Expand Down Expand Up @@ -197,7 +197,7 @@ func (e AgentEvent) HTML() string {
if loc == nil {
loc = timeUTC
}
body := fmt.Sprintf(`<table role="presentation" width="100%%" cellpadding="0" cellspacing="0" style="font-size:14px">%s%s%s</table><p style="color:%s">O servidor não dá sinal há mais de %d minutos. Se ele estiver desligado ou sem rede, os backups agendados não vão rodar.</p>`,
kv(b, "Servidor", "<b>"+esc(e.Agent.Name)+"</b>"), kv(b, "Visto por último", esc(fmtTime(e.Agent.LastSeen, loc))), kv(b, "Versão do agente", esc(e.Agent.Version)), b.Muted, e.Minutes)
body := fmt.Sprintf(`<table role="presentation" width="100%%" cellpadding="0" cellspacing="0" style="font-size:14px">%s%s%s</table><p style="color:%s">O agente não dá sinal há mais de %d minutos. Se a máquina dele estiver desligada ou sem rede, os backups agendados não vão rodar.</p>`,
kv(b, "Agente", "<b>"+esc(e.Agent.Name)+"</b>"), kv(b, "Visto por último", esc(fmtTime(e.Agent.LastSeen, loc))), kv(b, "Versão do agente", esc(e.Agent.Version)), b.Muted, e.Minutes)
return shell(b, e.Subject(), "Agente offline", b.Danger, body, len(b.LogoPNG) > 0)
}
2 changes: 1 addition & 1 deletion internal/report/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (dl Daily) PDF() ([]byte, error) {
}
ar = append(ar, []string{a.Name, st, a.Version})
}
d.table([]col{{"Servidor", 70, "L"}, {"Estado", 80, "L"}, {"Versão", 30, "L"}}, ar)
d.table([]col{{"Agente", 70, "L"}, {"Estado", 80, "L"}, {"Versão", 30, "L"}}, ar)

if len(dl.Runs) > 0 {
p.AddPage()
Expand Down
4 changes: 2 additions & 2 deletions internal/report/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (e RunEvent) Telegram() string {

func (e RunEvent) Text() string {
r, loc := e.Run, e.loc()
s := fmt.Sprintf("%s\n\nJob: %s\nServidor: %s\nEstado: %s\nInício: %s\nDuração: %s\n", e.Subject(), r.Job, r.Agent, StatusLabel(r.Status), fmtTime(r.StartedAt, loc), fmtDur(r.StartedAt, r.FinishedAt))
s := fmt.Sprintf("%s\n\nJob: %s\nAgente: %s\nEstado: %s\nInício: %s\nDuração: %s\n", e.Subject(), r.Job, r.Agent, StatusLabel(r.Status), fmtTime(r.StartedAt, loc), fmtDur(r.StartedAt, r.FinishedAt))
if r.BytesOut > 0 {
s += "Arquivo: " + FmtBytes(r.BytesOut) + "\n"
}
Expand Down Expand Up @@ -142,5 +142,5 @@ func (e AgentEvent) Text() string {
if loc == nil {
loc = timeUTC
}
return fmt.Sprintf("%s\n\nO servidor %s não dá sinal há mais de %d minutos.\nVisto por último: %s\n\n%s - Versão %s\n", e.Subject(), e.Agent.Name, e.Minutes, fmtTime(e.Agent.LastSeen, loc), e.Name, e.Version)
return fmt.Sprintf("%s\n\nO agente %s não dá sinal há mais de %d minutos.\nVisto por último: %s\n\n%s - Versão %s\n", e.Subject(), e.Agent.Name, e.Minutes, fmtTime(e.Agent.LastSeen, loc), e.Name, e.Version)
}
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
package version

// Version é sobrescrita no build: -ldflags "-X github.com/AprendendoLinux/corujabackup/internal/version.Version=1.2.3".
var Version = "0.0.14"
var Version = "0.0.15"

const Name = "Coruja Backup"
4 changes: 2 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# Publicação manual das imagens multi-arquitetura (o fluxo normal é o workflow "Release", disparado pela tag vX.Y.Z).
# Uso: ./scripts/release.sh 0.0.14 (precisa de "docker login ghcr.io" e do buildx)
# Uso: ./scripts/release.sh 0.0.15 (precisa de "docker login ghcr.io" e do buildx)
set -e
V="${1:?informe a versão, ex.: 0.0.14}"
V="${1:?informe a versão, ex.: 0.0.15}"
OWNER="${OWNER:-aprendendolinux}"
cd "$(dirname "$0")/.."
# Segredo do app OAuth padrão do Google (opcional): GOOGLE_CLIENT_SECRET_FILE=/caminho/arquivo ./scripts/release.sh X.Y.Z
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "coruja-backup-web",
"private": true,
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
4 changes: 2 additions & 2 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function App() {
const [theme, setTheme] = useState('coruja')
const [phase, setPhase] = useState<Phase>('loading')
const [me, setMe] = useState<Me | null>(null)
const [version, setVersion] = useState('0.0.14')
const [version, setVersion] = useState('0.0.15')
const route = useRoute()
useFavicon(brand)

Expand Down Expand Up @@ -169,7 +169,7 @@ function Dashboard({ name, canReport }: { name: string; canReport: boolean }) {
{agents && active.length === 0 && (
<Card className="mt-6">
<b>Comece adicionando um agente.</b>
<p className="mt-1 text-sm text-muted">Vá em <a className="text-primary underline" href="#/agentes">Agentes</a> e gere um token de matrícula para o primeiro servidor.</p>
<p className="mt-1 text-sm text-muted">Vá em <a className="text-primary underline" href="#/agentes">Agentes</a> e gere um token de matrícula para o primeiro agente.</p>
</Card>
)}
</div>
Expand Down
6 changes: 3 additions & 3 deletions web/src/LocalDir.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Pasta do backup local: escolhida no disco do servidor do agente, com o espaço disponível.
// Pasta do backup local: escolhida no disco do agente, com o espaço disponível.
import { useEffect, useRef, useState } from 'react'
import { api, ApiError } from './api'
import { FolderField, FolderList, SpaceBar } from './Picker'
Expand Down Expand Up @@ -45,12 +45,12 @@ export function LocalDirField({ agentId, agentName, agentVersion, value, onChang
const legacy = value && !chosen ? `pasta padrão do agente › ${value}` : ''
return (
<div className="space-y-2">
<FolderField label="Pasta do backup local no servidor" value={chosen ? value.slice(1) : ''} autoText={legacy || (supported ? 'Escolha uma pasta do servidor…' : 'pasta padrão do agente')}
<FolderField label="Pasta do backup local no agente" value={chosen ? value.slice(1) : ''} autoText={legacy || (supported ? 'Escolha uma pasta do agente…' : 'pasta padrão do agente')}
prefix="/" resetLabel="Limpar a escolha" disabledReason={supported ? undefined : noMount ? `${noMount[0].toUpperCase()}${noMount.slice(1)}. Até lá, o backup local fica na pasta padrão dele.`
: 'Para escolher a pasta e ver o espaço livre, atualize este agente para a versão 0.0.14 ou mais nova. Até lá, o backup local fica na pasta padrão dele.'}
hint="Onde o arquivo do backup é gerado e onde ficam as cópias locais. A retenção só apaga os arquivos deste job."
onChange={(v) => onChange(v ? '/' + v.replace(/^\/+/, '') : '')}
picker={{ title: `Pasta do backup local em ${agentName}`, intro: 'Discos e pastas do servidor. O espaço mostrado é o do disco onde a pasta fica.', rootLabel: 'Servidor', load: (p) => load(p) }} />
picker={{ title: `Pasta do backup local em ${agentName}`, intro: 'Discos e pastas do agente. O espaço mostrado é o do disco onde a pasta fica.', rootLabel: 'Raiz', load: (p) => load(p) }} />
{space?.total ? <SpaceBar free={space.free ?? 0} total={space.total} /> : null}
{space && !space.exists && <p className="text-xs text-muted">Esta pasta será criada no primeiro backup.</p>}
{space?.blocked && <p className="text-xs text-danger">{space.blocked}</p>}
Expand Down
Loading
Loading