arrow-left

All pages
gitbookPowered by GitBook
1 of 8

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Maintaining RAP4

Once RAP4 is running, there are maintenance tasks you might want to do. The most frequently used tasks are described here for RAP-3 maintainers to refer to.

The purpose of maintaining software is to guarantee continuous operation for all users. In this chapter we use the RAP4 server at OUNL as an example, trusting that you will figure out what to do for servers of your own.

hashtag
Tasks

Here is an overview of all tasks described on this page. Refer to the related section below for details on each specific task

  1. Connect Before doing any maintenance, you need credentials to gain access to your server. Then you can connect to the server. We assume you gain access to a command-line interface (CLI) of your server. In this text that CLI is /bin/bash on a linux machine.

  2. Check the configuration When you start a maintenance session, you may want to check on the system. RAP4 runs in containers on a docker-platform, so you can check whether the containers are running and you can check the configuration in which they should be running.

  3. Upgrade to a new version of RAP

  4. Upgrade to a new version of Ubuntu

  5. Refresh the configuration Refreshing the RAP4 configuration is something you need to do only when developers tell you to do that.

hashtag
Connecting to the RAP4 server

The RAP-server has been configured to communicate via ssh. The Open Universiteit allows ssh-connections only through VPN. So I made sure my VPN-connection is active.

I entered the server using command ssh rap.cs.ou.nl and the right user/password combination, upon which I gained access to the CLI.

The RAP4-instance is installed from directory ~\RAP4, which is the working directory from which maintenance is done.

This is what you can expect to see:

hashtag
Checking which containers are running

The server should show at least two containers, a database container called rap4_db and a RAP-container called rap4. There may be a third container called phpmyadmin, which is there to gain access to the database (for maintainers only). To verify, give the command docker ps. This is what you may expect to see:

In this case it appears that a fourth container is running. This poses no problem, because other processes may run concurrently without interfering with RAP4.

The configuration file that specifies this configuration is the only file in the working directory:

By inspecting the contents you can see whether the configuration matches what you see in docker. This is what you can expect in docker-compose.yml:

The directory volumes contains the Ampersand data, which is kept outside the containers so the data persists if containers get killed or if you restart the software.

There are three data sets. The directory log contains logging information of the RAP4-server. The directory mysql contains the data from MariaDB. The directory scripts contains the student scripts and the files they generated when working in RAP4.

hashtag
Upgrade to a new version of RAP

If you need to upgrade RAP4 to the latest release run this command:

As you can see in the configuration (docker-compose.yml)

hashtag
Upgrade to a new version of Ubuntu

When you connect to the server, you get hints about the state your Ubuntu server is in. E.g.

In such cases you can update by giving two commands:

Sometimes a package is kept back because there is a problem with dependencies. You will have to upgrade such packages by hand.

hashtag
Refreshing the code

In the rare event that the configuration of RAP4 has changed (to be announced by the developers), you must update the file docker-compose.ymlby hand, using the command:

stefjoosten$ ssh sjo@rap.cs.ou.nl
sjo@rap.cs.ou.nl's password: 
Permission denied, please try again.
sjo@rap.cs.ou.nl's password: 
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-124-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

170 packages can be updated.
12 updates are security updates.

