Skip to content

Commit

Permalink
Merge pull request #31 from aurelijusb/deploy-improvements
Browse files Browse the repository at this point in the history
Deploy improvements
  • Loading branch information
aurelijusb authored Oct 23, 2018
2 parents e751c50 + a937a61 commit db86c30
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 32 deletions.
17 changes: 17 additions & 0 deletions .deploy/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# This script prepares all dependent files to be deployed to server as a single .tar file
# This script intended to be executed in Jenkins CI, but likelly to be extended by you.

set -e # Stop on error
set -x # Show commands being executed

# Downloading dependencies and building frontend
composer install --no-dev --no-scripts --no-interaction --optimize-autoloader
yarn
yarn run encore production

# <-- This is a good place to add custom commands for your project

# Generating deployment artifact (one file with everything you need to be deployed on the server)
tar czf project.tar.gz * --exclude="node_modules" --exclude=".git" --owner 0 --group 0 --anchored
12 changes: 12 additions & 0 deletions .deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# This script deploys to *.projektai.nfqakademija.lt
# This script is intended to be used in Jenkins CI, where Ansible is installed

set -e # Stop on error
set -x # Show commands being executed

# .deploy/ansible_hosts will be generated in Jenkins CI

# Use Ansible to SSH to server, copy files and finish deployment there
ansible-playbook -i .deploy/ansible_hosts .deploy/deploy_playbook.yaml
10 changes: 7 additions & 3 deletions .deploy/playbook.yaml → .deploy/deploy_playbook.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---

# This is Ansible playbook (configuration), used by .deploy/deploy.sh
# It is used to automate common deployment tasks.
# (E.g. copy to server, change deployed version, merge configs, warmup framework)

- hosts: all
vars:
deployment:
deploy_path: "/home/{{ ansible_user_id }}"
archive_path: ../project.tar.gz
linked_files:
linked_files: # <-- Common place to add your files, that should be reused between deployments
- .env
linked_directories:
linked_directories: # <-- Common place to add your files, that should be reused between deployments
- var/log

tasks:
Expand Down Expand Up @@ -55,7 +59,7 @@
state: link
with_items: "{{ deployment.linked_directories + deployment.linked_files }}"

- name: Warm up application cache
- name: "Warm up application cache" # <-- Symfony specific task, to be ready for new version
shell: bin/console cache:warmup --env=prod --no-debug
args:
chdir: "{{ deploy_helper.new_release_path }}"
Expand Down
2 changes: 0 additions & 2 deletions .deploy/hosts

This file was deleted.

27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@ scripts/logs.sh
scripts/clean-and-start-fresh.sh
```

### Dažniausiai užduodami klausimai

* **Kaip įkelti savo pakeitimus į LIVE?**
Jei viskas gerai sukonfiguruota, užteks sudėti pakeitimus į `master`.
Jei neveiks, plačiau žr. [įkėlimo į serverį dokumentacijoje](https://github.com/nfqakademija/docker/blob/master/docs/deploy-project.md)

* **Kaip prisijungti prie duomenų bazės su savo mėgstamu MySql redagtoriumi?**
Trumpai: `scripts/mysql.sh` atspausdina visus prisijungimus.
Plačiau žr. [MySql GUI dokumentacijoje](https://github.com/nfqakademija/docker/blob/master/docs/use-mysql-with-gui.md)

* **Kaip pasileisti xDebug?**
Trumpai: `./scripts/backend.sh /enable_xdebug.sh <TAVO_KOMPO_IP_ADRESAS>`
Plačiau žr. [xDebug dokumentacijoje](https://github.com/nfqakademija/docker/blob/master/docs/setup-xdebug.md)

* **Turių daugiau techninių klausimų?**
Google ir StackOverflow yra geriausi tavo draugai.
Nepavykus – kreipkis į savo mentorių. Jei jis nepadės,
nukreips į atitinkamą lektorių arba pamokys `git blame`,
kad žinotumei, kur kreiptis toliau.

### Feedbackas

Jeigu taip nutiktų, kad repositorijoje, projekto template ar instrukcijoje rastumėte klaidą, tai nesišnibždėkite vieni tarp kitų, o sukurkite "issue".
Expand Down

0 comments on commit db86c30

Please sign in to comment.