Skip to content

Commit

Permalink
Merge pull request #14 from nextcloud/feat/manual-installation
Browse files Browse the repository at this point in the history
Simpler "manual" installation
  • Loading branch information
bigcat88 authored Oct 16, 2024
2 parents ff2cc0e + e33568e commit bb01cd7
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .run/NC 30.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="APP_HOST" value="0.0.0.0" />
<env name="APP_ID" value="windmill_app" />
<env name="APP_PORT" value="23000" />
<env name="APP_PORT" value="24000" />
<env name="APP_SECRET" value="12345" />
<env name="APP_VERSION" value="1.0.0" />
<env name="NEXTCLOUD_URL" value="http://nextcloud.local/index.php" />
<env name="APP_HOST" value="0.0.0.0" />
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="SDK_NAME" value="Python 3.10 (windmill_app)" />
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ ENV NODE_OPTIONS "--max-old-space-size=8192"
ARG VITE_BASE_URL ""
RUN npm run build

FROM scratch AS export_frontend
COPY --from=frontend /frontend/build/ /

FROM rust_base AS planner

Expand Down
23 changes: 19 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,32 @@ help:
@echo " init clone Windmill repository to the 'windmill_src' folder and copy ExApp files inside it"
@echo " build-push build image and upload to ghcr.io"
@echo " "
@echo " run30 install Flow for Nextcloud 30"
@echo " run install Flow for Nextcloud Last"
@echo " run30 install Flow App for Nextcloud 30"
@echo " run install Flow App for Nextcloud Last"
@echo " "
@echo " static_frontend build Windmill static frontend for Manual Installation"
@echo " register30 register manually running Flow App into Nextcloud"

.PHONY: init
init:
rm -rf windmill_src
git -c advice.detachedHead=False clone -b v1.394.4 https://github.com/windmill-labs/windmill.git windmill_src
cp Dockerfile requirements.txt windmill_src/

cp -r ex_app windmill_src/
cp -r ex_app_scripts windmill_src/

.PHONY: static_frontend
static_frontend:
rm -rf static_frontend
pushd windmill_src && \
DOCKER_BUILDKIT=1 docker buildx build \
--build-arg VITE_BASE_URL=/index.php/apps/app_api/proxy/flow \
--platform linux/amd64 \
--target export_frontend \
--output type=local,dest=../static_frontend . && \
popd