New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Wed May 29 12:03:17 2019 from 145.20.142.195
sjo@lnx-hrl-202v:~$cd RAP4
sjo@lnx-hrl-202v:~/RAP4$
sjo@lnx-hrl-202v:~/RAP4$ docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                            NAMES
40e5e97c1b26        phpmyadmin/phpmyadmin     "/run.sh superviso..."   4 months ago        Up 36 seconds       9000/tcp, 0.0.0.0:8080->80/tcp   rap3_phptools_1
bff782b2da89        ampersandtarski/rap4-db   "docker-entrypoint..."   4 months ago        Up 2 weeks          3306/tcp                         rap3_db_1
773f7ad86527        dockerampersand_rap3      "docker-php-entryp..."   18 months ago       Up 2 weeks          0.0.0.0:80->80/tcp               dockerampersand_rap3_1
7525eb7ea95f        dockerampersand_db        "docker-entrypoint..."   18 months ago       Up 2 weeks          3306/tcp                         dockerampersand_db_1
sjo@lnx-hrl-202v:~/RAP4$ 
sjo@lnx-hrl-202v:~/RAP4$ ls -al
total 20
drwxrwxr-x  3 sjo  sjo  4096 Oct 25  2018 .
drwxr-xr-x 18 sjo  sjo  4096 Jan  9  2018 ..
-rw-rw-r--  1 sjo  sjo   472 Oct 25  2018 docker-compose.yml
drwxr-xr-x  5 root root 4096 Dec 15  2017 volumes
sjo@lnx-hrl-202v:~/RAP4$ 
sjo@lnx-hrl-202v:~/RAP4$ cat docker-compose.yml
version: '3'

services:
  rap4:
    restart: always
    image: ampersandtarski/ampersand-rap:latest
    ports:
      - "80:80"
    links:
      - db
    volumes:
      - ./volumes/log:/var/www/html/RAP4/log
      - ./volumes/scripts:/var/www/html/RAP4/scripts
 
  db:
    restart: always
    image: ampersandtarski/rap4-db
    volumes:
      - ./volumes/mysql:/var/lib/mysql

  phptools:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8080:80"
    links:
      - db
sjo@lnx-hrl-202v:~/RAP4$
sjo@lnx-hrl-202v:~/RAP4$ ls -al volumes/
total 40
drwxr-xr-x   5 root     root      4096 Dec 15  2017 .
drwxrwxr-x   3 sjo      sjo       4096 Oct 25  2018 ..
drwxr-xr-x   2 www-data www-data  4096 Dec 28 11:16 log
drwxr-xr-x 229      999      999 20480 May 13 07:48 mysql
drwxr-xr-x  75 www-data www-data  4096 Oct 25  2018 scripts
sjo@lnx-hrl-202v:~/RAP4$
sjo@lnx-hrl-202v:~/RAP4$ docker-compose up -d
% ssh sjo@rap.cs.ou.nl
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-151-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Aug 11 10:26:22 CEST 2021

  System load:                    0.08
  Usage of /:                     68.3% of 48.83GB
  Memory usage:                   17%
  Swap usage:                     0%
  Processes:                      264
  Users logged in:                0
  IP address for ens160:          145.20.188.96
  IP address for br-0b19c7bfdba3: 172.20.0.1
  IP address for br-0f95c427718c: 172.26.0.1
  IP address for docker0:         172.17.0.1

 * Canonical Livepatch is enabled.
   - All available patches applied.

84 packages can be updated.
1 update is a security update.


*** System restart required ***
Last login: Mon Aug  2 11:14:56 2021 from 145.20.142.176
sjo@lnx-hrl-202v:~$
sjo@lnx-hrl-202v:~$ sudo apt update
sjo@lnx-hrl-202v:~$ sudo apt upgrade
wget https://raw.githubusercontent.com/AmpersandTarski/RAP/master/docker-compose.yml

Deploying RAP4 in the Azure cloud

In early 2017 the need arose for an Ampersand implementation in Ordina's cloud, to let young professionals get acquainted with Ampersand. We chose to implement RAP4 in Azure, because Ordina has an Azure subscription. RAP4 is the same environment that our students use at the Open Universiteit, so the maintainance of RAP4 can be reused for both target audiences.

This chapter is an account of the deployment of RAP4. You can use it as an example if you want to do it yourself.

Deployment has been automated using docker, because we want to make the deployment as much as possible automated. The required images are available on Docker-hub, so deployment is immediate. Automated deployment by docker means that we can quickly release updates too.

hashtag
0. Deployment approach

We use Docker to simplify the deployment of RAP and make this installation portable to many different computers.

