Passa al contenuto principale

More Apps

1. NextCloud

1.1 Install postgresql

ds pull postgresql
ds init postgresql @postgresql
cd /var/ds/postgresql/
nano settings.sh
ds make

1.2 Install nextcloud

  1. Get the scripts:

    ds pull nextcloud

    cd /opt/docker-scripts/nextcloud/
    tree

    nano Dockerfile
    nano settings.sh
    nano misc/init.sh
    nano cmd/create.sh
    nano cmd/config.sh
    nano inject/setup.sh
    nano cmd/revproxy.sh
    nano cmd/update.sh
  2. Initialize a directory and build the container:

    ds init nextcloud @cloud.user1.fs.al

    cd /var/ds/cloud.user1.fs.al
    nano settings.sh

    Change ADMIN_EMAIL and DEFAULT_PHONE_REGION.

    mv apps.txt apps.txt.sample
    ds make
  3. Open in browser https://cloud.user1.fs.al and login as admin.

1.3 Enable memory overcommit

We are installing Redis inside the NextCloud container. When using Redis, it is recommended to enable memory overcommit on the system, to ensure that it can operate optimally and can efficiently use available memory.

sysctl vm.overcommit_memory
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
nano /etc/sysctl.conf
sysctl -p
sysctl vm.overcommit_memory

Note: For more details see this article.

2. Moodle

2.1 Installation

  1. Get the scripts:

    ds pull moodle

    cd /opt/docker-scripts/moodle/
    ls
    nano Dockerfile
    nano settings.sh
    nano misc/init.sh
    nano ds.sh
    nano cmd/revproxy.sh
    nano cmd/create.sh
    nano cmd/config.sh
  2. Initialize a directory and build the container:

    ds init moodle @edu.user1.fs.al
    cd /var/ds/edu.user1.fs.al/

    nano settings.sh
    ds make

    ls
    ls var-www/moodle/
  3. Open in browser https://edu.user1.fs.al and login as admin.

    • Go to Site Administration / General / Notifications

    • Go to Site Administration / Appearance / Themes

  4. Setup email notifications.

    Go to Site Administration, enter outgoing mail on the search box, and press Enter. Then click on Outgoing mail configuration.

    Make sure that these settings have correct values:

    • SMTP hosts: smtp.user1.fs.al
    • SMTP security: TLS
    • SMTP Auth Type: PLAIN
    • SMTP username: empty
    • SMTP password: empty
    • No-reply address: noreply@user1.fs.al

    Save changes and then click on Test outgoing mail configuration. Send a test message to your email address.

2.2 Maintenance

  1. Backup and restore:

    ds backup
    tar tvf backup-*.tgz

    ds backup +data
    tar tvf backup-*.tgz | less

    ds restore backup-file.tgz
  2. Update and upgrade.

    To update the current stable branch (for example from 4.4.6 to 4.4.7) use ds update. This is done quite frequently and is usually save (no risks of breaking anything).

    To upgrade to the next stable branch (for example from 4.4 to 4.5) use ds upgrade 4.5 MOODLE_405_STABLE.

    Note: Before giving this command, you will have to modify accordingly MOODLE_VERSION and MOODLE_BRANCH on settings.sh.

    Note: The upgrade command will try to upgrade the additional plugins as well, if they have a version that matches the latest moodle release. However this does not always work and some plugins may need to be fixed manually.

    Both update and upgrade make a backup before making any changes, just in case.

  3. Remake.

    The command ds remake rebuilds everything from scratch, but preserves the existing database and data files.

    Note: After a ds upgrade it is recommended to edit settings.sh, update the IMAGE variable, and do a ds remake as well.

3. Asciinema

3.1 The scripts

We can get them from https://gitlab.com/docker-scripts/asciinema with ds pull:

ds pull asciinema

cd /opt/docker-scripts/asciinema/
tree

Notice that there is no Dockerfile. It is because for this application we are using the official docker image, and docker compose, as recommended by the self-hosting docs, instead of using our Dockerfile for building the image.

We also override the commands build, create and config to make sure that they do nothing:

nano cmd/build.sh
nano cmd/create.sh
nano cmd/config.sh

The files that are used to make the application are settings.sh and ds.sh:

nano settings.sh
nano ds.sh

The file ds.sh is loaded automatically by the framework, when present, and can be used to override some framework functions, or to define new auxiliary functions. In this case, it is redefining cmd_start(), cmd_stop(), etc. in terms of docker compose.

The most important function is cmd_make(), which builds the containers and everything. It creates the configuration files compose.yml and compose.env.

3.2 Installation

postgresql is already installed, so let's proceed on with the installation of asciinema:

ds init asciinema @asciinema.user1.fs.al

cd /var/ds/asciinema.user1.fs.al/
nano settings.sh
ds make

ls
tree data
nano compose.yml
nano compose.env

Let's open https://asciinema.user1.fs.al

3.3 Create a user

User sign-up is disabled by default. It also requires an SMTP server. We can enable it following these steps:

  1. Edit compose.env and set SMTP variables like this:

    SMTP_HOST=smtp.user1.fs.al 
    SMTP_PORT=25
    MAIL_FROM_ADDRESS=asciinema@user1.fs.al
    #SMTP_USERNAME=foobar
    #SMTP_PASSWORD=hunter2

    SIGN_UP_DISABLED=false

    Note: We don't need a username and password.

    Note: We have also enabled sign-up.

  2. Rebuild the container and send a test email:

    docker compose down
    docker compose up -d

    docker compose exec asciinema \
    send-test-email dashohoxha@gmail.com

    Note: Check also the Spam folder, just in case.

  3. Go to https://asciinema.user1.fs.al and sign-up.

  4. It is recommended to disable sign-up again. Set SIGN_UP_DISABLED=true and rebuild the container.

    nano compose.env

    docker compose down
    docker compose up -d
  5. Optionally, make your user an admin (although this has little value when there is a single user):

    docker compose exec asciinema \
    admin_add dashohoxha@gmail.com

3.4 Recording

  1. Install asciinema cli:

    apt install asciinema
  2. Set the variable ASCIINEMA_API_URL:

    export ASCIINEMA_API_URL=https://asciinema.user1.fs.al

    Add it to ~/.bashrc.

  3. Authenticate to the asciinema server:

    asciinema auth
  4. Make a record and upload it:

    asciinema rec demo.cast
    asciinema upload demo.cast