Add more docker compatibility to run.sh
and improve README.md
This commit is contained in:
parent
92ac97803b
commit
9cf28154cf
20
README.md
20
README.md
|
@ -8,19 +8,33 @@ Place this app in **nextcloud/apps/**
|
|||
|
||||
This is the [tutorial app](https://docs.nextcloud.com/server/latest/developer_manual/app_development/tutorial.html) which shows how to develop a very simple notes app.
|
||||
|
||||
## Installing dependencies
|
||||
## Development
|
||||
|
||||
Docker or Podman is required for the dev environment.
|
||||
Other than that composer and npm/nodejs must be installed.
|
||||
|
||||
### Mac OS
|
||||
|
||||
```shell
|
||||
brew install coreutils
|
||||
```
|
||||
|
||||
### All
|
||||
|
||||
```shell
|
||||
npm install
|
||||
make
|
||||
```
|
||||
|
||||
### Start dev environment
|
||||
|
||||
Starting the development environment with your container runtime should be as easy as
|
||||
|
||||
```shell
|
||||
./run.sh
|
||||
```
|
||||
|
||||
|
||||
make composer
|
||||
|
||||
## Frontend development
|
||||
|
||||
The app tutorial also shows the very basic implementation of an app frontend using [Vue.js](https://vuejs.org/). To build the frontend code after doing changes to its source in `src/` requires to have Node and npm installed.
|
||||
|
|
30
run.sh
30
run.sh
|
@ -3,23 +3,23 @@
|
|||
set -xeuo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
DIR="${0%/*}"
|
||||
DIR="$(realpath ${0%/*})"
|
||||
RUNTIME_IS_PODMAN="false"
|
||||
if [[ -x "$(which podman)" ]]; then
|
||||
CONTAINER_RUNTIME="$(which podman)"
|
||||
CONTAINER_RUNTIME="$(which podman 2> /dev/null)"
|
||||
RUNTIME_IS_PODMAN="true"
|
||||
elif [[ -x "$(which docker)" ]]; then
|
||||
CONTAINER_RUNTIME="$(which docker)"
|
||||
CONTAINER_RUNTIME="$(which docker 2> /dev/null)"
|
||||
else
|
||||
echo "Container runtime (docker/podman) not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# replace containers
|
||||
if $CONTAINER_RUNTIME inspect --type container synapse; then
|
||||
if $CONTAINER_RUNTIME inspect --type container synapse 1> /dev/null; then
|
||||
$CONTAINER_RUNTIME rm -f synapse
|
||||
fi
|
||||
if $CONTAINER_RUNTIME inspect --type container nextcloud; then
|
||||
if $CONTAINER_RUNTIME inspect --type container nextcloud 1> /dev/null; then
|
||||
$CONTAINER_RUNTIME rm -f nextcloud
|
||||
fi
|
||||
|
||||
|
@ -38,10 +38,7 @@ $CONTAINER_RUNTIME run -d \
|
|||
$CONTAINER_RUNTIME exec nextcloud bash -c 'apt-get update && apt-get install -y git'
|
||||
$CONTAINER_RUNTIME exec nextcloud chown -R 33 /var/www/html/custom_apps
|
||||
|
||||
if [[ $(id -u) -eq 0 || $RUNTIME_IS_PODMAN != "true" ]]; then
|
||||
$CONTAINER_RUNTIME exec nextcloud chown -R 33 /var/www/html/custom_apps
|
||||
$CONTAINER_RUNTIME exec nextcloud chmod -R ug+rw /var/www/html/custom_apps
|
||||
else
|
||||
if [[ $(id -u) -ne 0 && $RUNTIME_IS_PODMAN == "true" ]]; then
|
||||
$CONTAINER_RUNTIME unshare -- chown -R 33 "$DIR"
|
||||
$CONTAINER_RUNTIME unshare -- chgrp -R 0 "$DIR"
|
||||
$CONTAINER_RUNTIME unshare -- chmod -R ug+rw "$DIR"
|
||||
|
@ -52,9 +49,20 @@ $CONTAINER_RUNTIME exec --user 33 nextcloud php occ maintenance:install --databa
|
|||
$CONTAINER_RUNTIME exec --user 33 nextcloud php occ config:system:set --value=true --type=boolean debug
|
||||
$CONTAINER_RUNTIME exec --user 33 nextcloud php occ app:enable --force upschooling
|
||||
|
||||
if $CONTAINER_RUNTIME volume exists synapse-data; then
|
||||
echo "Found existing synapse-data volume"
|
||||
SYNAPSE_DATA_VOLUME_EXISTS="false"
|
||||
if [[ $RUNTIME_IS_PODMAN == "true" ]]; then
|
||||
if $CONTAINER_RUNTIME volume exists synapse-data; then
|
||||
echo "Found existing synapse-data volume (via volume exists)"
|
||||
SYNAPSE_DATA_VOLUME_EXISTS="true"
|
||||
fi
|
||||
else
|
||||
if $CONTAINER_RUNTIME volume inspect synapse-data 1> /dev/null; then
|
||||
echo "Found existing synapse-data volume (via volume inspect)"
|
||||
SYNAPSE_DATA_VOLUME_EXISTS="true"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SYNAPSE_DATA_VOLUME_EXISTS == "true" ]]; then
|
||||
$CONTAINER_RUNTIME run --rm \
|
||||
--name=synapse \
|
||||
--hostname synapse \
|
||||
|
|
Loading…
Reference in a new issue