diff --git a/.github/workflows/deploy-to-github-pages.yml b/.github/workflows/deploy-to-github-pages.yml
index 62bb232a..437f4f1c 100644
--- a/.github/workflows/deploy-to-github-pages.yml
+++ b/.github/workflows/deploy-to-github-pages.yml
@@ -4,6 +4,8 @@ name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
+ paths:
+ - docs/**
branches: [main]
# Allows you to run this workflow manually from the Actions tab
diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml
new file mode 100644
index 00000000..1dcdfae0
--- /dev/null
+++ b/.github/workflows/docker-build-push.yml
@@ -0,0 +1,23 @@
+# name: publish
+# on:
+# push:
+# paths:
+# - packages/enketo-express/**
+# branches: [main]
+# jobs:
+# publish-hello-docker-image:
+# runs-on: ubuntu-latest
+# steps:
+# - uses: actions/checkout@v2
+# - name: Login to GitHub Container Registry
+# uses: docker/login-action@v1
+# with:
+# registry: ghcr.io
+# username: ${{ github.actor }}
+# password: ${{ secrets.GITHUB_TOKEN }}
+# - name: Build the hello-docker Docker image
+# run: |
+# cd packages/enketo-express
+# docker build . --tag ghcr.io/ansh-sarkar/enketo-express:latest
+# docker run ghcr.io/ansh-sarkar/enketo-express:latest
+# docker push ghcr.io/ansh-sarkar/enketo-express:latest
diff --git a/.github/workflows/enketo-express-docker-build-push-ghcr.yml b/.github/workflows/enketo-express-docker-build-push-ghcr.yml
new file mode 100644
index 00000000..f5155280
--- /dev/null
+++ b/.github/workflows/enketo-express-docker-build-push-ghcr.yml
@@ -0,0 +1,29 @@
+name: Enketo Express Publish
+on:
+ push:
+ paths:
+ - packages/enketo-express/**
+ tags:
+ - '*'
+ branches: [main]
+jobs:
+ publish-enketo-express-docker-image:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: set lower case owner name
+ run: |
+ echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
+ env:
+ OWNER: '${{ github.repository_owner }}'
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build enketo-express Docker image
+ run: |
+ cd packages/enketo-express
+ docker build . --tag ghcr.io/$OWNER_LC/enketo-express:latest
+ docker push ghcr.io/$OWNER_LC/enketo-express:latest
diff --git a/.github/workflows/form-manager-docker-build-push-ghcr.yml b/.github/workflows/form-manager-docker-build-push-ghcr.yml
new file mode 100644
index 00000000..8e09bb21
--- /dev/null
+++ b/.github/workflows/form-manager-docker-build-push-ghcr.yml
@@ -0,0 +1,29 @@
+name: Form Manager Publish
+on:
+ push:
+ paths:
+ - packages/form-manager/**
+ tags:
+ - '*'
+ branches: [main]
+jobs:
+ publish-form-manager-docker-image:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: set lower case owner name
+ run: |
+ echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
+ env:
+ OWNER: '${{ github.repository_owner }}'
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build form-manager Docker image
+ run: |
+ cd packages/form-manager
+ docker build . --tag ghcr.io/$OWNER_LC/form-manager:latest
+ docker push ghcr.io/$OWNER_LC/form-manager:latest
diff --git a/README.md b/README.md
index 862bb173..f2d1e54c 100644
--- a/README.md
+++ b/README.md
@@ -1,114 +1,62 @@
-
-
Enketo - ODK Backend
-
+# Introduction to Workflow
-## About :open_book:
+Workflow is an Open Source project aimed towards the creation of data flow models using config files thereby allowing you to easily create and interact with stateful applications with minimum setup.
-Enketo has been used all around the world for a wide range of uses from needs assessments in humanitarian aid, to raising historical awareness, to clinical research, to election monitoring.
+We appreciate your interest in the project. Here are a few resources which you might find useful in order to get started or dive deeper into its architecture.
-## Features :dart:
+[Introduction to Workflow](https://samagra-development.github.io/workflow/) 👈 You are here
-- [x] Can connect to your custom backend
-- [ ] Have the edit api in case user wants to edit submitted response
-- [ ] Api for the customize change in XML of form
-- [x] Have beautiful themes and widgets
-- [x] Are printer-friendly
-- [x] Can use very powerful skip and validation logic
-- [x] Run on any device, mobile or desktop, as long as it has a fairly modern browser
+ðŸ‘‰ó € ó € ó € ó € ó € ó € ó € ó € [Getting Started](https://samagra-development.github.io/workflow/category/getting-started)
+👉 [Guides](https://samagra-development.github.io/workflow/category/guides)
+👉 [Advanced Guides](https://samagra-development.github.io/workflow/category/advanced-guides)
+👉 [Future Roadmaps](https://samagra-development.github.io/workflow/category/future-roadmaps)
+👉 [Community](https://samagra-development.github.io/workflow/category/community)
-## Use Case :rocket:
+> If you would like to contribute to this project, kindly refer to the **Contributions** Page under the **Community** category. Kindly make
-
+
-## Requirements :scroll:
+# Setup and Installation
-1. Your machine should have [Yarn](https://classic.yarnpkg.com/en/docs/install/#windows-stable) or [Npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), [Docker](https://docs.docker.com/get-docker/), [Python](https://www.python.org/downloads/) installed.
+## System Requirements
-*Note: Preferable Npm version (6.14.15) and Node version(v14.18.1) and Ubuntu OS version(18.04)**
+The primary requirements of the project include [**NodeJS**](https://nodejs.org/en/) and [**Docker**](https://www.docker.com/). Multiple ```node``` versions have been used and hence it is recommended that you have the latest version of ```NVM - Node Version Manager``` installed on your computer. A ```.nvmrc``` file will be added to every directory in order to make sure that the current ```node``` version is being used to build it.
-2. Check the node and npm version by running following commands.
+> **Recommended :** NPM version (6.14.15) and Node versio (v14.18.1) and Ubuntu OS version (18.04)
+> Your machine should have [Yarn](https://yarnpkg.com/) / [NPM](https://www.npmjs.com/) & [Python](https://www.python.org/) installed.
-```sh
-node -v
-npm -v
-```
-
-## Installation Steps :walking:
-
-### 1. Fork it :fork_and_knife:
-
-You can get your own fork/copy of [enketo](https://github.com/Samagra-Development/enketo) by using the Fork button.
-
-### 2. Clone it :busts_in_silhouette:
+> You can check your ```node``` and ```npm``` versions by running the following commands
-You need to clone (download) it to a local machine using
-
-```sh
-git clone https://github.com/Your_Username/enketo.git
```
-
-> This makes a local copy of the repository in your machine.
-
-Once you have cloned the `enketo` repository in GitHub, move to that folder first using the change directory command.
-
-```sh
-# This will change directory to a folder FOSSologyUI
-cd enketo
+node -v
+npm -v
```
-Move to this folder for all other commands.
-
-### 3. Set it up :arrow_up:
+## Installation
-Run the following commands to see that _your local copy_ has a reference to _your forked remote repository_ in GitHub :octocat:
+In order to make the process of getting started with the project as easy and seamless as possible, we have a single command setup for enabling fast and convenient setup.
-```sh
-git remote -v
-origin https://github.com/Your_Username/enketo.git (fetch)
-origin https://github.com/Your_Username/enketo.git (push)
-```
-
-### 4. Run it :checkered_flag:
-
-```sh
-cd enketo-express
-docker run --name enketo-redis-main -p 6379:6379 -d redis
-docker run --name enketo-redis-cache -p 6380:6379 -d redis
-npm install
-npm i -g grunt
-grunt develop
-```
+👉 Go ahead and fork the repository to get your own copy by clicking on the ```Fork``` button.
-```sh
-cd ../enketo-core
-npm install
-npm start
-```
+👉 Clone the repository and select the **workflow** directory as the current directory.
-```sh
-cd ../enketo-transformer
-npm install
-npm start
+```bash
+git clone https://github.com/Samagra-Development/workflow
+cd workflow
```
-```sh
-cd ../forms
-python3 -m http.server
+👉 Setup and all start packages and applications by running this single command
+```bash
+npm run start
```
-You can preview your form on http://localhost:8005/preview?xform=http://localhost:8080/getForm/SOE
-
-### 5. For integrating your backend
-
-Customize the [submission url](https://github.com/Samagra-Development/enketo/blob/main/enketo-express/public/js/src/module/connection.js#L150) with your hosted backend.
+This command should setup and initialize all the different packages on which the project depends on and also start the sample application for you to experiment with.
-## Future Enhancements :rocket:
+👉 The repository is structured as a **monorepo** managed using [**Turborepo**](https://turborepo.org/) in order to cache and speed up builds, create pipelines and enabling the concurrent execution of scripts, all of which result in an improved Developer Experience (DX). Active work continues on this and progress can be tracked [**here**](https://github.com/Samagra-Development/workflow)
-- [Encrypting query parameters on rendering the enketo form. ](https://github.com/Samagra-Development/enketo/issues/1)
-- Writing a API for changing an XML form directly from it.
-- add npm scripts for install
+> Make sure you have ```Docker``` installed on your system as some of the packages depend on underlying docker containers. The team is currently planning to shift all servers to containers. You can track the progress on this migration [here](https://github.com/Samagra-Development/workflow/issues/14)
-We are trying to an inversion of control here.
+
### For Get API
@@ -258,5 +206,5 @@ State for prefilling, sideEffect.
TODO: Add details on the specifications
## Possible Attack Vectors
-1. XSS (High Priority) - Simple form
+1. XSS (High Priority) - Simple form.
2. SQL Injection (High Priority) - needs to be fixed.
\ No newline at end of file
diff --git a/packages/enketo-express/setup/docker/create_config.py b/packages/enketo-express/setup/docker/create_config.py
index 25e76048..a96041bd 100644
--- a/packages/enketo-express/setup/docker/create_config.py
+++ b/packages/enketo-express/setup/docker/create_config.py
@@ -35,6 +35,8 @@ def get_or_create_encryption_key():
def create_config():
CONFIG_FILE_PATH = os.path.join(PROJECT_ROOT_PATH, 'config/config.json')
+ if not os.path.isfile(CONFIG_FILE_PATH):
+ CONFIG_FILE_PATH = os.path.join(PROJECT_ROOT_PATH, 'config/default-config.json')
if not os.path.isfile(CONFIG_FILE_PATH):
raise EnvironmentError('No Enketo Express configuration found at `{}`.'.format(CONFIG_FILE_PATH))
else:
diff --git a/packages/enketo-express/setup/docker/start.sh b/packages/enketo-express/setup/docker/start.sh
index 2dfd2e65..368a4a95 100755
--- a/packages/enketo-express/setup/docker/start.sh
+++ b/packages/enketo-express/setup/docker/start.sh
@@ -12,14 +12,14 @@ CHECKSUM_DIR_PATH="${ENKETO_SRC_DIR}/checksum"
CONFIG_FILE="config.json"
CONFIG_FILE_PATH="${ENKETO_SRC_DIR}/config/${CONFIG_FILE}"
-SHA1SUM_CONFIG_FILE_PATH="${CHECKSUM_DIR_PATH}/${CONFIG_FILE}.sha1"
+# SHA1SUM_CONFIG_FILE_PATH="${CHECKSUM_DIR_PATH}/${CONFIG_FILE}.sha1"
LAST_BUILD_COMMIT_FILE="last_build_commit.txt"
LAST_BUILD_COMMIT_FILE_PATH="${CHECKSUM_DIR_PATH}/${LAST_BUILD_COMMIT_FILE}"
RUN_GRUNT=0
# Compare config version
-sha1sum --status -c "${SHA1SUM_CONFIG_FILE_PATH}" || RUN_GRUNT=1
+# sha1sum --status -c "${SHA1SUM_CONFIG_FILE_PATH}" || RUN_GRUNT=1
# Compare commit version
CURRENT_COMMIT=$(git rev-parse HEAD) # Get current commit
@@ -46,7 +46,7 @@ if [ "$RUN_GRUNT" == 1 ]; then
echo "Saving current commit..."
echo $CURRENT_COMMIT > ${LAST_BUILD_COMMIT_FILE_PATH}
echo "Saving config hash..."
- sha1sum ${CONFIG_FILE_PATH} > "${SHA1SUM_CONFIG_FILE_PATH}"
+ # sha1sum ${CONFIG_FILE_PATH} > "${SHA1SUM_CONFIG_FILE_PATH}"
echo "Creating .not-empty files"
touch $NOT_EMPTY_JS_PATH
touch $NOT_EMPTY_CSS_PATH
diff --git a/packages/form-manager/Dockerfile b/packages/form-manager/Dockerfile
new file mode 100644
index 00000000..de0ee893
--- /dev/null
+++ b/packages/form-manager/Dockerfile
@@ -0,0 +1,22 @@
+# Base image
+FROM node:14
+
+# Create app directory
+WORKDIR /usr/src/app
+
+# A wildcard is used to ensure both package.json AND package-lock.json are copied
+COPY package*.json ./
+
+# Install app dependencies
+RUN npm install
+
+# Bundle app source
+COPY . .
+
+# Creates a "dist" folder with the production build
+RUN npm run build
+
+# Start the server using the production build
+CMD [ "node", "dist/main.js" ]
+
+EXPOSE 3002/tcp
\ No newline at end of file
diff --git a/packages/form-manager/README.md b/packages/form-manager/README.md
index 00a13b11..58095c0a 100644
--- a/packages/form-manager/README.md
+++ b/packages/form-manager/README.md
@@ -1,5 +1,5 @@
-
+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456