Skip to content

Commit

Permalink
Merge pull request #204 from ansibleguy76/release/v5.0.4
Browse files Browse the repository at this point in the history
v5.0.4 into main
  • Loading branch information
ansibleguy76 authored Aug 18, 2024
2 parents 337f1ca + 5efedef commit 3a1305f
Show file tree
Hide file tree
Showing 28 changed files with 330 additions and 84 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.0.4] - 2024-08-18

### Added

- If forms.yaml is missing, it will be auto created. This is useful for new installations without docker-compose
- Same for certificates

### Changed

- Async await replacements for promises (readability)

### Fixed

- Some credentials bugfixes

## [5.0.3] - 2024-06-21

### Added
Expand Down Expand Up @@ -709,7 +724,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow change password for current local user
- Start tracking versions

[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.3...HEAD
[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.4...HEAD

[5.0.4]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.3...5.0.4

[5.0.3]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.2...5.0.3

Expand Down
4 changes: 2 additions & 2 deletions app_versions.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ext.version_code = 50003
ext.version_name = "5.0.3"
ext.version_code = 50004
ext.version_name = "5.0.4"
6 changes: 3 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ansible_forms_vue",
"version": "5.0.3",
"version": "5.0.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -19,7 +19,7 @@
"@fortawesome/free-regular-svg-icons": "~6.5.2",
"@fortawesome/free-solid-svg-icons": "~6.5.2",
"@fortawesome/vue-fontawesome": "2.0.10",
"axios": "~1.7.2",
"axios": "~1.7.4",
"brace": "~0.11.1",
"bulma": "0.9.4",
"bulma-calendar": "6.1.19",
Expand All @@ -28,7 +28,7 @@
"bulma-quickview": "*",
"bulmaswatch": "0.8.1",
"copy-to-clipboard": "~3.3.3",
"core-js": "~3.37.1",
"core-js": "~3.38.0",
"es6-promise": "~4.2.8",
"highlight.js": "9.11.0",
"jsonwebtoken": "^9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@
var ref=this
axios({
method: 'get',
headers,
headers: headers.headers,
url,
responseType: 'arraybuffer',
})
Expand Down
11 changes: 10 additions & 1 deletion client/src/views/Credentials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,16 @@
}else{
console.log("No item selected")
this.credential = {
name:""
is_database:false,
name:"",
user:"",
password:"",
host:"NA",
port:3306,
db_name:"",
description:"",
secure:false,
db_type:""
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/Jobs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
var ref=this
axios({
method: 'get',
headers,
headers: headers.headers,
url,
responseType: 'arraybuffer',
})
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
var ref=this
axios({
method: 'get',
headers,
headers:headers.headers,
url,
responseType: 'arraybuffer',
})
Expand Down
16 changes: 8 additions & 8 deletions docs/_data/help.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3837,7 +3837,7 @@
'get',
'https://resturl/api/',
'',
{'a_custom_http_header','your_value'},
{'a_custom_http_header':'your_value'},
'.records[].name',
{name:{ignoreCase:true,direction:'desc'}},
false
Expand Down Expand Up @@ -4217,7 +4217,7 @@
description: ""
awxCredentials:
- vmware
execution_environment: my_execution_environment
executionEnvironment: my_execution_environment
roles:
- public
categories: []
Expand Down Expand Up @@ -4261,7 +4261,7 @@
columns:
- name
valueColumn: name
- name: __execution_environment__ # use this special name to override the execution_environment from the form
- name: __executionEnvironment__ # use this special name to override the executionEnvironment from the form
label: Inventory
type: enum
expression: "fn.fnRestJwtSecure('get','https://172.16.50.1/api/v2/execution_environments?organization=$(organization)','','awx_rest','[.results[]]')"
Expand Down Expand Up @@ -4307,11 +4307,11 @@
You can also choose if the repository must be cloned when AnsibleForms starts, and you can add cron-schedule to schedule recurring pull-actions.
Additionally, in the swagger interface, you will find a clone and pull rest api for webhooks.
In case you want long-lived access tokens for the webhooks, with swagger you can pass an expiryDays parameter (for admin roles only) and create long-lived tokens.
- name: Host Ansibleforms in a subfolder
short: Host Ansibleforms in a subfolder
description: |
In the case you want to host ansibleforms in subfolder, for example `https://af.domain.local/mysubfolder/`.
You can use the environment variable `BASE_URL`. Set it to `/mysubfolder/` (default is `/`).
# - name: Host Ansibleforms in a subfolder
# short: Host Ansibleforms in a subfolder
# description: |
# In the case you want to host ansibleforms in subfolder, for example `https://af.domain.local/mysubfolder/`.
# You can use the environment variable `BASE_URL`. Set it to `/mysubfolder/` (default is `/`).
- name: Enable ytt
short: Enable ytt
description: |
Expand Down
31 changes: 21 additions & 10 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ AnsibleForms can be installed in a few ways.
</div>


# Install using Docker-Compose
# Install using Docker-Compose

The recommended way to install AnsibleForms is using `Docker Compose`, which is the fastest way to start AnsibleForms with Docker. However, if you are skilled with docker, podman and/or Kubernetes, the [docker-compose (with Kubernetes sample)](https://github.com/ansibleguy76/ansibleforms-docker), together with the environment variables should get you started as well.

<div class="callout callout--danger">
<p><strong>Note</strong> You can also use Podman and Podman-Compose. The commands are similar (docker- > podman and docker-compose -> podman-compose)</p>
</div>

The recommended way to install AnsibleForms is using `Docker Compose`, which is the fastest way to start AnsibleForms with Docker. However, if you are skilled with docker and/or Kubernetes, the [docker-compose (with Kubernetes sample)](https://github.com/ansibleguy76/ansibleforms-docker), together with the environment variables should get you started as well.

<div class="callout callout--danger">
<p><strong>Note</strong> Using docker and docker-compose for the first time, requires some basic linux skills and some knowledge about containers</p>
Expand All @@ -45,7 +50,7 @@ The recommended way to install AnsibleForms is using `Docker Compose`, which is

## Prerequisites

* **Linux machine** : Any flavour should do, The need of CPU and memory is not very high, but, of course can grow if you start a lot of playbooks simultaniously
* **Linux machine** : Any flavour should do, The need of CPU and memory is not very high, but, of course can grow if you start a lot of playbooks simultaniously. When using Podman, I recommand Debian (ubuntu has some issues with Podman)
* **Github access** : The easiest way is to download or clone the docker-compose project on Github
* **Install Docker** : You need to have a container environment, and in this example we use Docker
* **Install Docker Compose** : To spin-up AnsibleForms and MySql with docker, using a few simple configuration-files, we need Docker Compose
Expand All @@ -68,10 +73,8 @@ cd /srv/apps
## Clone the docker-compose project

```bash
# centos
sudo yum install -y git

# ubuntu
# ubuntu or debian
sudo apt-get install -y git

‌sudo ‌git init
Expand All @@ -94,10 +97,7 @@ sudo chmod -R +x ./data/mysql/init/
[Docker installation manuals](https://docs.docker.com/engine/install)

```bash
# centos
yum install -y docker-ce docker-ce-cli containerd.io docker-compose

# ubuntu
# ubuntu / debian
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose

# the below is to ensure dns works properly inside the dockerimages
Expand All @@ -109,6 +109,13 @@ sudo systemctl start docker
sudo systemctl enable docker
```

## Install Podman and podman-compose

```bash
# ubuntu / debian
sudo apt-get install -y podman podman-compose
```

## Customize

Feel free to look at the variables in the `.env` file and `docker-compose.yaml` file.
Expand All @@ -118,6 +125,10 @@ Feel free to look at the variables in the `.env` file and `docker-compose.yaml`

```bash
sudo docker-compose up -d
# note, with some plavors and versions, it's `docker compose` (with a space)
# or
sudo podman-compose up -d
# note that podman is service-less. You can run it as any user. Your choice to use sudo or not.
```

## Test the application
Expand Down
3 changes: 2 additions & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ page_nav:
* **Swagger API** : Has a rest-api and Swagger documentation
* **Job History & Log** : See the history of your jobs*
* **Designer** : Although the forms are NOT built using a graphical designer, a YAML based editor/designer with validation is present
* **Git integration** : Sync your forms config files, ansible playbooks and other required files with a git repo

# Form Capabilities

* **Categories** : Group multiple forms under categories
* **Role based access** : Limit forms based on roles
* **Cascaded dropdowns** : Allow references between fields to create responsive, cascaded dropdown boxes
* **Database sources** : Import data into fields from databases (MySql, MSSql, Postgres, Mongo)
* **Database sources** : Import data into fields from databases (MySql, MSSql, Postgres, Mongo, Oracle)
* **Expression based sources** : Import data using serverside expressions (javascript), such as Rest API's, json-files, yaml-files, ... and filter, manipulate and sort them
* **Local expressions** : Use the power of javascript (local browser sandbox) to calculate, manipulate, generate, ...
* **Field dependencies** : Show/hide fields based on values of other fields
Expand Down
35 changes: 33 additions & 2 deletions server/config/https.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
const fs=require('fs')
const path=require('path')
const logger=require("../src/lib/logger");
var privatekey=undefined
var certificate=undefined

if(process.env.HTTPS=="1"){

var certificatePath = process.env.HTTPS_CERT || (__dirname + '/../persistent/certificates/cert.pem')
var privatekeyPath = process.env.HTTPS_KEY || (__dirname + '/../persistent/certificates/key.pem')
// logger.info("Using https certificate : " + certificatePath)
// logger.info("Using https private key : " + privatekeyPath)

// check if httpsConfig.httpsKey and httpsConfig.httpsCert exist
if(!fs.existsSync(certificatePath) || !fs.existsSync(privatekeyPath)){
logger.warning("httpsKey or httpsCert not found, copying from templates")
var certificateTemplatePath = path.join(__dirname,"/../templates/cert.pem.template")
var privatekeyTemplatePath = path.join(__dirname,"/../templates/key.pem.template")
var certificateDirPath = path.dirname(certificatePath)
// logger.info("Using https certificate template : " + certificateTemplatePath)
// logger.info("Using https private key template : " + privatekeyTemplatePath)
try{
// create the folder if it doesn't exist
logger.info("Creating folder " + certificateDirPath)
fs.mkdirSync(certificateDirPath, { recursive: true });
logger.info("Copying templates to " + certificatePath + " and " + privatekeyPath)
fs.copyFileSync(certificateTemplatePath, certificatePath);
fs.copyFileSync(privatekeyTemplatePath, privatekeyPath);
logger.info("Copied templates to " + certificatePath + " and " + privatekeyPath)
}catch(e){
logger.error("No certificate found and could not copy templates",e)
// exit // no point to continue
process.exit(1)
}
}


try{
privatekey = fs.readFileSync(process.env.HTTPS_KEY || (__dirname + '/../persistent/certificates/key.pem'))
certificate = fs.readFileSync(process.env.HTTPS_CERT || (__dirname + '/../persistent/certificates/cert.pem'))
privatekey = fs.readFileSync(privatekeyPath)
certificate = fs.readFileSync(certificatePath)
}catch(err){
logger.error("Failed to open https private key and certificate : ",err)
throw new Error("Failed to open https private key and certificate : " + err.message)
Expand Down
28 changes: 14 additions & 14 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ansible_forms",
"version": "5.0.3",
"version": "5.0.4",
"repository": {
"type": "git",
"url": "git://github.com/ansibleguy76/ansibleforms.git"
Expand All @@ -20,51 +20,51 @@
"@outlinewiki/passport-azure-ad-oauth2": "~0.1.0",
"ajv": "~6.12.6",
"ajv-error-parser": "~1.0.7",
"axios": "~1.7.2",
"axios": "~1.7.4",
"bcrypt": "~5.1.0",
"bluebird": "~3.7.2",
"cert-info": "~1.5.1",
"cheerio": "~1.0.0-rc.12",
"cheerio": "~1.0.0",
"connect-history-api-fallback": "~2.0.0",
"core-js": "~3.37.1",
"core-js": "~3.38.0",
"cors": "~2.8.5",
"cron-parser": "~4.9.0",
"dayjs": "1.11.11",
"dayjs": "1.11.12",
"express": "~4.19.2",
"cookie-session": "~2.1.0",
"fs-extra": "~11.2.0",
"ip": "2.0.1",
"json-bigint": "~1.0.0",
"ldap-authentication": "~3.2.1",
"ldap-authentication": "~3.2.2",
"ldapjs": "~3.0.7",
"lodash": "~4.17.21",
"modern-passport-http": "~0.3.0",
"moment": "~2.30.1",
"mongodb": "~6.7.0",
"oracledb": "~6.5.1",
"mongodb": "~6.8.0",
"oracledb": "~6.6.0",
"mssql": "~10.0.2",
"multer": "~1.4.5-lts.1",
"mysql2": "~3.10.0",
"mysql2": "~3.11.0",
"node-cache": "~5.1.2",
"node-jq": "~4.4.0",
"nodemailer": "~6.9.8",
"nodemailer": "~6.9.14",
"openid-client": "^5.6.5",
"passport": "~0.7.0",
"passport-jwt": "~4.0.1",
"pg": "~8.12.0",
"read-last-lines": "~1.8.0",
"swagger-ui-express": "~5.0.1",
"thenby": "~1.3.4",
"winston": "~3.13.0",
"winston": "~3.14.1",
"winston-daily-rotate-file": "~5.0.0",
"winston-syslog": "~2.7.0",
"yaml": "~2.4.5"
},
"devDependencies": {
"@babel/cli": "~7.24.7",
"@babel/core": "7.24.7",
"@babel/eslint-parser": "7.24.7",
"@babel/node": "~7.24.7",
"@babel/core": "7.25.2",
"@babel/eslint-parser": "7.25.1",
"@babel/node": "~7.25.0",
"dotenv": "~16.4.1",
"eslint": "~8.56.0",
"nodemon": "~3.1.3",
Expand Down
1 change: 1 addition & 0 deletions server/src/controllers/config.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports.findAll = async function(req,res){
var forms = await Form.load()
res.json(forms)
}catch(err){
// console.log(err)
res.json({error:helpers.getError(err)})
}
}
Expand Down
21 changes: 11 additions & 10 deletions server/src/controllers/group.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ exports.update = function(req, res) {
.catch((err)=>{res.json(new RestResult("error","failed to update group",null,err.toString()))})
}
};
exports.delete = function(req, res) {
Group.delete( req.params.id)
.then((deleted)=>{
if(deleted.affectedRows==1){
res.json(new RestResult("success","group deleted",null,""))
}else{
res.json(new RestResult("error","unknown group or group has users",null,`affected rows : ${deleted.affectedRows}`))
}
exports.delete = async function(req, res) {
try{
const deleted = await Group.delete( req.params.id)
if(deleted.affectedRows==1){
res.json(new RestResult("success","group deleted",null,""))
}else{
res.json(new RestResult("error","unknown group or group has users",null,`affected rows : ${deleted.affectedRows}`))
}
}catch(err){
res.json(new RestResult("error","failed to delete group",null,err.toString()))
}

})
.catch((err)=>{res.json(new RestResult("error","failed to delete group",null,err.toString()))})
};
Loading

0 comments on commit 3a1305f

Please sign in to comment.