diff --git a/CloudronManifest.json b/CloudronManifest.json index 14189fa..e1b0b76 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -1,13 +1,13 @@ { "manifestVersion": 2, "minBoxVersion": "7.3.3", - "id": "com.erpnext.cloudronapp", - "website": "https://www.erpnext.com", - "contactEmail": "support@erpnext.com", - "title": "erpnext", - "author": "erpnext authors", - "tagline": "The most agile ERP on the planet", - "version": "0.1.1", + "id": "com.frappeframework.cloudronapp", + "website": "https://www.frappeframework.com", + "contactEmail": "support@frappeframework.com", + "title": "Frappe Framework", + "author": "Frappe Framework Authors", + "tagline": "Low code, open source, web framework in Python and Javascript for the 21st century ", + "version": "15.25.0", "icon": "manifest/logo.png", "description": "file://manifest/DESCRIPTION.md", "changelog": "file://manifest/CHANGELOG.md", @@ -22,6 +22,7 @@ "sendmail": { "supportsDisplayName": true }, + "recvmail": {}, "ldap": {}, "redis": { "noPassword": true diff --git a/Dockerfile b/Dockerfile index 2bdf0d7..620993f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,22 @@ -FROM cloudron/base:4.0.0@sha256:31b195ed0662bdb06a6e8a5ddbedb6f191ce92e8bee04c03fb02dd4e9d0286df +FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4 # Remove unnecessary database and php packages (takes some time) # install mariadb (10.6 default), python (3.10 default) and required python3 packages RUN apt-get remove -y --purge mongodb-* postgresql-* *mysql* *mariadb* \ && sudo rm -rf /etc/mysql /var/lib/mysql \ && apt-get -y autoremove \ - && apt-get -y autoclean \ - && apt-get -y update \ - && apt-get install -y --reinstall --fix-missing \ + && apt-get -y autoclean + +RUN apt-get -y update && \ + apt-get install -y --reinstall --fix-missing \ wkhtmltopdf xvfb libfontconfig fonts-cantarell xfonts-75dpi xfonts-base \ python3-setuptools python3 python3-dev python3-pip python3-venv python3-distutils uwsgi-plugin-python3 \ libssl-dev\ - mariadb-server mariadb-backup\ - && pip3 install frappe-bench + mariadb-server mariadb-backup + +RUN pip3 install frappe-bench -ENV FRAPPE_VERSION=v14.21.1 ERPNEXT_VERSION=v14.12.0 +ENV FRAPPE_VERSION=v15.25.0 RUN mkdir -p /app/code/frappe-bench /app/pkg && \ chown -R 1000:1000 /app/code @@ -43,6 +45,9 @@ RUN mkdir -p /app/pkg/frappe-bench-orig \ && mv /app/code/frappe-bench/apps /app/pkg/frappe-bench-orig/apps \ && ln -sf /app/data/frappe/apps /app/code/frappe-bench/apps \ \ + && mkdir -p /app/pkg/frappe-bench-orig/archived \ + && ln -sf /app/data/frappe/archived /app/code/frappe-bench/archived \ + \ && mv /app/code/frappe-bench/logs /app/pkg/frappe-bench-orig/logs \ && ln -sf /run/frappe/logs /app/code/frappe-bench/logs \ \ @@ -81,7 +86,11 @@ RUN mkdir -p /run/supervisor/logs \ && ln -sf /run/nginx/error.log /var/log/nginx/error.log \ && ln -s /app/data/frappe/config/nginx.conf /etc/nginx/sites-enabled/frappe -RUN ln -sf /run/.yarnrc /home/cloudron/.yarnrc +RUN ln -sf /run/.yarnrc /home/cloudron/.yarnrc && \ + ln -sf /run/.yarn /home/cloudron/.yarn && \ + ln -sf /run/.npm /home/cloudron/.npm && \ + ln -sf /run/.local /home/cloudron/.local && \ + ln -sf /run/.cache /home/cloudron/.cache COPY nginx.conf setup-ldap.sh start.sh /app/pkg/ diff --git a/README.md b/README.md deleted file mode 100644 index ab18d99..0000000 --- a/README.md +++ /dev/null @@ -1,144 +0,0 @@ -## What - -Run [erpnext](https://www.erpnext.com/) on [Cloudron](https://cloudron.io) - -## Why - -Because, why not? - -## Build and Install - -- Install Cloudron CLI on your machine: `npm install -g cloudron-cli`. -- Install Docker, and make sure you can push to docker hub, or install the docker registry app in your own Cloudron. -- Log in to your Cloudron using cloudron cli: `cloudron login `. -- Build and publish the docker image: `cloudron build`. -- If you're using your own docker registry, name the image properly, - like `docker.example-cloudron.tld/john_doe/cloudron-erpnext`. -- Log in to Docker Hub and mark the image as public, if necessary. -- Install the app `cloudron install -l ` -- Look at the logs to see if everything is going as planned. - -Refer to the [Cloudron Docs](https://docs.cloudron.io/packaging/cli) for more information. - -## About dev-scripts - -Please refer to `docker-run.sh` file for some commands handy for you to test this setup. - -## Logging in - -Look for credentials in the file `-credentials.txt` from the file manager.sd - -## LDAP Connection [WIP] - -LDAP Auth is not already configured. When a user logs in for the first time, a new **System User** is created with ** -Guest** role. An admin can then change the user's role. - -LDAP Group sync or custom group mapping could also be possible, but I haven't tried it yet. Send a PR if you want. - -For now, look at the `/app/pkg/setup-ldap.sh` and make necessary changes. Run the command to add LDAP settings. The -script is configured to use your cloudron's LDAP addon. - -- `/app/pkg/setup-ldap.sh add` : adds LDAP settings to the site -- `/app/pkg/setup-ldap.sh disable`: disables LDAP settings (required before deleting) -- `/app/pkg/setup-ldap.sh delete`: deletes the LDAP settings for the site - -## Installing Apps - -You can install new frappe apps. To install the apps, simply follow these steps. - -```shell -# Make sure you are in the /app/code/frappe-bench directory. -cd /app/code/frappe-bench -gosu cloudron bench get-app -gosu cloudron bench install-app -gosu cloudron bench restart - -# EXAMPLE 1: install the hrms app -gosu cloudron bench get-app hrms -gosu cloudron bench install-app hrms -gosu cloudron bench restart - -# EXAMPLE 2: install a specific version of the hrms -gosu cloudron bench get-app --branch v1.0.0 hrms -gosu cloudron bench install-app hrms -gosu cloudron bench restart - -# EXAMPLE 3: install a specific version of the frappedesk -gosu cloudron bench get-app --branch develop frappedesk -gosu cloudron bench install-app frappedesk -gosu cloudron bench restart - -``` - -Also refer to the [Official Documentation](https://frappeframework.com/docs/v14/user/en/bench/bench-commands#add-apps) - -## Updating Apps - -### Important Notes - -- MAKE SURE TO TAKE A BACKUP USING CLOUDRON BEFORE TRYING TO UPDATE. -- IF THE UPDATE FAILS, THE APP MAY STOP RESPONDING, AND YOU MAY LOSE DATA. - -```shell - # Put the app in maintenance mode - gosu cloudron bench set-maintenance-mode on - - # Run the update commands - - # Turn off maintenance mode - gosu cloudron bench set-maintenance-mode off -``` - -### 1. Update with Cloudron CLI - -You can update this package normally by pulling the latest version of this repository, then running `cloudron build` -and `cloudron update --app your-app-domain`. This is the safest way to update the app. - -**After updating, make sure to run `gosu cloudron bench migrate` from the terminal while the app is running.** - -### 2. Automatic updates with bench - -You don't need to update this cloudron package. You can update Frappe, ErpNext and other apps from the cloudron -dashboard itself. - -```shell - # switch frappe and erpnext app branch to version-14 or any other branch. - gosu cloudron bench switch-to-branch version-14 frappe erpnext - - #if you have more apps, switch to the respective versions for those apps as well - # gosu cloudron bench switch-to-branch v1.0.0 hrms - # gosu cloudron bench switch-to-branch develop frappedesk - # etc... - - # update frappe and all apps, then run migration. Note: backups are handled by cloudron (if you have set it up) - gosu cloudron bench update --reset --no-backup -``` - -You can also run each steps one at a time as needed. - -```shell - # update apps - gosu cloudron bench update --pull - - # run patches only - gosu cloudron bench update --patch - - # build assets only - gosu cloudron bench update --build - - # update bench (the cli) - gosu cloudron bench update --bench - - # update python packages and node_modules - gosu cloudron bench update --requirements -``` - -## Disable public website (eg. Dashboard as homepage) - -From the sidebar, **Website** -> **Website Settings** -> **Landing Page (Home Page)** -> Set to **app** instead of ** -home**. - -## Third-party Intellectual Properties - -All third-party product names, company names, and their logos belong to their respective owners, and may be their -trademarks or registered trademarks. \ No newline at end of file diff --git a/dev-scripts/README.md b/dev-scripts/README.md deleted file mode 100644 index 51f7c68..0000000 --- a/dev-scripts/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Scripts inside this folder are only used as reference during development, and have no use or effect in the docker image -or containers. \ No newline at end of file diff --git a/dev-scripts/build-push-install.sh b/dev-scripts/build-push-install.sh deleted file mode 100755 index 2eb3cd8..0000000 --- a/dev-scripts/build-push-install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -VERSION=1.0.0 -DOMAIN='' -AUTHOR='' - -docker build -t $AUTHOR/cloudron-erpnext:$VERSION ./ && docker push $AUTHOR/cloudron-erpnext:$VERSION - -cloudron install --image $AUTHOR/cloudron-erpnext:$VERSION -l $DOMAIN - -cloudron logs -f --app $DOMAIN diff --git a/dev-scripts/docker-run-mysql.sh b/dev-scripts/docker-run-mysql.sh deleted file mode 100755 index 5925667..0000000 --- a/dev-scripts/docker-run-mysql.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Run `postgres` container named `postgres` in docker network `localnet` -# Create a network, if not exists: `docker network create localnet` -docker run --name mariadb -d -p 3306:3306 --network localnet \ - -e MYSQL_ROOT_PASSWORD=root \ - mariadb:10.3 - -# Login to pg cli -PGPASSWORD=erpnextpassword psql -h 127.0.0.1 -p 5432 -U erpnextuser -d erpnext - -# Recreate database quickly. -drop database erpnext; -create database erpnext with encoding 'utf-8' owner postgres; diff --git a/dev-scripts/docker-run-openldap.sh b/dev-scripts/docker-run-openldap.sh deleted file mode 100755 index fde6632..0000000 --- a/dev-scripts/docker-run-openldap.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -e - -# Run OpenLDAP & phpLDAPadmin on the network named localnet -# Create a network, if not exists: `docker network create localnet` - -docker run --name ldap-service --hostname ldap-service --network localnet --detach osixia/openldap:1.1.8 -docker run -p 8091:443 --name phpldapadmin-service --hostname phpldapadmin-service --network localnet --env PHPLDAPADMIN_LDAP_HOSTS=ldap-service --detach osixia/phpldapadmin:0.9.0 - -echo "Go to: https://localhost:8091" -echo "Login DN: cn=admin,dc=example,dc=org" -echo "Password: admin" \ No newline at end of file diff --git a/dev-scripts/docker-run-postgres.sh b/dev-scripts/docker-run-postgres.sh deleted file mode 100755 index 618667d..0000000 --- a/dev-scripts/docker-run-postgres.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Run `postgres` container named `postgres` in docker network `localnet` -# Create a network, if not exists: `docker network create localnet` - -docker run --name postgres -d -p 5432:5432 --network localnet \ - -e POSTGRES_USER=erpnextuser \ - -e POSTGRES_PASSWORD=erpnextpassword \ - -e POSTGRES_DB=erpnext \ - postgres:latest - - -# Login to pg cli -PGPASSWORD=erpnextpassword psql -h postgres -p 5432 -U erpnextuser -d erpnext - -# Recreate database quickly. -drop database erpnext; -create database erpnext with encoding 'utf-8' owner postgres; diff --git a/dev-scripts/docker-run.sh b/dev-scripts/docker-run.sh deleted file mode 100755 index 8ae163f..0000000 --- a/dev-scripts/docker-run.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Uncomment for Fresh Run -docker rm -f erpnext_custom - -# Build with detailed output -BUILDKIT_PROGRESS=plain docker build --platform linux/amd64 -t erpnext_custom . - -# Run in an environment similar to Cloudron. -# Must access using nginx or similar reverse proxy. -BUILDKIT_PROGRESS=plain docker build --platform linux/amd64 -t erpnext_custom . && - docker run --platform linux/amd64 --read-only \ - -v "$(pwd)"/.docker/app/data:/app/data:rw \ - -v "$(pwd)"/.docker/tmp:/tmp:rw \ - -v "$(pwd)"/.docker/run:/run:rw \ - -p 8000:80 \ - -p 9000:9000 \ - --network localnet \ - -e CLOUDRON_MYSQL_USERNAME=erpnext \ - -e CLOUDRON_MYSQL_PASSWORD=erpnext \ - -e CLOUDRON_MYSQL_HOST=host.docker.internal \ - -e CLOUDRON_MYSQL_PORT=3306 \ - -e CLOUDRON_MYSQL_DATABASE=erpnext_site1 \ - erpnext_custom - -BUILDKIT_PROGRESS=plain docker build --platform linux/arm64 -t erpnext14 . && - docker run --platform linux/arm64 \ - -v "$(pwd)"/.docker14/app/data:/app/data:rw \ - -v "$(pwd)"/.docker14/tmp:/tmp:rw \ - -v "$(pwd)"/.docker14/run:/run:rw \ - -p 8800:80 \ - -p 9900:9000 \ - --network localnet \ - -e CLOUDRON_REDIS_HOST=redis-stack \ - erpnext14 \ No newline at end of file diff --git a/manifest/CHANGELOG.md b/manifest/CHANGELOG.md index d81d75d..10993ae 100644 --- a/manifest/CHANGELOG.md +++ b/manifest/CHANGELOG.md @@ -1,6 +1,2 @@ v0.0.1 -Add LDAP support - - -v0.0.1 -Erpnext v14 initial release \ No newline at end of file +Initial Release \ No newline at end of file diff --git a/manifest/DESCRIPTION.md b/manifest/DESCRIPTION.md index 9fc400e..9bff3fe 100644 --- a/manifest/DESCRIPTION.md +++ b/manifest/DESCRIPTION.md @@ -1,4 +1,4 @@ -Run [Erpnext](https://erpnext.com) on [Cloudron](https://cloudron.io). +Install [Frappe Framework](https://frappeframework.com) on [Cloudron](https://cloudron.io). For now, it just works, if nothing goes wrong during installation. diff --git a/manifest/logo.png b/manifest/logo.png index 78f931b..968a419 100644 Binary files a/manifest/logo.png and b/manifest/logo.png differ diff --git a/start.sh b/start.sh index bb2b1b4..97ab72e 100755 --- a/start.sh +++ b/start.sh @@ -4,7 +4,7 @@ set -eu pipefail echo ">>>> Ensure runtime directories" mkdir -p /run/nginx && chown -R cloudron:cloudron /run/nginx/ mkdir -p /run/supervisor/logs && chown -R cloudron:cloudron /run/supervisor/ -mkdir -p /app/data/frappe/{env,config,sites,apps,logs} +mkdir -p /app/data/frappe/{env,config,sites,apps,logs,archived} mkdir -p /run/frappe/logs mkdir -p /app/data/mariadb mkdir -p /run/mysqld/logs @@ -13,6 +13,12 @@ mkdir -p /run/mysqld/logs echo ">>>> Ensure yarn can run properly" touch /run/.yarnrc && chown cloudron:cloudron /run/.yarnrc +touch /run/.npmrc && chown cloudron:cloudron /run/.npmrc + +mkdir -p /run/.yarn && chown cloudron:cloudron /run/.yarn +mkdir -p /run/.npm && chown cloudron:cloudron /run/.npm +mkdir -p /run/.cache && chown cloudron:cloudron /run/.cache +mkdir -p /run/.local && chown cloudron:cloudron /run/.local # Frappe Bench @@ -22,6 +28,7 @@ if [[ ! -f /app/data/frappe/.initialized ]]; then cp -R /app/pkg/frappe-bench-orig/config/* /app/data/frappe/config/ cp -R /app/pkg/frappe-bench-orig/sites/* /app/data/frappe/sites/ cp -R /app/pkg/frappe-bench-orig/apps/* /app/data/frappe/apps/ + cp -R /app/pkg/frappe-bench-orig/archived/* /app/data/frappe/archived/ cp -n /app/pkg/frappe-bench-orig/patches.txt /app/data/frappe/patches.txt cp -R /app/pkg/frappe-bench-orig/logs/* /run/frappe/logs/ touch /app/data/frappe/.initialized @@ -87,9 +94,6 @@ if [[ ! -f "/app/data/frappe/sites/${DEFAULT_SITE}/.initialized" ]]; then # Make sure frappe is installed by default on this site. echo 'frappe' >/app/data/frappe/sites/apps.txt - # Fetch erpnext app (erpnext is not fetched in docker image to reduce size) - gosu cloudron bench get-app --branch ${ERPNEXT_VERSION} --resolve-deps erpnext - gosu cloudron:cloudron bench new-site \ --force \ --db-name "${DB_NAME}" \