We took a simple Linux machine, installed docker, and built docker images for RAP4 and created three containers: db, rap4, and phpmyadmin. The first one, db, runs MariaDB and contains the administration of RAP4 and the Ampersand scripts of users. The rap4 container contains the RAP4 application proper. It is accessed on port 80. The container phpmyadmin is present for maintainers to inspect the database through phpMyAdmin. It is accessible through port 8080.

Each step in the installation process is described by a separate section in the sequel.

hashtag
1. Setting up the virtual machine

I needed an Azure account to enter the Azure portal and install a server for Ampersand. I got my account from Ordina. Azure offers preconfigured installations to kick-start a virtual machine. In principle, any server that runs docker will work. I picked CoreOS, which is a minimal Linux platform and suitable for container computing with docker.

The following settings were made:

I verified completion of this step by checking the Azure dashboard. It shows machine Wolfram running.

I have verified the machine was live by logging in via Putty (a popular SSH-client). I accessed this machine, using ampersandadmin@137.117.190.28 and the correct password. In the sequel, I will refer to this machine as "the server".

hashtag
2. Port settings

To perform this step, I didn't wait until step1 was completed. It is sufficient that the Netwerkbeveiligingsgroep Wolfram-nsg exists. In order to access RAP4 from the internet, we told the virtual machine to open port 80 for http and 443 for https. These settings were made in the Azure portal via Resourcegroepen > AmpersandRAP4 > Wolfram-nsg (Netwerkbeveiligingsgroep) > inkomende beveiligingsregels. A rules was added to make the server listen to port 80/TCP.

No rule was added for the database, so the database is only open to phpMyAdmin and RAP4, or from within its container.

hashtag
3. Installing Docker

This step requires a server, so you must have finished section 1 successfully. (If docker and docker-compose are available, this step is superfluous.) To install docker I followed the following steps in the given order:

Of course, the last step (reboot) requires reconnecting to the machine.

Then I checked that docker is running by:

I checked that docker-compose is available by:

which docker-compose

To check whether ampersandadmin is member of the docker group, use command cat /etc/group.

hashtag
4. Obtaining the install instruction

We need only one file: docker-compose.yml To get it, I used the wget command, which gets stuff from the web:

hashtag
5. Installing RAP4

To install RAP4:

To check whether this worked, I went to my browser and navigated to http://137.117.190.28/. It took a while to get started, because it was building a fresh database.

I checked whether the containers are running by means of the docker ps command.

Completion of this step allowed access to RAP4 from an arbitrary computer on the internet:

The database is accessible on port 8080:

Deployment Configuration

hashtag
Permissions for log files

The docker configuration uses volumes to link to the file system of the host computer. As a result the status of RAP will survive containers (i.e. you can start, stop, kill, restart containers without losing data). However, you must ensure write permission for the container on runtime throughout all three subdirectories of the volumes directory. The pod in which RAP runs defines a volume called log in which the log files are written and a volume called scripts in which user scripts are stored. The pod in which MariaDB runs writes its mysql-directory to a volume called mysql. This means that the files are stored outside the container on the machine that hosts the docker platform.

hashtag
Docker group

You have a host computer in which the docker platform runs. (In deploying RAP4 for the OUNL that would be the machine with domain name rap.cs.ou.nl). To avoid permission errors (and the use of sudo), add your user to the docker group. .

hashtag
Development vs. Production versions

For developing RAP you use slightly different settings. For example you want to reset the database when developing, but this feature must be entirely impossible during production. For this purpose we have two source files: RAP4dev.adl and RAP4prod.adl. The only difference between the two is configuration settings. Follow the code to find out.

Deploying OUNL RAP4

If you want to deploy RAP4 on your own server, you might try to copy how I deployed RAP4 at the OUNL. This chapter tells you how.

In early 2016 the need arose to replace the RAP2 implementation of Ampersand by a RAP3 implementation, because RAP2 was insufficiently maintainable. This environment is used by students for completing the course Rule Based Design (OBR, code IM0103). This implementation is hosted by ICTS, the IT-department of the university.

