Skip to content

Commit

Permalink
Merge pull request #1 from infracloudio/moodle-acorn
Browse files Browse the repository at this point in the history
moodle acornfile
  • Loading branch information
samkulkarni20 authored Oct 30, 2023
2 parents 5d46e79 + f1875e1 commit 9471068
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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} .
72 changes: 72 additions & 0 deletions Acornfile
Original file line number Diff line number Diff line change
@@ -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: "[email protected]"
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"
}
}
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions moodle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9471068

Please sign in to comment.