Skip to content

Commit

Permalink
added env cargo from
Browse files Browse the repository at this point in the history
  • Loading branch information
oxmix committed May 31, 2024
1 parent bad7df6 commit dae4894
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ docker run -d --name container-ship \
-v $(pwd)/assets:/assets \
-p 127.0.0.1:8443:8443 \
-e ENDPOINT=127.0.0.1:8443 \
-e CARGO_FROM=mirror.gcr.io/oxmix/cargo-deployer:latest \
--restart always \
--log-driver json-file \
--log-opt max-size=128k \
oxmix/container-ship
mirror.gcr.io/oxmix/container-ship
```

### Logs alert to telegram
Expand Down
8 changes: 4 additions & 4 deletions deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (d *Deployment) loadCargoDeployer() {
Containers: []Container{
{
Name: "cargo-deployer",
From: "oxmix/cargo-deployer:" + u.Env().CargoVersion,
From: u.Env().CargoFrom,
Restart: "always",
Volumes: []string{
"/var/run/docker.sock:/var/run/docker.sock:rw",
Expand Down Expand Up @@ -82,8 +82,8 @@ function install {
install docker docker.io
install apparmor_status apparmor
echo "• Pull oxmix/cargo-deployer"
docker pull oxmix/cargo-deployer:` + u.Env().CargoVersion + `
echo "• Pull ` + u.Env().CargoFrom + `"
docker pull ` + u.Env().CargoFrom + `
printf "• Kill cargo container: "
if [[ $(docker ps -qaf name=` + u.Env().Namespace + `.cargo-deployer) ]]; then
Expand All @@ -104,7 +104,7 @@ docker run -d --name ` + u.Env().Namespace + `.cargo-deployer $RT \
--label ` + u.Env().Namespace + `.deployment=` + u.Env().Namespace + `.` + CargoDeploymentName + ` \
--restart always --log-driver json-file --log-opt max-size=128k \
-v /var/run/docker.sock:/var/run/docker.sock:rw \
` + envs + ` oxmix/cargo-deployer:` + u.Env().CargoVersion + `
` + envs + ` ` + u.Env().CargoFrom + `
exit 0
`)
Expand Down
4 changes: 2 additions & 2 deletions utils/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Envs struct {
Environment string
Endpoint string
Namespace string
CargoVersion string
CargoFrom string
NotifyMatch string
NotifyTgToken string
NotifyTgChatId string
Expand All @@ -24,7 +24,7 @@ func Env() *Envs {
getEnv("ENV", "container"),
getEnv("ENDPOINT", "127.0.0.1:8443"),
getEnv("NAMESPACE", "ctr-ship"),
getEnv("CARGO_VERSION", "1"),
getEnv("CARGO_FROM", "oxmix/cargo-deployer:1"),
getEnv("NOTIFY_MATCH", ""),
getEnv("NOTIFY_TG_TOKEN", ""),
getEnv("NOTIFY_TG_CHAT_ID", ""),
Expand Down

0 comments on commit dae4894

Please sign in to comment.