diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..9008ccc --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,29 @@ +name: Publish Acorn image +on: + workflow_dispatch: + push: + tags: + - "v[0-9]*" + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: acorn-io/actions-setup@v2 + with: + acorn-version: "main" + - name: Login to GHCR + uses: acorn-io/actions-login@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and Publish with signature + run: | + TAG=${GITHUB_REF#refs/*/} + acorn build --platform linux/amd64 --platform linux/arm64 --push -t ghcr.io/infracloudio/moodle-acorn:${TAG} . \ No newline at end of file diff --git a/Acornfile b/Acornfile new file mode 100644 index 0000000..5cf076a --- /dev/null +++ b/Acornfile @@ -0,0 +1,72 @@ +name: "Moodle Acorn" +description: "Acorn running Moodle" +readme: "./README.md" +icon: "./moodle.svg" + +args: { + database_type: "mariadb" + mariadbname: "moodledb" + postgresdbname: "postgresdb" + moodle_username: "user" + moodle_password: "bitnami" + moodle_email: "user@example.com" + moodle_site_name: "New Site" + moodle_lang: "en" +} + +localData: { + mariadb: { + services: mariadb: { + image: "ghcr.io/acorn-io/mariadb:v#.#.#-#" + serviceArgs: { + dbName: args.mariadbname + } + } + }, + postgres: { + services: postgres:{ + image: "ghcr.io/acorn-io/postgres:v#.#-#" + serviceArgs: { + dbName: args.postgresdbname + } + } + + } +} +std.ifelse(args.database_type == "mariadb",localData.mariadb,localData.postgres) + +containers: { + web: { + image: "docker.io/bitnami/moodle:4.3" + ports: { + publish: "80:8080/http" + } + env: { + MOODLE_DATABASE_TYPE: std.ifelse(args.database_type == "mariadb", "mariadb", "pgsql") + MOODLE_DATABASE_USER: std.ifelse(args.database_type == "mariadb", "@{service.mariadb.secrets.admin.username}","@{service.postgres.secrets.admin.username}" ) + MOODLE_DATABASE_PASSWORD: std.ifelse(args.database_type == "mariadb", "@{service.mariadb.secrets.admin.password}", "@{service.postgres.secrets.admin.password}") + MOODLE_DATABASE_HOST: std.ifelse(args.database_type == "mariadb", "@{service.mariadb.address}", "@{service.postgres.address}") + MOODLE_DATABASE_PORT_NUMBER: std.ifelse(args.database_type == "mariadb", "@{service.mariadb.port.3306}", "@{service.postgres.port.5432}") + MOODLE_DATABASE_NAME: std.ifelse(args.database_type == "mariadb", "@{service.mariadb.data.dbName}", "@{service.postgres.data.dbName}") + MOODLE_USERNAME: args.moodle_username + MOODLE_PASSWORD: args.moodle_password + MOODLE_EMAIL: args.moodle_email + MOODLE_SITE_NAME: args.moodle_site_name + MOODLE_LANG: args.moodle_lang + } + dirs: { + "/bitnami/moodle": "volume://moodle" + "/bitnami/moodledata": "volume://moodledata" + + } + } +} + +volumes: { + moodle: { + size: "2G" + } + moodledata:{ + size: "2G" + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..57d9143 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Acorn for Moodle +====== + +Moodleâ„¢ LMS is an open source online Learning Management System widely used at universities, schools, and corporations. It is modular and highly adaptable to any type of online learning. + +## Configure the Moodle + +Moodle uses mariadb as the database and it is been used as the [services](https://docs.acorn.io/reference/acornfile#services-consuming) . If you are using Advanace Options on Acorn Platform you can provide the `moodledbname`. By default it will be named as `moodledb`. +There are some field which have default values set by can be easily configured. + +By default username and password for moodle is `username: user` `password: bitnami`. You can changes it using `moodle_username` and `moodle_password` field. Site Name, Email and Lang can also be changed using `moodle_site_name`, `moodle_email` and `moodle_lang` field respectively. + +##### Databases +Currently moodle supports two databases. +1. Mariadb +2. Postgress + +By default it will use `mariadb` as the database. If you want to use postgres. You can use `database_type` field and provide `pgsql` as the value. + +You can read more about it [here](https://github.com/bitnami/containers/tree/main/bitnami/moodle#configuration). diff --git a/moodle.svg b/moodle.svg new file mode 100644 index 0000000..35718fb --- /dev/null +++ b/moodle.svg @@ -0,0 +1 @@ + \ No newline at end of file