# Smartkit Web development

## How to update the Application version

To update the versions of webup, as400-proxy and h53-service:

in the `pre_apply.sh` file for each app (es. [webup's pre_apply.sh](/src/templates/wup-net/scripts/modules/webup/pre_apply.sh)), change the call to `update_artifact.sh` (usually the last line of the file).

Specify the version of the application you want to use for this release of smartkit-web.

## How to add new variables

this example adds a new var for webup. To do the same for as400-proxy or h53 simply modify their relative files instead.

- add the variable in the [custom.tfvars](src/templates/wup-net/env/custom.tfvars) file, **nb: choose a unique name and a default value that makes sense**
- add the variable in the [local.tfvars](src/templates/wup-net/env/local.tfvars) file, like the others
- add the variable in the [variables.tf](src/templates/wup-net/scripts/modules/webup/variables.tf) file
- add the variable in the [pre_apply.sh](src/templates/wup-net/scripts/modules/webup/pre_apply.sh) file
- implement the logic to handle the variable. i.e. add a new environment variable to the container in the [main.tf](src/templates/wup-net/scripts/modules/webup/main.tf) file

**NB: when updating an existing wupnet, the new variable must be manually added to the existing custom.tfvars file, otherwise the default is used**

## How to test smartkit-web SNAPSHOT versions

- [TEMPORARY until smartkit-CLI supports snapshot installs] : change version.info and pom.xml version to a new major (i.e. 2.3.4)
- manually build with `mvn clean package`
- copy the zip file in the `/home/smeup/smartkit/repository` folder, on the smartkit where you want to test the smartkit rest api
- run `smartkit install smartkit-web --local` on the smartkit 
- change the /home/smeup/smartkit/smartkit-web/scripts/smart.sh file, setting the following variables:
```
ARTIFACTS_LOCAL_MODE=true
CHECK_IF_NEWER_VERSION=false
```
- run `./smart.sh wupnet-update-config [wupnet-id]` to update the wupnet

## How to test webup, as400-proxy or H53 SNAPSHOT versions

To test a new version of the apps, you can simply swap the .war file in the relative deployments volume with a new snapshot version.
Then, restart the container with `docker restart <container-name>`


## Useful info

* installer.sh and smart.sh are used by smartkit-commons! Be careful to change them!
* template apply.sh, config.sh, destroy.sh, restore.sh and service.sh are used by a smart.sh that can be of a different version! Be careful to change them!
* docs releases.md and use.md are used in scripts. Do not change their position.

## How to release a stable version

* Check software versions (in pre_apply.sh scripts) 
* Update pom.xml version
* Update version.info
* Update releases notes (docs/releases.md file)
* Update releases notes (docs/release-notes.docx file)
* mvn clean deploy (it will deploy a zip artifact on https://repo.smeup.cloud)
* Release on github (it will create the tag and the release on github)
* Advance to the new snapshot version (X.X.X-SNAPSHOT)