This chapter is an account of the installation process. It serves the following purposes:

  1. It is an example for others who want to deploy Ampersand. We get requests now and then by people who want to deploy Ampersand, so we figured it is nice to have a documented example for them.

  2. It documents the installation we made for the Open University. We want maintenance of RAP4 to be transferable to other persons, so we need to document the choices made and the reasons for making them.

  3. It contains all information needed to make a deployment script for automated deployment. We have automated the deployment with Docker, so that RAP4 will always be up to date with the most recent stable release of Ampersand.

Each step in the installation process gets a separate section in this text.

hashtag
1. Setting up the virtual machine

I got a server from the Open University's IT-department.

The following settings apply:

hashtag
Getting access to the server

At the OUNL, we need VPN to gain access with SSH to a server. This requires approval from the IT department. I got a raw Ubuntu machine, meaning that the port settings (specified above) and VPN have to be requested at the IT-servicedesk.

I can now access this machine through SSH (using PUTTY, which I downloaded from the Internet), but only after installing a VPN-tunnel to the server (using Pulse Secure). In the sequel, I will refer to this machine as "the server". This gave me access through a command line interface (CLI). Ubuntu gave me bash as its CLI.

hashtag
Installing Docker

Since this is a fresh machine, docker has to be installed. By just typing docker, the server advised to install Docker by means of the command sudo apt install docker.io. This turned out to be a bad advice, because it resulted in a too old version of docker. Instead, I followed the instructions on https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ for installing docker. The instructions for docker-compose are found on https://docs.docker.com/compose/install/ .

Then I checked that everything went successfully by means of the which-command:

hashtag
Obtaining the files we need

We need only one file: docker-compose.yml To get it, I used the wget command, which gets stuff from the web:

hashtag
Installing RAP4

To install RAP4:

To check whether this worked, I went to my browser and navigated to http://145.20.188.96/RAP4. It took a while to get started, because it was building a fresh database.

I checked whether the containers are running by means of the docker ps command.

Completion of this step allowed access to RAP4 from an arbitrary computer on the internet:

The database is accessible on port 8080:

Read morearrow-up-right

ampersandadmin

verification type

password (Stef Joosten knows the password)

Resource group (in Azure)

AmpersandRAP4

location (in Azure)

Western Europe

Size

Standard DS11 v2 (2 cores, 14 GB memory)

Inbound port: RAP4 (HTTP)

TCP/80

Inbound port: HTTPS

TCP/443

Inbound port: SSH

TCP/22

Public IP-adres

137.117.190.28 (static)

the full name for calling the application

http://137.117.190.28/RAP4

reboot

subscription in Azure

Ordina TC - RT O Pega - Learning

server name

Wolfram

type VM-disk

SDD

OS

Linux

configuration

Ubuntu 18.04

step

Linux command

To work as root

sudo -i

To install docker, I followed the instructions on https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04arrow-up-right.

To install docker-compose

apt-get install docker-compose

To add the current user (ampersandadmin) to the docker group

usermod -aG docker $(whoami)

To start the docker daemon

Admin user name

now reboot the machine

TCP/80

Inbound port: HTTPS

TCP/443

Inbound port: SSH

TCP/22

Public IP-adres

145.20.188.96

domain name for calling the application

internet access needed

for generating prototypes because the prototype generator draws from the Ampersand-github repository.

server name

lnx-hrl-202v

OS

Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-153-generic x86_64

Admin user name

sjo

verification type

password (Stef Joosten knows the password)

Size

2 core, 7GB

Inbound port: RAP4 (HTTP)

Making Docker images

hashtag
Docker images

This chapter discusses the process of baking (i.e. creating) images for docker hub. It also gives a recipe for creating docker images. If you are interested only in installing RAP4, you do not need this chapter.

