Skip to content

Commit

Permalink
Added 403 error page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Khrupa committed Apr 4, 2018
1 parent 8f10ef0 commit 9f61dc6
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/deploy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.retry
23 changes: 23 additions & 0 deletions config/deploy/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Deploy application to local server
hosts: local
vars:
ansistrano_deploy_from: "{{ playbook_dir }}"
ansistrano_deploy_to: "/tmp/deploy"
ansistrano_keep_releases: 3
ansistrano_deploy_via: git
ansistrano_git_repo: [email protected]:vendor/project.git
ansistrano_git_branch: develop

ansistrano_shared_paths:
- storage
ansistrano_shared_files:
- .env

# Additional task
ansistrano_after_symlink_shared_tasks_file: "{{ playbook_dir }}/tasks/dev/after-symlink-shared.yml"
ansistrano_before_symlink_tasks_file: "{{ playbook_dir }}/tasks/dev/before-symlink.yml"
ansistrano_after_cleanup_tasks_file: "{{ playbook_dir }}/tasks/dev/after-cleanup.yml"

roles:
- { role: carlosbuenosvinos.ansistrano-deploy }
3 changes: 3 additions & 0 deletions config/deploy/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
local ansible_host=localhost
dev ansible_host=development-server-ssh-alias

4 changes: 4 additions & 0 deletions config/deploy/tasks/dev/after-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Enable application
shell: php artisan up
args:
chdir: /tmp/deploy/current
23 changes: 23 additions & 0 deletions config/deploy/tasks/dev/after-symlink-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Custom php and composer path
#- name: Composer install all dependencies
# shell: |
# export PATH=/opt/plesk/php/7.0/bin::$PATH;
# /opt/plesk/php/7.0/bin/php /usr/lib64/plesk-9.0/composer.phar install
# args:
# chdir: "{{ ansistrano_release_path.stdout }}"
- name: Composer install all dependencies
shell: composer install
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Check code style
shell: php artisan code-style
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Cleare testing sqlite database
shell: echo '' > ./database/database.sqlite
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Run tests
shell: ./vendor/bin/phpunit
args:
chdir: "{{ ansistrano_release_path.stdout }}"
25 changes: 25 additions & 0 deletions config/deploy/tasks/dev/before-symlink.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- name: Disable application
shell: php artisan down
args:
chdir: /tmp/deploy/current
# DO NOT run migration and db:seed in the Production servers!
- name: Migrate DataBase
shell: php artisan migrate --force
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Seed DataBase only 'production' seeders
shell: php artisan db:seed --env=production --force
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Create storage symlink
shell: php artisan storage:link -q
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Cleare view cache
shell: php artisan view:clear
args:
chdir: "{{ ansistrano_release_path.stdout }}"
- name: Cleare application cache
shell: php artisan cache:clear
args:
chdir: "{{ ansistrano_release_path.stdout }}"
79 changes: 79 additions & 0 deletions docs/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Deploy

## Development Server

Deploy command

```
$ ansible-playbook -i config/deploy/hosts config/deploy/deploy-dev.yml
```


## Setup

Install **Ansible** and **Ansistrano**

```
$ ansible --version
ansible 2.1.1.0
```

Install [Ansistrano playbooks](https://github.com/ansistrano/deploy#installation)

```
$ sudo ansible-galaxy install carlosbuenosvinos.ansistrano-deploy carlosbuenosvinos.ansistrano-rollback --ignore-errors
```



## Local ssh config and ForwardAgent

Add host-alias to ssh config.

```
$ cat ~/.ssh/config
# development server
Host development-server-ssh-alias
Hostname localhost
Port 22
User FIX_USER_NAME
ForwardAgent yes
# EOT development server
```

Then use only host-alias on the **inventor** **hosts** file



## First run

Steps for prepare deploy environment, just example paths.

1. Server must satisfy all requirements
2. Prepare folders and environment

```
$ mkdir -p /tmp/deploy/shared
$ cp -r ./storage /tmp/deploy/shared
$ cp ./.env.example /tmp/deploy/shared/.env
```
3. Create temporary current folder and `artisan` file
```
$ mkdir -p /tmp/deploy/current/public
$ touch /tmp/deploy/current/artisan
```
5. Add **APP_ENV** and **APP_KEY**
```
$ vim /tmp/deploy/shared/.env
```
Example
```
APP_ENV=production
APP_KEY=base64:eBzXep0nTYQg4TBGgibKB98C0P9GHdBoolmsOzLNksg=
```
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Based on [Laravel Framework](https://laravel.com) **5.5.**
* composer
* PHP >= 7.0.0
* MySql >= 5.7
* Sqlite3
* OpenSSL PHP Extension
* PDO PHP Extension
* Mbstring PHP Extension
Expand Down Expand Up @@ -46,3 +47,4 @@ The project uses a **PRS2** PHP style code.
## Other Documents
[Deploy](/docs/deploy.md)

0 comments on commit 9f61dc6

Please sign in to comment.