Skip to content

Commit afe3986

Browse files
authored
Docs update for local dev (#5134)
1 parent 58b2183 commit afe3986

File tree

2 files changed

+68
-21
lines changed

2 files changed

+68
-21
lines changed

ansible/README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ If you want to deploy OpenWhisk locally using Ansible, you first need to install
2727
#### Ubuntu users
2828
```shell script
2929
sudo apt-get install python-pip
30-
sudo pip install ansible==2.5.2
31-
sudo pip install jinja2==2.9.6
30+
sudo pip install ansible==4.1.0
31+
sudo pip install jinja2==3.0.1
3232
```
3333

3434
#### Docker for Mac users
3535
```shell script
3636
sudo easy_install pip
37-
sudo pip install ansible==2.5.2
38-
pip install jinja2==2.9.6
37+
sudo pip install ansible==4.1.0
38+
pip install jinja2==3.0.1
3939
```
4040
Docker for Mac does not provide any official ways to meet some requirements for OpenWhisk.
4141
You need to depend on the workarounds until Docker provides official methods.
@@ -45,8 +45,8 @@ If you prefer [Docker-machine](https://docs.docker.com/machine/) to [Docker for
4545
##### Enable Docker remote API
4646
The remote Docker API is required for collecting logs using the Ansible playbook [logs.yml](logs.yml).
4747

48-
##### Activate docker0 network
49-
This is an optional step for local deployment.
48+
##### Activate docker0 network (local dev only)
49+
5050
The OpenWhisk deployment via Ansible uses the `docker0` network interface to deploy OpenWhisk and it does not exist on Docker for Mac environment.
5151

5252
An expedient workaround is to add alias for `docker0` network to loopback interface.
@@ -70,17 +70,29 @@ use `-i environments/docker-machine`.
7070

7171
In all instructions, replace `<openwhisk_home>` with the base directory of your OpenWhisk source tree. e.g. `openwhisk`
7272

73+
#### Ansible with pyenv (local dev only)
74+
75+
When using [pyenv](https://github.com/pyenv/pyenv) to manage your versions of python, the [ansible python interpreter](https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html) will use your system's default python, which may have a different version.
76+
77+
To make sure ansible uses the same version of python which you configured, execute:
78+
79+
```bash
80+
echo -e "\nansible_python_interpreter: `which python`\n" >> ./environments/local/group_vars/all
81+
```
82+
7383
#### Preserving configuration and log directories on reboot
7484
When using the local Ansible environment, configuration and log data is stored in `/tmp` by default. However, operating
7585
system such as Linux and Mac clean the `/tmp` directory on reboot, resulting in failures when OpenWhisk tries to start
7686
up again. To avoid this problem, export the `OPENWHISK_TMP_DIR` variable assigning it the path to a persistent
7787
directory before deploying OpenWhisk.
7888

7989
#### Setup
80-
81-
The following step must be executed once per development environment.
90+
91+
This step should be executed once per development environment.
8292
It will generate the `hosts` configuration file based on your environment settings.
8393

94+
> This file is generated automatically for an ephemeral CouchDB instance during `setup.yml`.
95+
8496
The default configuration does not run multiple instances of core components (e.g., controller, invoker, kafka).
8597
You may elect to enable high-availability (HA) mode by passing tne Ansible option `-e mode=HA` when executing this playbook.
8698
This will configure your deployment with multiple instances (e.g., two Kafka instances, and two invokers).
@@ -98,7 +110,6 @@ db_host=
98110
db_port=
99111
```
100112

101-
This file is generated automatically for an ephemeral CouchDB instance during `setup.yml`. If you want to use Cloudant, you have to modify the file.
102113
For convenience, you can use shell environment variables that are read by the playbook to generate the required `db_local.ini` file as shown below.
103114

104115
```shell script
@@ -112,7 +123,7 @@ export OW_DB_PORT=<your couchdb port>
112123
ansible-playbook -i environments/$ENVIRONMENT setup.yml
113124
```
114125

115-
Alternatively, if you want to use Cloudant as your datastore:
126+
##### Use Cloudant as a datastore
116127

117128
```shell script
118129
export OW_DB=Cloudant
@@ -126,7 +137,8 @@ ansible-playbook -i environments/$ENVIRONMENT setup.yml
126137
```
127138

128139
#### Install Prerequisites
129-
This step is not required for local environments since all prerequisites are already installed, and therefore may be skipped.`
140+
141+
> This step is not required for local environments since all prerequisites are already installed, and therefore may be skipped.
130142
131143
This step needs to be done only once per target environment. It will install necessary prerequisites on all target hosts in the environment.
132144

tools/macos/README.md

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ If you prefer to use Docker-machine, you can follow instructions in [docker-mach
2626

2727
The following are required to build and deploy OpenWhisk from a Mac host:
2828

29-
- [Docker 18.06.3](https://docs.docker.com/docker-for-mac/install/)
30-
- [Open JDK 10](https://adoptopenjdk.net/releases.html#x64_mac)
31-
- [Scala 2.11](http://scala-lang.org/download/)
32-
- [Ansible 2.5.2](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
29+
- [Docker 18.06.3+](https://docs.docker.com/docker-for-mac/install/)
30+
- [Open JDK 11](https://adoptopenjdk.net/releases.html#x64_mac)
31+
- [Scala 2.12](http://scala-lang.org/download/)
32+
- [Ansible 4.1.0](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
3333

3434
**Tips:**
3535
1. Versions of Docker and Ansible are lower than the latest released versions, the versions used in OpenWhisk are pinned to have stability during continuous integration and deployment.<br>
@@ -44,18 +44,18 @@ echo '
4444
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4545
# install cask
4646
brew tap homebrew/cask
47-
# install for AdoptOpenJDK (java10)
47+
# install for AdoptOpenJDK (java11)
4848
brew tap AdoptOpenJDK/openjdk
49-
# install java 10
50-
brew install --cask adoptopenjdk10
49+
# install java 11
50+
brew install --cask adoptopenjdk11
5151
# install scala
5252
brew install scala
5353
# install gnu tar
5454
brew install gnu-tar
5555
# install pip
5656
sudo easy_install pip
5757
# install script prerequisites
58-
sudo -H pip install docker==2.2.1 ansible==2.5.2 jinja2==2.9.6 couchdb==1.1 httplib2==0.9.2 requests==2.10.0' | bash
58+
pip install docker==5.0.0 ansible==4.1.0 jinja2==3.0.1 couchdb==1.2 httplib2==0.19.1 requests==2.25.1 six=1.16.0
5959
```
6060
6161
Make sure you correctly configure the environment variable $JAVA_HOME.
@@ -71,12 +71,47 @@ cd /your/path/to/openwhisk
7171
Follow instructions in [ansible/README.md](../../ansible/README.md)
7272
7373
### Configure the CLI
74-
Follow instructions in [Configure CLI](../../docs/cli.md)
74+
75+
#### Using brew
76+
77+
```bash
78+
brew install wsk
79+
wsk property set --apihost https://localhost
80+
wsk property set --auth `cat ansible/files/auth.guest`
81+
```
82+
#### Other methods
83+
For more instructions see [Configure CLI doc](../../docs/cli.md).
7584
7685
### Use the wsk CLI
7786
```bash
78-
bin/wsk action invoke /whisk.system/utils/echo -p message hello --result
87+
wsk action invoke /whisk.system/utils/echo -p message hello --result
7988
{
8089
"message": "hello"
8190
}
8291
```
92+
93+
# Develop
94+
95+
## Running unit tests
96+
97+
> Unit tests require [Ansible setup](../../ansible/README.md) at the moment.
98+
99+
Bellow are the ansible commands required to prepare your machine:
100+
101+
```bash
102+
cd ./ansible
103+
104+
ansible-playbook setup.yml -e mode=HA
105+
ansible-playbook couchdb.yml
106+
ansible-playbook initdb.yml
107+
ansible-playbook wipe.yml
108+
109+
ansible-playbook properties.yml
110+
```
111+
112+
To run the unit tests execute the command bellow from the project's root folder:
113+
```bash
114+
# go back to project's root folder
115+
cd ../
116+
./gradlew -PtestSetName="REQUIRE_ONLY_DB" :tests:testCoverageLean
117+
```

0 commit comments

Comments
 (0)