Docker images are baked when the Ampersand source code for RAP4 is ready to be deployed. This results in three files, to be stored on Docker hub:

hashtag
The release train

RAP4 is deployed as shown in this picture

hashtag
A recipe for creating images

Knowing what needs to be done allows you to understand how we make Ampersand's docker images. If you just want to do it, follow the steps below. We assume that you are working on an Ubuntu machine with bash as its command line interface.

hashtag
Check your Docker installation

First I checked that docker and docker-compose are installed on my computer:

If you need to install docker, follow the instructions on .

hashtag
4. Building an Ampersand image

RAP is built on Ampersand and is compiled with Ampersand. For this reason, the RAP image builds on an Ampersand image. Run ./build.sh to build the initial ampersand container that serves as a base for the RAP4 application (or any other Ampersand application). This base images holds all required packages and the (at that moment) latest version of the ampersand compiler the workflow around this container can/should be improved since now the easiest way to rebuild is to remove the container (docker rmi ampersand:latest)

hashtag
4. Making a Docker image

I cloned the docker files into a local directory by the following command:

and sat back to watch an image being created. This takes over an hour. I left the session up and running, because stopping the session means that the docker build process stops. After coming back a day later, I verified that the image is present by running the same command again. That produced the following output:

When you build an image where nothing changes (as shown above), this takes virtually no time at all. However, if you run a fresh image from scratch, it takes a while. Should you want to close your SSH-session in which docker is running, that docker process will be killed. If you want to leave docker running in the background, https://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/ will help. Best thing is to anticipate on it. However, if you didn't anticipate this, you can still send docker to the background by ^Z and give the disown -h command. (The latter is however the least elegant way.)

I checked whether all images are built by the docker images command:

hashtag
5. Publishing to docker-hub

For this step, you need an account on docker-hub. Then Docker will simply push the generated images to docker hub by means of the push-command:

At this point the images are published and this chapter is done. However, it is good to discuss a few collateral issues: deployment, maintenance and security.

hashtag
6. Deploying directly on this server

We are making three containers: one for the database, one for the RAP4 application, and one for PhpMyAdmin. Containers are built from images by the command docker-compose:

This command brings all three containers up and runs them in the background. For this to happen, the file docker-compose.yml must be in the current directory.

I checked whether the containers are running by means of the docker ps command.

Completion of this step allowed access to RAP4 from an arbitrary computer on the internet:

The database is accessible on port 8080:

hashtag
7. Maintenance

The docker-compose up command aggregates the output of each container. When the command exits, all containers are stopped. Running docker-compose up -d starts the containers in the background and leaves them running.

To interfere with RAP4 as it is running, you need to get into the Rap4 container. It is not enough just being on the server, because all the data is in the container (rather than directly on the server). To go into the Rap4 container, use the command

hashtag
10. Local Settings

To inspect and change the local settings, you need the file localsettings.php on directory ~/git/Ampersand-models/RAP4/include. This step requires section 5 to be finished successfully. This file contains comments that guide you to use the correct settings in a development situation and in a production situation. Read the file and follow the instructions it contains, especially when making the transition from development to production.

hashtag
11. Last minute changes before going to production

  1. In the source code of RAP4, in the file SIAM_importer.adl:

    1. disable "RAP4_LoginForDevelopment.ifc", to prevent users from seeing

    2. enable "RAP4_LoginForProduction.ifc"

This is decribed in the file docker-compose.yml

 sudo docker ps
sjo@Wolfram:~$ mkdir docker-RAP4
sjo@Wolfram:~$ cd docker-RAP4
sjo@Wolfram:~/docker-RAP4$ wget https://github.com/AmpersandTarski/RAP/raw/master/docker-compose.yml
sjo@Wolfram:~$ sudo docker-compose up -d
sjo@lnx-hrl-202v:~$ which docker
/usr/bin/docker
sjo@lnx-hrl-202v:~$ which docker-compose
/usr/bin/docker-compose
sjo@lnx-hrl-202v:~$ mkdir RAP4
sjo@lnx-hrl-202v:~$ cd RAP4
sjo@lnx-hrl-202v:~/RAP4$ wget https://raw.githubusercontent.com/AmpersandTarski/RAP/master/docker-compose.yml
sjo@lnx-hrl-202v:~/RAP4$ docker compose up -d

