Fix installation of Kubernetes metrics server by updating the URL
[osm/devops.git] / README.md
index 6eaf43f..a106c0b 100644 (file)
--- a/README.md
+++ b/README.md
-# Juju Charm usage and development
+<!--
+Copyright 2020 ETSI
 
-This document is intended to provide a brief overview of the components included
-in this repository as well as recommendations for how to develop, build, and
-publish charms.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-Please read the [develper geting started guide](https://jujucharms.com/docs/2.0/developer-getting-started) before proceeding.
+   http://www.apache.org/licenses/LICENSE-2.0
 
-## Directory structure
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+See the License for the specific language governing permissions and
+limitations under the License
+-->
+# osm-devops
 
-```
-.
-├── builds
-│   └── vpe-router
-├── interfaces
-├── layers
-│   └── vpe-router
-└── module-blueprints
-```
+Scripts and artifacts for OSM installation and CI/CD pipelines.
 
-The source code of a charm is referred to as a "layer". This layer is compiled
-into a charm and placed in the `builds/` directory. Interfaces, currently
-unused in this context, extend relationships between applications.
+## Folder structure
 
-## Development workflow
-### Prepare your build environment
-```
-# Source the environment variables JUJU_REPOSITORY, INTERFACE_PATH, and
-# LAYER_PATH, which are needed to build a charm. You could also place these
-# in your $HOME/.bashrc
-$ source juju-env.sh
-```
-#### Install the `charm` command, either via apt:
+- `jenkins`: scripts run by jenkins. All OSM modules rely on these scripts.
+- `installers`: scripts to be executed to install OSM. It also includes the OSM helm chart.
+
+## Instructions to test new code in the same way is done in OSM CI/CD pipeline
+
+### Create folder
 
+´´´bash
+mkdir osm
+cd osm
 ```
-$ sudo apt install charm
+
+### Clone projects
+
+Clone the projects that you would like to test
+
+```bash
+git clone "https://osm.etsi.org/gerrit/osm/devops"
+git clone "https://osm.etsi.org/gerrit/osm/common"
+git clone "https://osm.etsi.org/gerrit/osm/N2VC"
+git clone "https://osm.etsi.org/gerrit/osm/LCM"
+...
 ```
 
-or with [snap](http://snapcraft.io/)
+### Update repos to use a specific branch or a Gerrit patch
+
+If needed, update code in the repos. An example for N2VC is shown below
 
 ```
-$ snap install charm --edge
+cd N2VC
+git pull "https://osm.etsi.org/gerrit/osm/N2VC" refs/changes/22/14222/2
+cd ..
+cd LCM
+git pull "https://osm.etsi.org/gerrit/osm/LCM" refs/changes/24/14224/3
+cd ..
 ```
 
-To build a charm, simply run `charm build` inside of a layer.
-```
-$ cd $LAYER_PATH/vpe-router
-$ charm build
-$ charm deploy $JUJU_REPOSITORY/builds/vpe-router
+### Start an HTTP server to host the intermediate artifacts (deb packages)
+
+```bash
+./devops/tools/local-build.sh --run-httpserver
+ps -ef |grep python3
 ```
 
-## Publishing to jujucharms.com
+### Run stage2 to build artifacts
 
-Publishing to the Juju Charm store requires a launchpad login. With that, login
-to [jujucharms.com](http://www.jujucharms.com/).
+```bash
+# Clean previous artifacts
+rm $HOME/.osm/httpd/*.deb
+# Build new artifacts
+./devops/tools/local-build.sh --module common,N2VC,LCM stage-2
+# Check that artifacts were created
+ls $HOME/.osm/httpd
+```
 
-Next, you'll use the charm command to publish your compiled charm. This will
-put the charm into the store where it can be used by anyone with access.
+__Note: Artifacts need to be cleaned every time we want to try new patches__
 
-For example, if I wanted to publish the latest version of the vpe-router charm:
+### Run stage3 to build docker images
 
-# Step 1: Upload the charm to the "unpublished" channel
-```
-$ cd $JUJU_REPOSITORY/builds
-$ charm push vpe-router/ cs:~aisrael/vpe-router
-url: cs:~aisrael/vpe-router-0
-channel: unpublished
+```bash
+./devops/tools/local-build.sh --module LCM stage-3
+docker image ls
+# Copy the image to your image resistry, e.g.: "your-registry/osm/osm-testing/opensourcemano/lcm:myfeature"
 ```
 
-# There are four channels to release a charm: edge, beta, candidate, and stable
-```
-$ charm release cs:~aisrael/vpe-router-0 --channel=edge
-url: cs:~aisrael/vpe-router-0
-channel: edge
+### Update OSM Helm release to use the new image
+
+```bash
+helm3 -n osm list
+helm3 -n osm get values osm
 ```
-The charm can then be deployed directly from the charm store:
+
+Upgrade with kubectl:
+
+```bash
+kubectl -n osm patch deployment lcm --patch '{"spec": {"template": {"spec": {"containers": [{"name": "lcm", "image": "your-registry/osm/osm-testing/opensourcemano/lcm:myfeature}]}}}}'
+kubectl -n osm get all
 ```
-$ juju deploy cs:~aisrael/vpe-router --channel=edge
+
+Upgrade with Helm:
+
+```bash
+helm3 -n osm list
+helm3 -n osm history osm
+helm3 -n osm upgrade --reuse-values --set lcm.image.repository="your-registry/osm/osm-testing/opensourcemano/lcm" --set lcm.image.tag="myfeature" osm ./helm-chart-dir
+helm3 -n osm status osm
+kubectl -n osm get all
+
+### Test OSM Helm Chart independently
+
+```bash
+git clone "https://osm.etsi.org/gerrit/osm/devops"
+cd devops/
+# Get a patch from Gerrit
+# git pull "https://osm.etsi.org/gerrit/osm/devops" refs/changes/25/14325/17
+./installers/install_helm_client.sh -D . --debug
+./devops-stages/stage-test.sh
+./installers/full_install_osm.sh -D . --debug -R testing-daily -t testing-daily -r testing -y  2>&1 | tee osm_install_log.txt
+kubectl -n osm get all
+kubectl -n osm get ingress
 ```