Commit e772d84a authored by Visay Keo's avatar Visay Keo
Browse files

[IMP] Add more useful params with nicer message

parent a83acfa3
Loading
Loading
Loading
Loading
+6 −0
Changes for CHANGELOG: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,12 @@ CHANGELOG
3.0-dev
---------

  -

3.0.0
-----

  - [IMP] Add more useful params with nicer message
  - [TASK] Update example in README
  - [IMP]  Add flow command resource:publish

+66 −0
Changes for README.md: 66 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ bin/syncontent -u=demo-014-007 -h=10.10.10.37 -p=/home/user/neosbox
- `-u` | `--remote-user` : Set the login user to the remote server (__Required__)
- `-h` | `--remote-host` : Set the hostname or IP address of the remote server (__Default__: `10.10.10.27`)
- `-p` | `--remote-path` : Set path to the document root on the remote server (__Default__: `/home/<remote-user>/public_html`)
- `-t` | `--ansible-tags`: Set the specific task you want run. See available sysc tasks section for details
- `-v`                   : Set the verbosity of ansible output. You can also set more verbose by adding more `v` like `-vvvvv`
- `--dry-run`            : Force to display the command to execute but won't run them. Useful for debugging when you want
						   to see the full ansible command and maybe execute them directly for better error hints

### Customization

@@ -94,6 +98,68 @@ directory. In case there are more than one file exists, the script will take fir
- In most case, the default host and path work fine for internal Web Essentials project development
and you just need to define the `--remote-user`

### Available Sync Tasks

Syncontent does its job in 3 different batches. First it sync the user files from remote server to local. Second it dumps
the database from remote and restore on local and last it runs some necessary flow commands for clean up.

By default, syncontent will run all 3 tasks but you can pass the parameter to call specific task only that you want to run.

```bash
bin/syncontent --ansible-tags=<TASK-NAME>
```

The available task names are:

- rsync
- db
- flow

### 1. rsync

The first task is to sync directory content in `Data/Persistent/` from remote to local. Files that exists only in local
will be removed to make sure everything is exactly the same as on remote.

To execute this task only, run the command:

```bash
bin/syncontent --ansible-tags=rsync
```

### 2. db

The second task is to reset the local database. It will start by connecting to remote server and get the database connection
information for the Production context of Flow. You cannot change to other context at the moment so if your remote is not
running in Production context, this tool won't work for you but anyway tweaking it to work is not that hard
and you can do it in the ansible role.

Once it gets all the information, it will dump the database, zip it and download to local temp. Before restoring to local
database, it first deletes the local database completely and recreate it again. This way assures that we have exact
state as on remote and prevent from any issues with the migration status.

To execute this task only, run this command:

```bash
bin/syncontent --ansible-tags=db
```

### 3. flow

The last step is to run some necessary commands needed in Flow for the application to work. They run in the following order:

- flow:cache:flush --force
- database:setcharset
- doctrine:migrate
- resource:publish
- node:repair
- cache:warmup

To execute this task only, run this command:

```bash
bin/syncontent --ansible-tags=flow
```

## Author

Visay Keo <visay@web-essentials.asia>
+4 −0
Changes for ansible/playbook.yml: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,4 +4,8 @@
  remote_user: "{{ ssh_user }}"
  roles:
    - role: rsync
      tags: rsync
    - role: database
      tags: db
    - role: flow
      tags: flow
+0 −16
Changes for ansible/roles/database/tasks/main.yml: 0 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -50,19 +50,3 @@
  - name: Restore local database from remote dump
    local_action: shell bin/dockerflow run db mysql -h db -u root -proot {{ local_db_name.stdout }} < /tmp/{{ db_name.stdout }}.sql
                  chdir="{{ local_path }}"

  - name: Execute ./flow database:setcharset
    local_action: shell FLOW_CONTEXT={{ local_flow_context }} bin/dockerflow run app ./flow database:setcharset
                  chdir="{{ local_path }}"

  - name: Execute ./flow flow:cache:flush --force
    local_action: shell FLOW_CONTEXT={{ local_flow_context }} bin/dockerflow run app ./flow flow:cache:flush --force
                  chdir="{{ local_path }}"

  - name: Execute ./flow cache:warmup
    local_action: shell FLOW_CONTEXT={{ local_flow_context }} bin/dockerflow run app ./flow cache:warmup
                  chdir="{{ local_path }}"

  - name: Execute ./flow resource:publish
    local_action: shell FLOW_CONTEXT={{ local_flow_context }} bin/dockerflow run app ./flow resource:publish
                  chdir="{{ local_path }}"
+14 −0
Changes for ansible/roles/flow/README.md: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
Flow
====

Execute necessary flow commands to setup the system.

License
-------

MIT

Author Information
------------------

Visay Keo <visay@web-essentials.asia>
Loading