Compare commits

...

2 Commits

Author SHA1 Message Date
367fff60ea feat: msgctx support
Some checks failed
continuous-integration/drone/push Build is failing
See #647
See toolshed/xgettext-go#1
2025-09-28 12:52:25 +02:00
c92a0d0703 feat: Add cloud-init file
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-09-14 13:02:21 -04:00
16 changed files with 179 additions and 28 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/kadabra /kadabra
dist/ dist/
tests/integration/.bats tests/integration/.bats
/bin

View File

@ -78,14 +78,20 @@ update-po:
done done
.PHONY: update-pot .PHONY: update-pot
update-pot: update-pot: ./bin/xgettext-go
@xgettext-go \ @./bin/xgettext-go \
-o pkg/i18n/locales/$(DOMAIN).pot \ -o pkg/i18n/locales/$(DOMAIN).pot \
--keyword=i18n.G \ --keyword=i18n.G \
--keyword-ctx=i18n.GC \
--sort-output \ --sort-output \
--add-comments-tag="translators" \ --add-comments-tag="translators" \
$$(find . -name "*.go" -not -path "*vendor*" | sort) $$(find . -name "*.go" -not -path "*vendor*" | sort)
./bin/xgettext-go:
@mkdir -p ./bin && \
wget -O ./bin/xgettext-go https://git.coopcloud.tech/toolshed/xgettext-go/raw/branch/main/xgettext-go && \
chmod +x ./bin/xgettext-go
.PHONY: update-pot-po-metadata .PHONY: update-pot-po-metadata
update-pot-po-metadata: update-pot-po-metadata:
@sed -i "s/charset=CHARSET/charset=UTF-8/g" pkg/i18n/locales/*.po pkg/i18n/locales/*.pot @sed -i "s/charset=CHARSET/charset=UTF-8/g" pkg/i18n/locales/*.po pkg/i18n/locales/*.pot

View File

@ -9,7 +9,7 @@ import (
// translators: `abra app` aliases. use a comma separated list of aliases with // translators: `abra app` aliases. use a comma separated list of aliases with
// no spaces in between // no spaces in between
var appAliases = i18n.G("a") var appAliases = i18n.GC("a", "abra app")
var AppCommand = &cobra.Command{ var AppCommand = &cobra.Command{
// translators: `app` command group // translators: `app` command group

View File

@ -268,7 +268,7 @@ func init() {
AppBackupListCommand.Flags().BoolVarP( AppBackupListCommand.Flags().BoolVarP(
&showAllPaths, &showAllPaths,
i18n.G("all"), i18n.G("all"),
i18n.G("a"), i18n.GC("a", "app backup"),
false, false,
i18n.G("show all paths"), i18n.G("show all paths"),
) )

View File

@ -166,7 +166,7 @@ func init() {
AppRestartCommand.Flags().BoolVarP( AppRestartCommand.Flags().BoolVarP(
&allServices, &allServices,
i18n.G("all-services"), i18n.G("all-services"),
i18n.G("a"), i18n.GC("a", "app restart"),
false, false,
i18n.G("restart all services"), i18n.G("restart all services"),
) )

View File

@ -574,7 +574,7 @@ func init() {
AppSecretGenerateCommand.Flags().BoolVarP( AppSecretGenerateCommand.Flags().BoolVarP(
&generateAllSecrets, &generateAllSecrets,
i18n.G("all"), i18n.G("all"),
i18n.G("a"), i18n.GC("a", "app secret generate"),
false, false,
i18n.G("generate all secrets"), i18n.G("generate all secrets"),
) )
@ -614,7 +614,7 @@ func init() {
AppSecretRmCommand.Flags().BoolVarP( AppSecretRmCommand.Flags().BoolVarP(
&rmAllSecrets, &rmAllSecrets,
i18n.G("all"), i18n.G("all"),
i18n.G("a"), i18n.GC("a", "app secret rm"),
false, false,
i18n.G("remove all secrets"), i18n.G("remove all secrets"),
) )

View File

@ -119,7 +119,7 @@ func init() {
RecipeFetchCommand.Flags().BoolVarP( RecipeFetchCommand.Flags().BoolVarP(
&fetchAllRecipes, &fetchAllRecipes,
i18n.G("all"), i18n.G("all"),
i18n.G("a"), i18n.GC("a", "recipe fetch"),
false, false,
i18n.G("fetch all recipes"), i18n.G("fetch all recipes"),
) )

View File

@ -381,7 +381,7 @@ func init() {
RecipeUpgradeCommand.Flags().BoolVarP( RecipeUpgradeCommand.Flags().BoolVarP(
&allTags, &allTags,
i18n.G("all-tags"), i18n.G("all-tags"),
i18n.G("a"), i18n.GC("a", "recipe upgrade"),
false, false,
i18n.G("list all tags, not just upgrades"), i18n.G("list all tags, not just upgrades"),
) )

View File

@ -20,7 +20,7 @@ import (
// translators: `abra server add` aliases. use a comma separated list of // translators: `abra server add` aliases. use a comma separated list of
// aliases with no spaces in between // aliases with no spaces in between
var serverAddAliases = i18n.G("a") var serverAddAliases = i18n.GC("a", "server add")
var ServerAddCommand = &cobra.Command{ var ServerAddCommand = &cobra.Command{
// translators: `server add` command // translators: `server add` command

View File

@ -96,7 +96,7 @@ func init() {
ServerPruneCommand.Flags().BoolVarP( ServerPruneCommand.Flags().BoolVarP(
&allFilter, &allFilter,
i18n.G("all"), i18n.G("all"),
i18n.G("a"), i18n.GC("a", "server prune"),
false, false,
i18n.G("remove all unused images"), i18n.G("remove all unused images"),
) )

View File

@ -551,7 +551,7 @@ func init() {
UpgradeCommand.Flags().BoolVarP( UpgradeCommand.Flags().BoolVarP(
&updateAll, &updateAll,
i18n.G("all"), i18n.G("all"),
i18n.G("a"), i18n.GC("a", "abra upgrade"),
false, false,
i18n.G("update all deployed apps"), i18n.G("update all deployed apps"),
) )

View File

@ -20,6 +20,7 @@ var (
Locale = DefaultLocale Locale = DefaultLocale
_, Mo = LoadLocale() _, Mo = LoadLocale()
G = Mo.Get G = Mo.Get
GC = Mo.GetC
) )
func LoadLocale() (string, *gotext.Mo) { func LoadLocale() (string, *gotext.Mo) {

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "Project-Id-Version: \n" msgstr "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n" "Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2025-09-10 21:44+0200\n" "POT-Creation-Date: 2025-09-28 12:38+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -1668,9 +1668,55 @@ msgstr ""
#. translators: `abra app` aliases. use a comma separated list of aliases with #. translators: `abra app` aliases. use a comma separated list of aliases with
#. no spaces in between #. no spaces in between
#: ./cli/app/app.go:12
msgctxt "abra app"
msgid "a"
msgstr ""
#: ./cli/app/backup.go:271
msgctxt "app backup"
msgid "a"
msgstr ""
#: ./cli/app/restart.go:169
msgctxt "app restart"
msgid "a"
msgstr ""
#: ./cli/app/secret.go:577
msgctxt "app secret generate"
msgid "a"
msgstr ""
#: ./cli/app/secret.go:617
msgctxt "app secret rm"
msgid "a"
msgstr ""
#: ./cli/recipe/fetch.go:122
msgctxt "recipe fetch"
msgid "a"
msgstr ""
#: ./cli/recipe/upgrade.go:384
msgctxt "recipe upgrade"
msgid "a"
msgstr ""
#. translators: `abra server add` aliases. use a comma separated list of #. translators: `abra server add` aliases. use a comma separated list of
#. aliases with no spaces in between #. aliases with no spaces in between
#: ./cli/app/app.go:12 ./cli/app/backup.go:271 ./cli/app/restart.go:169 ./cli/app/secret.go:577 ./cli/app/secret.go:617 ./cli/recipe/fetch.go:122 ./cli/recipe/upgrade.go:384 ./cli/server/add.go:23 ./cli/server/prune.go:99 ./cli/updater/updater.go:554 #: ./cli/server/add.go:23
msgctxt "server add"
msgid "a"
msgstr ""
#: ./cli/server/prune.go:99
msgctxt "server prune"
msgid "a"
msgstr ""
#: ./cli/updater/updater.go:554
msgctxt "abra upgrade"
msgid "a" msgid "a"
msgstr "" msgstr ""

View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n" "Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2025-09-10 21:44+0200\n" "POT-Creation-Date: 2025-09-28 12:38+0200\n"
"PO-Revision-Date: 2025-09-04 08:14+0000\n" "PO-Revision-Date: 2025-09-04 08:14+0000\n"
"Last-Translator: chasqui <chasqui@cryptolab.net>\n" "Last-Translator: chasqui <chasqui@cryptolab.net>\n"
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-" "Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-"
@ -1695,19 +1695,19 @@ msgid ""
"\n" "\n"
"Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name " "Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "
"\"help\"))}}\n" "\"help\"))}}\n"
" {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}" " {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if ."
"{{if .HasAvailableLocalFlags}}\n" "HasAvailableLocalFlags}}\n"
"\n" "\n"
"Flags:\n" "Flags:\n"
"{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}" "{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if ."
"{{if .HasAvailableInheritedFlags}}\n" "HasAvailableInheritedFlags}}\n"
"\n" "\n"
"Global Flags:\n" "Global Flags:\n"
"{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}" "{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if ."
"{{if .HasHelpSubCommands}}\n" "HasHelpSubCommands}}\n"
"\n" "\n"
"Additional help topics:{{range .Commands}}" "Additional help topics:{{range .Commands}}{{if ."
"{{if .IsAdditionalHelpTopicCommand}}\n" "IsAdditionalHelpTopicCommand}}\n"
" {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}" " {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}"
"{{if .HasAvailableSubCommands}}\n" "{{if .HasAvailableSubCommands}}\n"
"\n" "\n"
@ -1829,12 +1829,55 @@ msgstr ""
#. translators: `abra app` aliases. use a comma separated list of aliases with #. translators: `abra app` aliases. use a comma separated list of aliases with
#. no spaces in between #. no spaces in between
#: cli/app/app.go:12
msgctxt "abra app"
msgid "a"
msgstr ""
#: cli/app/backup.go:271
msgctxt "app backup"
msgid "a"
msgstr ""
#: cli/app/restart.go:169
msgctxt "app restart"
msgid "a"
msgstr ""
#: cli/app/secret.go:577
msgctxt "app secret generate"
msgid "a"
msgstr ""
#: cli/app/secret.go:617
msgctxt "app secret rm"
msgid "a"
msgstr ""
#: cli/recipe/fetch.go:122
msgctxt "recipe fetch"
msgid "a"
msgstr ""
#: cli/recipe/upgrade.go:384
msgctxt "recipe upgrade"
msgid "a"
msgstr ""
#. translators: `abra server add` aliases. use a comma separated list of #. translators: `abra server add` aliases. use a comma separated list of
#. aliases with no spaces in between #. aliases with no spaces in between
#: cli/app/app.go:12 cli/app/backup.go:271 cli/app/restart.go:169 #: cli/server/add.go:23
#: cli/app/secret.go:577 cli/app/secret.go:617 cli/recipe/fetch.go:122 msgctxt "server add"
#: cli/recipe/upgrade.go:384 cli/server/add.go:23 cli/server/prune.go:99 msgid "a"
msgstr ""
#: cli/server/prune.go:99
msgctxt "server prune"
msgid "a"
msgstr ""
#: cli/updater/updater.go:554 #: cli/updater/updater.go:554
msgctxt "abra upgrade"
msgid "a" msgid "a"
msgstr "" msgstr ""
@ -4910,8 +4953,8 @@ msgstr ""
#: cli/recipe/upgrade.go:228 #: cli/recipe/upgrade.go:228
#, c-format #, c-format
msgid "" msgid ""
"service %s is at version %s, but pinned to %s, please correct your " "service %s is at version %s, but pinned to %s, please correct your compose."
"compose.yml file manually!" "yml file manually!"
msgstr "" msgstr ""
#: cli/recipe/upgrade.go:224 #: cli/recipe/upgrade.go:224

View File

@ -0,0 +1,5 @@
# cloud-init
This folder contains cloud-init files for installing Abra and its dependencies.
For more information, see <https://cloudinit.readthedocs.io/en/latest/index.html>

View File

@ -0,0 +1,49 @@
#cloud-config
package_update: true
package_upgrade: true
package_reboot_if_required: true
# https://packages.debian.org/bookworm/docker.io
packages:
- ca-certificates
- curl
- docker.io
- docker-compose
# https://stackoverflow.com/a/74084180
- apparmor
# https://docs.coopcloud.tech/operators/tutorial/#server-setup
runcmd:
- curl -fsSL https://install.abra.coopcloud.tech | env HOME=/root bash
- docker swarm init
- docker network create -d overlay proxy
write_files:
# Add abra to PATH and set EDITOR
- path: /etc/profile.d/custom_path.sh
content: |
export PATH=$PATH:$HOME/.local/bin
export EDITOR=vim
owner: root:root
permissions: '0755'
# Send container log to journald: https://docs.coopcloud.tech/operators/handbook/#how-do-i-persist-container-logs-after-they-go-away
- path: /etc/docker/daemon.json
content: |
{
"log-driver": "journald",
"log-opts": {
"labels":"com.docker.swarm.service.name"
}
}
owner: root:root
permissions: '0644'
# Rotate logs
- path: /etc/systemd/journald.conf
content: |
[Journal]
Storage=persistent
SystemMaxUse=5G
MaxFileSec=1month
owner: root:root
permissions: '0644'