{"action":"created","issue":{"url":"https://api.github.com/repos/jrasell/levant/issues/227","repository_url":"https://api.github.com/repos/jrasell/levant","labels_url":"https://api.github.com/repos/jrasell/levant/issues/227/labels{/name}","comments_url":"https://api.github.com/repos/jrasell/levant/issues/227/comments","events_url":"https://api.github.com/repos/jrasell/levant/issues/227/events","html_url":"https://github.com/jrasell/levant/issues/227","id":352678732,"node_id":"MDU6SXNzdWUzNTI2Nzg3MzI=","number":227,"title":"Deployment status success even if there are no healthy allocations in nomad","user":{"login":"yellowmegaman","id":3943191,"node_id":"MDQ6VXNlcjM5NDMxOTE=","avatar_url":"https://avatars3.githubusercontent.com/u/3943191?v=4","gravatar_id":"","url":"https://api.github.com/users/yellowmegaman","html_url":"https://github.com/yellowmegaman","followers_url":"https://api.github.com/users/yellowmegaman/followers","following_url":"https://api.github.com/users/yellowmegaman/following{/other_user}","gists_url":"https://api.github.com/users/yellowmegaman/gists{/gist_id}","starred_url":"https://api.github.com/users/yellowmegaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yellowmegaman/subscriptions","organizations_url":"https://api.github.com/users/yellowmegaman/orgs","repos_url":"https://api.github.com/users/yellowmegaman/repos","events_url":"https://api.github.com/users/yellowmegaman/events{/privacy}","received_events_url":"https://api.github.com/users/yellowmegaman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-21T19:31:37Z","updated_at":"2018-08-21T20:39:05Z","closed_at":null,"author_association":"NONE","body":"Hi there! I think i'm doing something terribly wrong here, but:\r\n\r\n**Relevant Nomad job specification file**\r\n\r\n```\r\njob \"example\" {\r\n  datacenters = [\"newdev\"]\r\n  type = \"service\"\r\n  group \"cache\" {\r\n    count = 1\r\n    task \"redis\" {\r\n      driver = \"docker\"\r\n      config {\r\n        image = \"redis:3.2\"\r\n        port_map {\r\n          db = 6379\r\n        }\r\n      }\r\n      resources {\r\n        cpu    = 500 # 500 MHz\r\n        memory = 256 # 256MB\r\n        network {\r\n          mbits = 10\r\n          port \"db\" {}\r\n        }\r\n      }\r\n      service {\r\n        name = \"redis-cache\"\r\n        tags = [\"global\", \"cache\"]\r\n        port = \"db\"\r\n        check {\r\n          name     = \"alive\"\r\n          type     = \"tcp\"\r\n          interval = \"10s\"\r\n          timeout  = \"2s\"\r\n        }\r\n        check {\r\n          type     = \"script\"\r\n          name     = \"nonexisting-script\"\r\n          command  = \"/usr/bin/nonexisting-script\"\r\n          interval = \"60s\"\r\n          timeout  = \"120s\"\r\n          check_restart {\r\n            limit = 3\r\n            grace = \"90s\"\r\n            ignore_warnings = false\r\n          }\r\n        } #check\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n**Output of `levant version`:**\r\n\r\n```\r\nLevant v0.2.2\r\nDate: 2018-08-06T09:05:20Z\r\nCommit: df0fe5759617805430bd847d9d445ff9a65b01c6\r\nBranch: 0.2.2\r\nState: 0.2.2\r\nSummary: df0fe5759617805430bd847d9d445ff9a65b01c6\r\n```\r\n\r\n**Output of `consul version`:**\r\n\r\n```\r\nConsul v1.2.2\r\nProtocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)\r\n```\r\n\r\n**Output of `nomad version`:**\r\n\r\n```\r\nNomad v0.8.4 (dbee1d7d051619e90a809c23cf7e55750900742a)\r\n```\r\n\r\n**Additional environment details:**\r\nDebian, consul, nomad, docker 18.06.0-ce\r\n\r\n\r\n**Debug log outputs from Levant:**\r\n\r\n```\r\nlevant deploy -log-level=debug -address=http://xxx.xxx.xxx.xxx:4646 example.nomad\r\n2018-08-21T22:19:26+03:00 |DEBU| template/render: no variable file passed, trying defaults\r\n2018-08-21T22:19:26+03:00 |DEBU| helper/files: no default var-file found\r\n2018-08-21T22:19:26+03:00 |DEBU| template/render: no command line variables passed\r\n2018-08-21T22:19:27+03:00 |INFO| levant/deploy: job is not running, using template file group counts job_id=example\r\n2018-08-21T22:19:27+03:00 |DEBU| levant/plan: triggering Nomad plan job_id=example\r\n2018-08-21T22:19:27+03:00 |INFO| levant/plan: job is a new addition to the cluster job_id=example\r\n2018-08-21T22:19:27+03:00 |INFO| levant/deploy: triggering a deployment job_id=example\r\n2018-08-21T22:19:28+03:00 |INFO| levant/deploy: evaluation 48794f86-d5cc-dbec-df60-59c639418a40 finished successfully job_id=example\r\n2018-08-21T22:19:28+03:00 |INFO| levant/deploy: job is not configured with update stanza, consider adding to use deployments job_id=example\r\n2018-08-21T22:19:28+03:00 |DEBU| levant/job_status_checker: running job status checker for job job_id=example\r\n2018-08-21T22:19:28+03:00 |INFO| levant/job_status_checker: job has status running job_id=example\r\n2018-08-21T22:19:28+03:00 |INFO| levant/job_status_checker: task redis in allocation 9ba1aee8-6fd4-5c23-c033-632760ce1956 now in pending state job_id=example\r\n2018-08-21T22:19:33+03:00 |INFO| levant/job_status_checker: task redis in allocation 9ba1aee8-6fd4-5c23-c033-632760ce1956 now in running state job_id=example\r\n2018-08-21T22:19:33+03:00 |INFO| levant/job_status_checker: all allocations in deployment of job are running job_id=example\r\n2018-08-21T22:19:33+03:00 |INFO| levant/deploy: job deployment successful job_id=example\r\n```\r\n\r\nNomad allocation info:\r\nhttps://gist.github.com/yellowmegaman/3ebea496c67ee5d512f8e7a6658afcab\r\n\r\nConsul healthcheck:\r\n![image](https://user-images.githubusercontent.com/3943191/44424302-5cc42700-a591-11e8-9f9a-813242d124a3.png)\r\n\r\nSo i've used nomad init to create default redis template, removed almost all features and blocks, changed datacenter name and added healthcheck with non-existent binary.\r\n\r\nAfter running deployment with levant i was expecting it to wait for all stuff to settle down, healthchecks including, since i saw `Advanced Job Status Checking: Particulary for system and batch jobs, Levant will ensure the job, evaluations and allocations all reach the desired state providing feedback at every stage.` in the docs.\r\n\r\nAnd one more thing, i was really surprised to know that it looks like nomad `deployments` are not in use when deploying with levant, is that correct?\r\n\r\nThanks in advance, hope i just misread something.\r\n"},"comment":{"url":"https://api.github.com/repos/jrasell/levant/issues/comments/414814158","html_url":"https://github.com/jrasell/levant/issues/227#issuecomment-414814158","issue_url":"https://api.github.com/repos/jrasell/levant/issues/227","id":414814158,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDgxNDE1OA==","user":{"login":"yellowmegaman","id":3943191,"node_id":"MDQ6VXNlcjM5NDMxOTE=","avatar_url":"https://avatars3.githubusercontent.com/u/3943191?v=4","gravatar_id":"","url":"https://api.github.com/users/yellowmegaman","html_url":"https://github.com/yellowmegaman","followers_url":"https://api.github.com/users/yellowmegaman/followers","following_url":"https://api.github.com/users/yellowmegaman/following{/other_user}","gists_url":"https://api.github.com/users/yellowmegaman/gists{/gist_id}","starred_url":"https://api.github.com/users/yellowmegaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yellowmegaman/subscriptions","organizations_url":"https://api.github.com/users/yellowmegaman/orgs","repos_url":"https://api.github.com/users/yellowmegaman/repos","events_url":"https://api.github.com/users/yellowmegaman/events{/privacy}","received_events_url":"https://api.github.com/users/yellowmegaman/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T20:39:05Z","updated_at":"2018-08-21T20:39:05Z","author_association":"NONE","body":"@jrasell thanks for quick reply!\r\nActually first time i've encountered this situation i had update stanza (i use **almost** all features of nomad).\r\n\r\n`Levant watches the allocs and when it reaches the running state will exit rather than keep watching them for an additional period.` - but does it mean that levant *only* watch for running state? because in example above healthchecks are initially red and continue to be so.\r\n\r\nMy attempt with update:\r\n```\r\n$ nomad stop -purge example\r\n==> Monitoring evaluation \"471f0856\"\r\n    Evaluation triggered by job \"example\"\r\n    Evaluation status changed: \"pending\" -> \"complete\"\r\n==> Evaluation \"471f0856\" finished with status \"complete\"\r\n```\r\nAdded update:\r\n```\r\njob \"example\" {\r\n  datacenters = [\"newdev\"]\r\n  type = \"service\"\r\n  group \"cache\" {\r\n    update {\r\n      max_parallel = 1\r\n      min_healthy_time = \"10s\"\r\n      healthy_deadline = \"3m\"\r\n      progress_deadline = \"10m\"\r\n      auto_revert = false\r\n      canary = 0\r\n    }\r\n    count = 1\r\n    task \"redis\" {\r\n      driver = \"docker\"\r\n      config {\r\n        image = \"redis:3.2\"\r\n        port_map {\r\n          db = 6379\r\n        }\r\n      }\r\n      resources {\r\n        cpu    = 500 # 500 MHz\r\n        memory = 256 # 256MB\r\n        network {\r\n          mbits = 10\r\n          port \"db\" {}\r\n        }\r\n      }\r\n      service {\r\n        name = \"redis-cache\"\r\n        tags = [\"global\", \"cache\"]\r\n        port = \"db\"\r\n        check {\r\n          name     = \"alive\"\r\n          type     = \"tcp\"\r\n          interval = \"10s\"\r\n          timeout  = \"2s\"\r\n        }\r\n        check {\r\n          type     = \"script\"\r\n          name     = \"nonexisting-script\"\r\n          command  = \"/usr/bin/nonexisting-script\"\r\n          interval = \"60s\"\r\n          timeout  = \"120s\"\r\n          check_restart {\r\n            limit = 3\r\n            grace = \"90s\"\r\n            ignore_warnings = false\r\n          }\r\n        } #check\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\nRunning levant:\r\n\r\n```\r\n$ levant deploy -log-level=debug -address=http://xxx.xxx.xxx.xxx:4646 github.nomad \r\n2018-08-21T23:34:00+03:00 |DEBU| template/render: no variable file passed, trying defaults\r\n2018-08-21T23:34:00+03:00 |DEBU| helper/files: no default var-file found\r\n2018-08-21T23:34:00+03:00 |DEBU| template/render: no command line variables passed\r\n2018-08-21T23:34:00+03:00 |INFO| levant/deploy: job is not running, using template file group counts job_id=example\r\n2018-08-21T23:34:00+03:00 |DEBU| levant/plan: triggering Nomad plan job_id=example\r\n2018-08-21T23:34:01+03:00 |INFO| levant/plan: job is a new addition to the cluster job_id=example\r\n2018-08-21T23:34:01+03:00 |INFO| levant/deploy: triggering a deployment job_id=example\r\n2018-08-21T23:34:02+03:00 |INFO| levant/deploy: evaluation 8f59210c-1719-bfc9-8851-786adbd01c5d finished successfully job_id=example\r\n2018-08-21T23:34:02+03:00 |INFO| levant/deploy: job is not configured with update stanza, consider adding to use deployments job_id=example\r\n2018-08-21T23:34:02+03:00 |DEBU| levant/job_status_checker: running job status checker for job job_id=example\r\n2018-08-21T23:34:02+03:00 |INFO| levant/job_status_checker: job has status running job_id=example\r\n2018-08-21T23:34:02+03:00 |INFO| levant/job_status_checker: task redis in allocation 18a28f20-0eb7-188c-e37a-cc7ee70ffcef now in running state job_id=example\r\n2018-08-21T23:34:02+03:00 |INFO| levant/job_status_checker: all allocations in deployment of job are running job_id=example\r\n2018-08-21T23:34:02+03:00 |INFO| levant/deploy: job deployment successful job_id=example\r\n```\r\n\r\n```\r\ncloud@newdev-2:~$ nomad deployment list\r\nID        Job ID   Job Version  Status   Description\r\n5501e535  example  0            running  Deployment is running\r\ncloud@newdev-2:~$ nomad deployment status 5501e535\r\nID          = 5501e535\r\nJob ID      = example\r\nJob Version = 0\r\nStatus      = running\r\nDescription = Deployment is running\r\n\r\nDeployed\r\nTask Group  Desired  Placed  Healthy  Unhealthy  Progress Deadline\r\ncache       1        1       0        0          2018-08-21T20:44:01Z\r\ncloud@newdev-2:~$\r\n```\r\n\r\nMy main goal was to replace my monstous 62-line bash script with something close to AI to prove deployment successful =)  \r\n\r\nThis script is basically a loop looking for desired=healthy allocations of service in nomad api.\r\n\r\nAbout `additional watch period` - i don't follow you here, isn't it right just to watch for desired/placed/healthy instead of period of time?\r\n\r\nThanks again)"}}
{"actor":{"display_login":"yellowmegaman"}}