Skip to content

Commit

Permalink
Merge pull request #27 from andock-ci/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
christianwiedemann committed Jul 27, 2018
2 parents c3c43d5 + abd77b3 commit f54a4c8
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 47 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@ A command line tool for andock.
* drush support including drush sql-sync without extra ssh container.
* Easy to integrate in your CI environment.

## For what can you use andock?
* Host your project including environments support for every branch.
* Host your project on acquia, platform.sh etc. Use andock for unlimited development environment.
* Use andock to host review environments for qa suites.
## How can I use andock
* As docksal addon
* As a docker image inside your CI
* As a standalone command line tool.

## Commands:
![alt text](docs/commands.png "Logo Title Text 1")


# Getting started?

* [See documentation](https://andock-ci-pipeline.readthedocs.io/en/latest/)
* [5 minutes setup](https://andock-ci-pipeline.readthedocs.io/en/latest/docksal.md)
* [5 minutes setup](https://andock-ci-pipeline.readthedocs.io/en/latest/getting-started/docksal.md)
33 changes: 28 additions & 5 deletions bin/acp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -753,27 +753,51 @@ run_alias ()
run_drush_generate ()
{
set -e
# Abort if andock is configured.
check_settings_path
# Load settings.
get_settings
local branch_name
# Read current branch.
branch_name=$(get_current_branch)

# Generate drush folder if not exists
mkdir -p drush
# The local drush file.
local drush_file="drush/${config_project_name}.aliases.drushrc.php"

# Check if a drush file already exists. If not generate a stub which export
# the alias name to LC_ANDOCK_CI_ENV.
# Based on LC_ANDOCK_CI_ENV andock server jumps into the correct cli container
if [ ! -f ${drush_file} ]; then
echo "<?php
\$_drush_context = drush_get_context();
if (isset(\$_drush_context['DRUSH_TARGET_SITE_ALIAS'])) {
putenv ('LC_ANDOCK_CI_ENV=' . substr(\$_drush_context['DRUSH_TARGET_SITE_ALIAS'], 1));
}" > ${drush_file}
fi
# source .docksal/docksal.env for DOCROOT.
source .docksal/docksal.env
# Generate one alias for each configured domain.
local domains
domains=$(echo $config_domain | tr " " "\n")
# Loop through each domain to generate one alias for each subsite.
for domain in $domains
do
local url="http://${branch_name}.${domain}"
echo-green "Domain: [$url]"
echo "
\$aliases['${branch_name}'] = array (
'root' => '/var/www/drupal',
'root' => '/var/www/${DOCROOT}',
'uri' => '${url}',
'remote-host' => '${url}',
'remote-host' => '${domain}',
'remote-user' => 'andock-ci',
'ssh-options' => '-o SendEnv=LC_ANDOCK_CI_ENV'
);
"
" >> $drush_file
done

echo-green "Drush alias for branch \"${branch_name}\" was generated successfully."
echo-green "See ${drush_file}"
}


Expand Down Expand Up @@ -872,7 +896,6 @@ cd "$root_path"
# Store the command.
command=$1
shift

# Finally. Run the command.
case "$command" in
_install-pipeline)
Expand Down
39 changes: 38 additions & 1 deletion docs/configuration/build.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# Build configuration
@TODO
The build steps are configured in
* `.andock-ci/hooks/build_tasks.yml`

### Sample build_tasks.yml
```yaml
- name: Composer
command: "composer install"
args:
chdir: "{{ checkout_path }}"
- name: npm install
command: "npm install"
args:
chdir: "{{ checkout_path }}/docroot/themes/custom/theme"
- name: Compile scss
command: "npm run compile"
args:
chdir: "{{ checkout_path }}/docroot/themes/custom/theme"

```
### .gitignore
To commit builded artifacts the folders must be removed from .gitignore.
To easily manage this you can use ansible file blocks.
```
#### BEGIN REMOVE ANDOCK-CI ###
Folders
#### END REMOVE ANDOCK-CI ###
```
#### Sample:
```
#### BEGIN REMOVE ANDOCK-CI ###
docroot/core
docroot/modules/contrib
docroot/themes/contrib
docroot/profiles/contrib
vendor
#### END REMOVE ANDOCK-CI ###
```
12 changes: 10 additions & 2 deletions docs/configuration/overview.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# Configuration overview
@TODO
# Configuration
The following configuration files are added to a project by running `fin acp generate:config`

| File name | Description |
|----------------------------|:------------|
| `andock-ci.yml` | Main configuration file.
| `hooks/build_tasks.yml` | Build hook fired while `fin acp build`. |
| `hooks/init_tasks.yml` | Build hook fired while `fin acp fin init` |
| `hooks/update_tasks.yml` | Build hook fired while `fin acp fin update`|
| `hooks/test_tasks.yml` | Build hook fired while `fin acp fin test`|
6 changes: 2 additions & 4 deletions docs/getting-started/build.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Build your project.
Why should you build your project first?
The build process is made for a scenario where your production site is hosted on acquia etc.
@TODO
The build process is configured through the

### Sample build_tasks.yml
```
```yaml
- name: Init andock-ci environment
command: "composer install"
args:
Expand Down
21 changes: 15 additions & 6 deletions docs/getting-started/the-software.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# What is andock.
andock is a set of ansible roles to manage the complete build and deploy life cycle. and a command line tool to manage these ansible roles.
# Concept overview.
andock is a set of ansible roles to manage the complete build and deploy life cycle and a command line tool to manage these ansible roles.

## Life cycle
* build
* unit tests
## Pipeline steps:
* build (unit tests, deploy to deployment branch)
* Environment creation/updates
* QA tests
* Environment removal

## Ansible roles
* server
* build
* fin
* fin

### Role: server
Manages docksal installations and updates.

### Role: build
Build project and deploy the artifact to a target repository. Right now only git repositories are supported but in future other deploy strategy should supported.
This runs typically on CI server. [See configuration](build.md)

### Role: fin
Checks out the deployed artifact and run fin up. [See configuration](fin.md)
24 changes: 1 addition & 23 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
# andock(ci) - docksal and ansible powered hosting.

## What is andock?
A docksal hosting solution.

## What is andock pipeline?
A command line tool for andock.

## For what can you use andock?
* Host your project including environments support for every branch.
* Host your project on acquia, platform.sh etc. Use andock for unlimited development environment.
* Use andock to host review environments for qa suites.
## Do I need a ci server?
No the easiest way is to use as a docksal addon. For further automation an CI is recommend. @TODO
## How can I use andock
* As docksal addon
* As a docker image inside your CI
* As a standalone command line tool.
## Key features
* Easy to use command line tool.
* Use ansible to remote control docksal.
* Easy configuration.
* One environment per branch.
* Extendable with init, update, tests ansible hooks.
* drush support including drush sql-sync without extra ssh container.
* Easy to integrate in your CI environment.
A docksal hosting solution.<br>


## Getting started:
Expand Down
9 changes: 4 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: andock-ci pipeline Documentation
site_name: andock(ci) pipeline documentation
theme: readthedocs
repo_url: https://github.com/andock-ci/pipeline
site_url: https://docs.andock-ci
Expand All @@ -7,14 +7,13 @@ markdown_extensions:
pages:
- Home: index.md
- Getting started:
- What is andock: getting-started/the-software.md
- Concept: getting-started/the-software.md
- System requirements: getting-started/system-requirements.md
- 5 minutes setup: getting-started/docksal.md
- Automate on your ci: getting-started/ci.md
- Configuration:
- Overview: configuration/overview.md
- Hook configurations:
- Drupal: configuration/example-drupal-hooks.md
- Build configuration: configuration/build.md
- Fin configuration: configuration/fin.md
- Server configuration: configuration/fin.md
- Hook configurations:
- Drupal: configuration/example-drupal-hooks.md

0 comments on commit f54a4c8

Please sign in to comment.