Skip to content

Commit

Permalink
Merge pull request #6 from pondersource/setup
Browse files Browse the repository at this point in the history
Initial Docker setup, fix #2
  • Loading branch information
michielbdejong authored Jun 14, 2021
2 parents 758e494 + e0907fa commit ee05d48
Show file tree
Hide file tree
Showing 56 changed files with 2,155 additions and 50 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker/nc/nc-sciencemesh/
docker/revad/reva-storage-nextcloud/
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# sciencemesh-nextcloud
Connect your Nextcloud server to Sciencemesh

This repository contains:

* `nc-sciencemesh/`, a plugin for Nextcloud
* `docker/nextcloud/`, a Docker image for Nextcloud that uses `nc-sciencemesh`
* `reva-storage-nextcloud/`, a plugin for Reva (storage backend for `revad`)
* `docker/revad/`, a Docker image for `revad` that uses `reva-storage-nextcloud`
* `build.sh` a shell script that builds Nextcloud + Reva Docker images
* `run.sh` a shell script that runs Nextcloud + Reva in a local Docker testnet
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

rm -rf docker/nc/nc-sciencemesh
cp -r nc-sciencemesh docker/nc/
docker build -t nc docker/nc/

rm -rf docker/revad/reva-storage-nextcloud
cp -r reva-storage-nextcloud docker/revad/
docker build -t revad docker/revad/
3 changes: 3 additions & 0 deletions docker/nc/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dockerfile
env.list
.git
17 changes: 17 additions & 0 deletions docker/nc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM nextcloud:latest
COPY site.conf /etc/apache2/sites-enabled/000-default.conf
RUN a2enmod ssl
RUN mkdir /tls
RUN openssl req -new -x509 -days 365 -nodes \
-out /tls/server.cert \
-keyout /tls/server.key \
-subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro"
RUN apt-get update && apt-get install -yq \
certbot \
git \
python3-certbot-apache \
vim
WORKDIR /var/www/html
ADD init.sh /
ADD nc-sciencemesh/ /sciencemesh/
EXPOSE 443
1 change: 1 addition & 0 deletions docker/nc/env.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SERVER_ROOT=https://server
7 changes: 7 additions & 0 deletions docker/nc/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
export PHP_MEMORY_LIMIT="512M"
php console.php maintenance:install --admin-user alice --admin-pass alice123
php console.php status
cp -r /sciencemesh apps/
php console.php app:enable sciencemesh
echo configured
14 changes: 14 additions & 0 deletions docker/nc/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VirtualHost *:443>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLCertificateFile "/tls/server.cert"
SSLCertificateKeyFile "/tls/server.key"
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
40 changes: 39 additions & 1 deletion docker/revad/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
FROM cs3org/revad
FROM golang:alpine as builder
RUN apk --no-cache add \
ca-certificates \
bash \
git \
gcc \
libc-dev \
make

ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go

WORKDIR /go/src/github/cs3org
RUN git clone https://github.com/ylebre/reva
WORKDIR /go/src/github/cs3org/reva
RUN git checkout static-build

ADD reva-storage-nextcloud /go/src/github/cs3org/reva/pkg/storage/fs/nextcloud
RUN sed -i '29 a\ \ \ \ \ \ _ "github.com/cs3org/reva/pkg/storage/fs/nextcloud"' pkg/storage/fs/loader/loader.go
RUN make build-revad-docker && \
cp /go/src/github/cs3org/reva/cmd/revad/revad /go/bin/revad

RUN mkdir -p /etc/revad/ && echo "" > /etc/revad/revad.toml

FROM ubuntu
RUN apt-get update && apt-get install -yq\
git \
vim

EXPOSE 9999 10000

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/revad /usr/bin/revad
COPY --from=builder /etc/revad /etc/revad

ADD revad.toml /etc/revad/revad.toml

ENTRYPOINT [ "/usr/bin/revad" ]
CMD [ "-c", "/etc/revad/revad.toml", "-p", "/var/run/revad.pid" ]
8 changes: 0 additions & 8 deletions docker/revad/config.toml

This file was deleted.

12 changes: 12 additions & 0 deletions docker/revad/revad.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[grpc]
address = "0.0.0.0:18000"

[grpc.services.storageprovider]
driver = "nextcloud"
mount_path = "/nc"
mount_id = "123e4567-e89b-12d3-a456-426655440000"
expose_data_server = true
data_server_url = "http://nexcloud/data"

[http]
address = "0.0.0.0:18001"
41 changes: 0 additions & 41 deletions docker/run-nc-and-revad.sh

This file was deleted.

17 changes: 17 additions & 0 deletions nc-live.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

docker run --network=host -d --name nc_live nc
until curl -I http://dockerbak 2> /dev/null > /dev/null
do
echo Waiting for Nextcloud to start on dockerbak, this can take up to a minute ...
docker ps -a
docker logs nc_live
sleep 1
done
docker exec -u www-data -it -e SERVER_ROOT=http://dockerbak nc_live sh /init.sh
docker exec -u root -it nc_live service apache2 reload
echo vim config/config.php +24
docker exec -u www-data -it nc_live /bin/bash

e
3 changes: 3 additions & 0 deletions nc-sciencemesh/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
launch.sh

58 changes: 58 additions & 0 deletions nc-sciencemesh/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
sudo: required
dist: trusty
language: php
php:
- 5.6
- 7
env:
global:
- CORE_BRANCH=stable9
matrix:
- DB=pgsql

matrix:
allow_failures:
- env: DB=pgsql CORE_BRANCH=master
include:
- php: 5.6
env: DB=sqlite
- php: 5.6
env: DB=mysql
- php: 5.6
env: DB=pgsql CORE_BRANCH=master
fast_finish: true

before_install:
# enable a display for running JavaScript tests
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- if [[ "$DB" == 'mysql' ]]; then sudo apt-get -y install mariadb-server; fi
- nvm install 5.9
- npm install -g npm@latest
- make
- make appstore
# install core
- cd ../
- git clone https://github.com/owncloud/core.git --recursive --depth 1 -b $CORE_BRANCH owncloud
- mv sciencemesh owncloud/apps/

before_script:
- if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e 'create database oc_autotest;'; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"; fi
- cd owncloud
- mkdir data
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
- ./occ app:enable sciencemesh
- php -S localhost:8080 &
- cd apps/sciencemesh

script:
- make test

after_failure:
- cat ../../data/owncloud.log

addons:
firefox: "latest"
4 changes: 4 additions & 0 deletions nc-sciencemesh/AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Authors

* Hugo Gonzalez Labrador: <[email protected]>

6 changes: 6 additions & 0 deletions nc-sciencemesh/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
owncloud-sciencemesh (0.0.1)
* **Security**: Security description here
* **Backwards incompatible change**: Changes in the API
* **New dependency**: New dependencies such as a new ownCloud or PHP version
* **Bugfix**: Bugfix description
* **Enhancement**: New feature description
21 changes: 21 additions & 0 deletions nc-sciencemesh/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2020 Hugo Gonzalez Labrador

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit ee05d48

Please sign in to comment.