.PHONY: build-push
build-push:
docker login ghcr.io
Expand All @@ -45,12 +60,12 @@ run:
register30:
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister flow --silent --force || true
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register flow manual_install --json-info \
"{\"id\":\"flow\",\"name\":\"Flow\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":23000}" \
"{\"id\":\"flow\",\"name\":\"Flow\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":24000, \"routes\": [{\"url\":\"^api\\\/w\\\/nextcloud\\\/jobs\\\/.*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":0, \"headers_to_exclude\":[], \"bruteforce_protection\":[401]}, {\"url\":\"^api\\\/w\\\/nextcloud\\\/jobs_u\\\/.*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":0, \"headers_to_exclude\":[], \"bruteforce_protection\":[401]}, {\"url\":\".*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":2, \"headers_to_exclude\":[]}]}" \
--wait-finish

.PHONY: register
register:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister flow --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register flow manual_install --json-info \
"{\"id\":\"flow\",\"name\":\"Flow\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":23000}" \
"{\"id\":\"flow\",\"name\":\"Flow\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":24000, \"routes\": [{\"url\":\"^api\\\/w\\\/nextcloud\\\/jobs\\\/.*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":0, \"headers_to_exclude\":[], \"bruteforce_protection\":[401]}, {\"url\":\"^api\\\/w\\\/nextcloud\\\/jobs_u\\\/.*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":0, \"headers_to_exclude\":[], \"bruteforce_protection\":[401]}, {\"url\":\".*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":2, \"headers_to_exclude\":[]}]}" \
--wait-finish
154 changes: 115 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,43 @@
# Flow: Seamless Automation for Nextcloud

Flow is a dynamic workflow automation application, carefully integrated into your Nextcloud environment. Built upon the powerful Windmill engine, Flow takes the robust capabilities of Windmill and adapts them for a smooth experience within Nextcloud, providing teams and individuals with the ability to automate, streamline, and enhance their workflows like never before.
Flow is a dynamic workflow automation application, carefully integrated into your Nextcloud environment. Built upon the powerful Windmill engine, Flow adapts the robust capabilities of Windmill for a smooth experience within Nextcloud, providing teams and individuals with the ability to automate, streamline, and enhance their workflows like never before.

> [!NOTE]
> **Requires [`AppAPI`](https://github.com/nextcloud/app_api) and `webhook_listeners` to be enabled to work.**
> **Note:**
> **Requires the `AppAPI` and `webhooks_listener` apps to be enabled to work properly.**
## Key Features of Flow

Flow brings a wealth of features designed to improve productivity and collaboration, with a particular focus on user-friendliness and scalability:

### 1. **Drag-and-Drop Workflow Builder**
- Create complex workflows with ease using a highly intuitive drag-and-drop interface. Whether you're automating document management, team notifications, or custom processes, Flow's visual workflow designer ensures anyone can build and modify workflows with minimal effort.

### 2. **Automate Repetitive Tasks**
- Save time and resources by automating common repetitive tasks. With Flow, you can schedule tasks to run on specific conditions or set up trigger-based actions to run automatically, reducing manual interventions and enhancing efficiency.
- Create complex workflows with ease using a highly intuitive drag-and-drop interface. Whether you're automating document management, team notifications, or custom processes, Flow's visual workflow designer ensures anyone can build and modify workflows with minimal effort.

### 3. **Seamless Integration with Nextcloud**
- As a fully integrated part of Nextcloud, Flow works effortlessly alongside other applications in your Nextcloud environment. Automate tasks related to file management, collaboration, communication, and more, all within the same familiar platform.
### 2. **Automate Repetitive Tasks**

### 4. **Built on the Windmill Engine**
- Flow leverages the robust backend of Windmill, an established workflow automation platform, which powers its capabilities for scalability, efficiency, and reliability. Windmill’s foundation ensures that Flow inherits an array of advanced features while being customized for seamless use within Nextcloud.
- Save time and resources by automating common repetitive tasks. With Flow, you can schedule tasks to run on specific conditions or set up trigger-based actions to run automatically, reducing manual interventions and enhancing efficiency.

### 5. **Real-Time Workflow Monitoring**
- Keep track of the progress of your workflows in real-time with detailed analytics and dashboards. Monitor performance, track errors, and ensure that every task is executed smoothly without delays.
### 3. **Seamless Integration with Nextcloud**

### 6. **Flexible Scheduling and Triggers**
- Flow allows you to set up flexible schedules for tasks, trigger workflows based on specific events, and monitor their execution in real time. With Flow’s built-in scheduler, you can execute workflows on demand, at predefined intervals, or when specific criteria are met.
- As a fully integrated part of Nextcloud, Flow works effortlessly alongside other applications in your Nextcloud environment. Automate tasks related to file management, collaboration, communication, and more—all within the same familiar platform.

## Benefits of Using Flow
### 4. **Built on the Windmill Engine**

Flow is more than just a workflow tool. It's a productivity powerhouse designed to work seamlessly in the Nextcloud environment, enhancing everything from document management to team collaboration.
- Flow leverages the robust backend of Windmill, an established workflow automation platform, powering its capabilities for scalability, efficiency, and reliability. Windmill’s foundation ensures that Flow inherits an array of advanced features while being customized for seamless use within Nextcloud.

### 1. **Centralized Workflow Automation**
- Flow helps you centralize all your workflow automation needs within Nextcloud, reducing the need for external tools and ensuring a smoother, more integrated experience for users.
### 5. **Real-Time Workflow Monitoring**

### 2. **Boosted Team Collaboration**
- By automating notifications, approvals, and task assignments, Flow ensures that your team stays in sync and focused on the tasks that matter most, reducing the time spent on administrative overhead.
- Keep track of the progress of your workflows in real-time with detailed analytics and dashboards. Monitor performance, track errors, and ensure that every task is executed smoothly without delays.

### 3. **Scalable for Any Team Size**
- Whether you’re working with a small team or an entire organization, Flow is built to scale. Thanks to Windmill’s proven engine, Flow can handle workflows of any complexity, ensuring that your automation can grow alongside your team.
### 6. **Flexible Scheduling and Triggers**

### 4. **Security and Privacy First**
- Built within the secure framework of Nextcloud, Flow ensures that all your workflows and automation are handled with the highest level of security and data protection. Your data stays within your Nextcloud environment, respecting your organization’s privacy policies.
- Flow allows you to set up flexible schedules for tasks, trigger workflows based on specific events, and monitor their execution in real-time. With Flow’s built-in scheduler, you can execute workflows on demand, at predefined intervals, or when specific criteria are met.

## Getting Started

Flow is designed to be easy to set up and use. Follow these steps to get started:

### Step 1: Install Flow in Nextcloud
To install Flow, navigate to the Nextcloud AppStore and search for **Flow**. Install the app and [`follow the instructions`](https://docs.nextcloud.com/server/latest/admin_manual/windmill_workflows/index.html) to complete the setup.

### Step 2: Configure Workflows
Once Flow is installed, you can start creating workflows by accessing the Flow tab within Nextcloud. Use the drag-and-drop builder to configure your desired workflows, add conditions, and set triggers.

### Step 3: Automate and Optimize
After creating your workflows, sit back and let Flow do the heavy lifting. You can monitor all automated tasks in real time and optimize them as needed.
To install Flow, navigate to the Nextcloud App Store and search for **Flow**. Install the app and [follow the instructions](https://docs.nextcloud.com/server/latest/admin_manual/windmill_workflows/index.html) to complete the setup.

## Advanced Features

Expand All @@ -66,18 +49,111 @@ For users familiar with Windmill, Flow offers additional advanced features that

## FAQ

### Specific environment options to control ExApp behavior
### Specific Environment Options to Control ExApp Behavior

> [!NOTE]
> **Note:**
>
> This is only supported starting from Nextcloud version `30.0.2` and `Flow 1.1.0` version
> This is only supported starting from Nextcloud version `30.0.2` and Flow version `1.1.0`
**Q: How can I control the number of Windmill workers?**
**Q: How can I control the number of Windmill workers?**
**A:** You can set the `NUM_WORKERS` environment variable. The default value is `number_of_cpu_cores * 2`.

**Q: I want to use an external PGSQL database instead of the bundled one in the container. Can I?**
**A:** You can configure it by setting the `DATABASE_URI` environment variable in the following format:
`postgres://DB_USER:DB_PASS@localhost:5432/DB_NAME`.
**Q: I want to use an external PostgreSQL database instead of the bundled one in the container. Can I?**
**A:** Yes, you can configure it by setting the `DATABASE_URI` environment variable in the following format:
`postgres://DB_USER:DB_PASS@localhost:5432/DB_NAME`

### Manual Deployment

> **Note:**
>
> This method can also be used for enterprise or custom scaled Windmill setups.
**Prerequisites:**

- Nextcloud instance with `AppAPI` and `webhooks_listener` apps enabled.
- Python 3.10 or higher installed on the server.
- Git installed on the server.

Follow these steps to manually deploy Flow without Docker:

1. **Register the Deploy Daemon in AppAPI**

First, register the Deploy Daemon in AppAPI with the `manual-install` type. Refer to the Nextcloud documentation for detailed instructions: [AppAPI Manual Install](todo)

2. **Clone the Repository and Install Dependencies**

Clone the Flow repository:

```bash
git clone https://github.com/cloud-py-api/flow.git
```

Navigate into the cloned directory, create a Python virtual environment, and install the required dependencies:

```bash
cd flow
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

3. **Install Windmill**

Install Windmill by following the official instructions: [Setup Windmill on Localhost](https://www.windmill.dev/docs/advanced/self_host#setup-windmill-on-localhost)

**Note:** Windmill should be in its default state, with the default user `[email protected]` and password `changeme`. If you have changed the administrator username/password, adjust the `DEFAULT_USER_EMAIL` and `DEFAULT_USER_PASSWORD` variables in the `ex_app/lib/main.py` file accordingly.

4. **Configure ExApp Environment Variables**

Set the required ExApp environment variables (`NEXTCLOUD_URL`, `APP_HOST`, `APP_PORT`, `APP_SECRET`) or modify them directly in the script at the top of `ex_app/lib/main.py`. Refer to the Nextcloud documentation for more details: [ExApp Configuration](todo)

5. **Set the `WINDMILL_URL` Environment Variable**

Define the `WINDMILL_URL` environment variable or set it in the script. This variable specifies the location of the Windmill instance you deployed in step 3.

6. **Adjust Windmill Version (Optional)**

**Note:** If you are using a non-standard version of Windmill from the ExApp, please adjust its version in the `Makefile` by editing the line under the `init` target:

```makefile
git -c advice.detachedHead=False clone -b v1.394.4 https://github.com/windmill-labs/windmill.git windmill_src
```

Replace `v1.394.4` with your desired Windmill version.

7. **Initialize Windmill Source and Build Frontend**

Run the following commands from the cloned `flow` repository to clone Windmill into the `windmill_src` folder and build the frontend:

```bash
make init
make static_frontend
```

These commands will:

- Clone the Windmill source code into `windmill_src`.
- Build the frontend assets and create the `static_frontend` folder, which will be served by ExApp as the Windmill frontend.

8. **Run the ExApp and Register with Nextcloud**

Start the ExApp main script:

```bash
python ex_app/lib/main.py
```

In a new terminal window (while keeping the ExApp running), execute the registration command to register the ExApp with Nextcloud:

```bash
make register
```

This registers the ExApp in Nextcloud for operation without Docker.

9. **Access Windmill in Nextcloud**

Windmill should now appear within your Nextcloud instance, accessible via the Flow app.

## Contributing

Expand Down
Loading

0 comments on commit bb01cd7

Please sign in to comment.