# CircleCi don\`t deploy

**URL:** <https://discuss.circleci.com/t/circleci-don-t-deploy/33821>\
**Category:** API\
**Tags:** circle-yml\
**Created:** [December 19, 2019, 1:18pm UTC](https://discuss.circleci.com/t/circleci-don-t-deploy/33821 "2019-12-19T13:18:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devsymfony](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@devsymfony](https://discuss.circleci.com/u/devsymfony)\
**Post date:** [December 19, 2019, 1:18pm UTC](https://discuss.circleci.com/t/circleci-don-t-deploy/33821/1 "2019-12-19T13:18:26Z")

</div>

Hi.  
I have a problem with my CircleCi during deploy my project. When a build finish with success. CircleCi don`t deploy my code on vps. But when I click Return job with ssh I see a message:

> Your config file has errors and may not run correctly: jobs: deploy: -prodextraneous key [workflows] is not permitted

It`s my code:

> version: 2  
> jobs:  
> build:  
> working\_directory: ~/micropost  
> docker:  
> - image: circleci/php:7.2.0-apache-stretch-node-browsers  
> environment:  
> APP\_ENV: test  
> DATABASE\_URL: mysql://root:root@127.0.0.1/micro-post  
> MAILER\_FROM: [micro@micropost.com](mailto:micro@micropost.com)  
> MAILER\_URL: null://localhost  
> - image: circleci/mysql:5.7  
> environment:  
> MYSQL\_ROOT\_PASSWORD: ‘root’  
> MYSQL\_DATABASE: micro-post  
> steps:  
> - checkout  
> - run:  
> name: Install PHP MySQL  
> command: sudo docker-php-ext-install pdo\_mysql  
> - run:  
> name: Wait for MySQL  
> command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s  
> - run:  
> name: Composer  
> command: sudo composer self-update  
> - run:  
> name: Composer install  
> command: composer install -n --prefer-dist  
> - run:  
> name: Run migrations  
> command: php bin/console doctrine:schema:update --force
> 
> deploy:  
> working\_directory: ~/micropost  
> docker:  
> - image: circleci/php:7.2.0-apache-stretch-node-browsers  
> steps:  
> - checkout  
> - run:  
> name: Composer install  
> command: composer install -n --prefer-dist
> 
> ```
> - run:
> name: Clear cache
> command: php bin/console cache:clear --env=prod --no-interaction
> 
> - run:
> name: Yarn install
> command: yarn install && yarn run encore production
> 
> - run:
> name: Add droplet
> command: ssh-keyscan -H $DROPLET_IP >> ~/.ssh/know_hosts
> 
> - run:
> name: Pre-deploy
> command: ssh -T $DROPLET_USER:$DROPLET_IP < bin/deploy/pre_deploy.sh
> 
> - run:
> name: Deploy code
> command: rsync -vzcrSLhp --exclude '.env' --delete ~/micropost/ $DROPLET_USER@$DROPLET_IP:/var/www/micropost_current
> 
> - run:
> name: Post deploy
> command: ssh -T $DROPLET_USER:$DROPLET_IP < bin/deploy/deploy.sh
> 
> workflows:
> version: 2
> build-and-deploy:
> jobs:
> - build
> - deploy:
> requires:
> -build
> filters:
> branches:
> only: master
> 
> ```

thank you in advance for your help.

---

<div class="post-metadata">

**Author:** ![ScottW](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/scottw/32/22363_2.png) [@ScottW](https://discuss.circleci.com/u/ScottW)\
**Post date:** [December 19, 2019, 2:41pm UTC](https://discuss.circleci.com/t/circleci-don-t-deploy/33821/2 "2019-12-19T14:41:07Z")

</div>

It looks like there is a typo in the workflow definition. There should be a space between the “-” and build. See the below example.

```
workflows:
  version: 2
  build-and-deploy:
      jobs:
        - build
        - deploy:
            requires:
              - build
            filters:
              branches:
                only: master

```

Additionally, you can use the CircleCI CLI to validate configurations with the below command.

`circleci config validate path/to/config`

More information is available on this doc: [https://circleci.com/docs/2.0/local-cli/#validate-a-circleci-config](https://circleci.com/docs/2.0/local-cli/#validate-a-circleci-config)

---

<div class="post-metadata">

**Author:** ![devsymfony](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@devsymfony](https://discuss.circleci.com/u/devsymfony)\
**Post date:** [December 19, 2019, 5:12pm UTC](https://discuss.circleci.com/t/circleci-don-t-deploy/33821/3 "2019-12-19T17:12:05Z")

</div>

Thenk you for help.I change my code and after refresh web CircleCi.I see build and deploy. But I have a message not\_running build and blocked deploy. What is going on ?  
My new code:

> ```
> version: 2
> jobs:
> build:
> working_directory: ~/micropost
> docker:
> - image: circleci/php:7.2.0-apache-stretch-node-browsers
> environment:
> APP_ENV: test
> DATABASE_URL: mysql://root:root@127.0.0.1/micro-post
> MAILER_FROM: micro@micropost.com
> MAILER_URL: null://localhost
> - image: circleci/mysql:5.7
> environment:
> MYSQL_ROOT_PASSWORD: 'root'
> MYSQL_DATABASE: micro-post
> steps:
> - checkout
> - run:
> name: Install PHP MySQL
> command: sudo docker-php-ext-install pdo_mysql
> - run:
> name: Wait for MySQL
> command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
> - run:
> name: Composer
> command: sudo composer self-update
> - run:
> name: Composer install
> command: composer install -n --prefer-dist
> - run:
> name: Run migrations
> command: php bin/console doctrine:schema:update --force
> deploy:
> working_directory: ~/micropost
> docker:
> - image: circleci/php:7.2.0-apache-stretch-node-browsers
> steps:
> - checkout
> - run:
> name: Composer install
> command: composer install -n --prefer-dist
> - run:
> name: Clear cache
> command: php bin/console cache:clear --env=prod --no-interaction
> - run:
> name: Yarn install
> command: yarn install && yarn run encore production
> - run:
> name: Add droplet
> command: ssh-keyscan -H $DROPLET_IP >> ~/.ssh/know_hosts
> - run:
> name: Pre-deploy
> command: ssh -T $DROPLET_USER:$DROPLET_IP < bin/deploy/pre_deploy.sh
> - run:
> name: Deploy code
> command: rsync -vzcrSLhp --exclude '.env' --delete ~/micropost/ $DROPLET_USER@$DROPLET_IP:/var/www/micropost_current
> - run:
> name: Post deploy
> command: ssh -T $DROPLET_USER:$DROPLET_IP < bin/deploy/deploy.sh
> workflows:
> version: 2
> build-and-deploy:
> jobs:
> - build
> - deploy:
> requires:
> - build
> filters:
> branches:
> only: master
> 
> ```