disable "../SIAM/SIAM_AutoLoginAccount.adl"

  • Is there anything we must alter in localsettings.php before going live?

  • https://docs.docker.com/engine/installationarrow-up-right
    rap.cs.ou.nlarrow-up-right
    sjo@lnx-hrl-202v:~$ which docker
    /usr/bin/docker
    sjo@lnx-hrl-202v:~$ which docker-compose
    /usr/bin/docker-compose
    sudo -i
    git clone https://github.com/AmpersandTarski/docker-ampersand/ /home/$(whoami)/docker-ampersand
    cd docker-ampersand/
    ./build.sh
    Wolfram docker-ampersand # docker build -t ampersand:latest ampersand
    Sending build context to Docker daemon 4.096 kB
    Step 1 : FROM php:7-apache
     ---> 2720c02fc079
    Step 2 : ENV PATH /texlive/bin/x86_64-linux:$PATH
     ---> Using cache
     ---> 45d62477f5e2
    Step 3 : RUN apt-get update  && apt-get install -y --no-install-recommends git graphviz wget xorriso  && curl -sSL https://get.haskellstack.org/ | /bin/sh  && rm -rf /var/lib/apt/lists/*
     ---> Using cache
     ---> e37542ec9301
    Step 4 : ENV TL_VERSION 2016-20160523
     ---> Using cache
     ---> f95346ded414
    Step 5 : ADD texlive.profile /tmp
     ---> Using cache
     ---> add9fd911c38
    Step 6 : RUN cd ~  && wget -q   http://mirrors.ctan.org/systems/texlive/Images/texlive$TL_VERSION.iso  && wget -qO- http://mirrors.ctan.org/systems/texlive/Images/texlive$TL_VERSION.iso.sha512 | sha512sum -c  && osirrox -report_about NOTE -indev texlive$TL_VERSION.iso -extract / /usr/src/texlive  && rm texlive$TL_VERSION.iso  && /usr/src/texlive/install-tl -profile /tmp/texlive.profile  && rm -rf /usr/src/texlive  && rm /tmp/texlive.profile
     ---> Using cache
     ---> f0ebcd4cf50c
    Step 7 : RUN mkdir ~/git  && cd ~/git  && git clone --branch development https://github.com/AmpersandTarski/Ampersand
     ---> Using cache
     ---> 08643d5cce73
    Step 8 : RUN cd ~/git/Ampersand  && stack setup  && stack install --local-bin-path /usr/local/bin
     ---> Using cache
     ---> 636036e98214
    Step 9 : RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"  && php composer-setup.php --install-dir=/usr/local/bin --filename=composer  && php -r "unlink('composer-setup.php');"
     ---> Using cache
     ---> e8648c6657f6
    Successfully built e8648c6657f6
    sjo@lnx-hrl-202v:~/ampersand-models/RAP4$ docker images
    REPOSITORY                               TAG                 IMAGE ID            CREATED             SIZE
    ampersandtarski/ampersand-rap            latest              636643166a78        2 hours ago         3.62GB
    ampersandtarski/ampersand-prototype-db   latest              d267da36fb90        4 hours ago         395MB
    ampersandtarski/ampersand-prototype      texlive             efd0dccd6b4b        6 hours ago         3.11GB
    phpmyadmin/phpmyadmin                    latest              200931982ab6        6 days ago          110MB
    docker push ampersandtarski/ampersand-rap
    docker push ampersandtarski/ampersand-prototype-db
    docker push ampersandtarski/ampersand-prototype
    cd /home/ampersandadmin/docker-ampersand
    docker-compose up -d
    docker exec -ti dockerampersand_rap4_1 /bin/bash

    Installation of RAP

    RAP is a Repository for Ampersand Projects. This tool is being used by the Open University of the Netherlands in the course Rule-Based Designarrow-up-right. It lets users analyse Ampersand models, generate functional specifications, and make prototypes of information systems. It is the primary tool for students in relation to Ampersand.

    Deployment means to install RAP4 on a web server or a laptop of your own. The easiest way to try Ampersand, however, is by just using the OUNL-installationarrow-up-right and avoid the installation.

    hashtag
    Automated deployment

    We use Docker for automating the deployment and making RAP portable over different platforms. The following three sections report three different installations we did:

    • to ;

    • to in the Azure cloud;

    • to on a server in the OUNL-datacenter.

    These three reports will most likely contain enough information to let you reproduce the installation on a computer or platform of your own.

    The last section of this chapter discusses the , which you may need if the above does not work because the images are (for any reason whatsoever) unavailable on the internet.

    hashtag
    Questions? Need help?

    Don't hesitate to contact Han Joosten. He'll be glad to help out.

    deploy RAP on a laptop
    deploy RAP on an Ordina server
    deploy RAP at the Open University
    making of docker images

    Deploying to your own laptop

    If you want to deploy RAP4 to your laptop, this chapter tells you how.

    This example has worked on my Macbook. If you have a different computer, you may either change the commands below to the commands of your own computer or set up a virtual Linux machine on your laptop.

    hashtag
    Prerequisites

    You need docker. Follow the instructions onhttps://docs.docker.com/.

    You need git. Follow the instructions on https://github.com/git-guides/install-git.

    You need to use a command-line, you need permission to install software on your laptop and you need to be connected to the Internet.

    Start in your command-line interface (CLI, terminal on a macbook) and go to (or make) a working directory from which you want to keep Git repositories.

    hashtag
    Obtaining the files we need

    Import the required files from Github (note: you may need to log in into Github):

    Expect roughly this response:

    Now go to the directory from which to install RAP:

    You need to create a proxy network to let RAP communicate with your browser (no problem if it already exists; docker will tell you with an appropriate message)

    When docker has made the network, it tells you something like this:

    Now spin up RAP4 (note: in older versions of docker use docker-compose instead of docker compose. The difference is just a hyphen):

    The first time you spin up RAP4, docker will spontaneously download the images it needs. That generates substantial output. At the end docker will show the containers that have been started:

    Now, you need to "climb into" the rap4 container to execute one command manually:

    You now get a prompt like root@bc774265c8ef:/usr/local/project# that indicates that you are inside the rap4 container. Once inside, you need to give the following chmod command to enable RAP to generate prototypes.

    Finally, type exit to leave the rap4-container and return to the CLI of your laptop.

    Now you are done. Just check whether everything works:

    Type localhost in the URL-field of your browser, to see if RAP4 has started. You should see this:

    Note that RAP runs on the insecure http:// instead of https://. This is not a problem if you keep your laptop safe from outsiders' trespassing. If you , you need a secure setup.

    You will find that the database is accessible on http://phpmyadmin.localhost

    The demonstration application, Enrollment, is accessible on http://enroll.localhost

    deploy to a server
    git clone https://github.com/AmpersandTarski/RAPinstall
    Cloning into 'RAPinstall'...
    remote: Enumerating objects: 19, done.
    remote: Counting objects: 100% (19/19), done.
    remote: Compressing objects: 100% (17/17), done.
    remote: Total 19 (delta 2), reused 14 (delta 0), pack-reused 0
    Unpacking objects: 100% (19/19), done.
    cd RAPinstall
    docker network create proxy
    3f9552a7506ac5f2b5d9fcb158edae82f9f64e4e3d6b093916d624d118ba342a
    docker compose up -d
     â ¿ Network rapinstall_db                           Created                                                                                                                                                                               3.9s
     â ¿ Network rapinstall_default                      Created                                                                                                                                                                               3.9s
     â ¿ Volume "rapinstall_rap4-data"                   Created                                                                                                                                                                               0.0s
     â ¿ Volume "rapinstall_db-data"                     Created                                                                                                                                                                               0.0s
     â ¿ Volume "rapinstall_letsencrypt"                 Created                                                                                                                                                                               0.0s
     â ¿ Container traefik                               Started                                                                                                                                                                               7.1s
     â ¿ Container rap4-db                               Started                                                                                                                                                                               5.2s
     â ¿ Container rapinstall_dummy-student-prototype_1  Started                                                                                                                                                                               5.1s
     â ¿ Container phpmyadmin                            Started                                                                                                                                                                              12.7s
     â ¿ Container rap4                                  Started                                                                                                                                                                              12.9s
     â ¿ Container enroll                                Started
    docker exec -it rap4 bash
    chmod 666 /var/run/docker.sock

    Details

    hashtag
    What Docker needs to do...

    Docker is sheer magic. You don't have to understand it to run it. However, if you insist on knowing how it is done...

    Here are ten steps to install RAP4 manually, without Docker, on a freshly created server:

    hashtag
    1. Setting up a server

    You need a server that is connected to the internet, because RAP takes updates from a GitHub repository. A 2-core/8GB server is sufficient. A memory size under 3GB has shown to be insufficient. Ports for HTTP, HTTPS, SSL, and SFTP must be open.

    hashtag
    2. Getting MariaDB (MySQL) and phpMyAdmin to work

    You need a database and a web-server. This explains why a LAMP-server is an obvious choice if you use a preconfigured server.

    hashtag
    3. Uploading and running RAP4

    A quick way to install is to copy the source code of RAP4 on your server and compile it with Ampersand. That gives you the RAP4 webapplication. You will find the complete Ampersand source code of RAP4 on . The main file is ./RAP4/RAP4dev.adl for the development version and ./RAP4/RAP4prod.adl for the production version.

    hashtag
    4. Filling the Git repository with Ampersand files and Ampersand models

    If you don't have an Ampersand compiler, you can build one using the Haskell sources of that compiler. You will find the source code on the development branch of the Ampersand repository (). You can verify success by asking the Ampersand for its version:

    If you don't have an Ampersand compiler, but docker runs on your machine, you can simply use the most recent ampersand compiler by

    Use Git to create a local clone of these repositories. Git is preferred over copying the files, because you can repeatedly use it to ensure you get the right version.

    hashtag
    5. Avoiding to install Haskell

    To build an Ampersand compiler, you need Haskell. However, you can also use the latest executable Ampersand-compiler, which is published periodically on . This way, you don't need to build Ampersand and you can avoid installing Haskell.

    hashtag
    6. Creating an Ampersand compiler

    If you want, create your own Ampersand compiler. This way, you can pick a version by which to generate RAP4.

    hashtag
    7. Installing LaTeX and GraphViz

    LaTeX and GraphViz are called by RAP4 to generate documentation. Therefore, both must be installed on the server.

    hashtag
    8. Generating the RAP4 application

    You need to generate RAP4 to facilitate regular updates to the system.

    hashtag
    9. Local Settings

    Some local settings may apply, which are brought together in one file. Use this to administer things like database account(s) and PHP time limit, logging, etcetera.

    hashtag
    10. Last minute changes before going to production

    Things that are necessary for testing and development, such as logging, can be changed in the production version. These things are usually adapted shortly before going to production.

    https://github.com/AmpersandTarski/RAParrow-up-right
    https://github.com/AmpersandTarski/Ampersand/tree/developmentarrow-up-right
    http://ampersandtarski.github.io/arrow-up-right
    >  ampersand --version
    Ampersand-v3.17.4 [master:fd90ea3f1], build time: 15-Nov-19 18:02:19 CET
    >  docker run -it ampersandtarski/ampersand