diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..4719626b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +doc +docker-compose.yml +logs +Zend +zotprime-k8s + diff --git a/.env b/.env deleted file mode 100644 index 4246672e..00000000 --- a/.env +++ /dev/null @@ -1,7 +0,0 @@ -MYSQLROOTPASSWORD=zotero -MYSQLDATABASE=zoterotest -MYSQLUSER=zoterotest -MYSQLPASSWORD=zoterotest - -MINIOROOTUSER=zotero -MINIOROOTPASSWORD=zoterodocker \ No newline at end of file diff --git a/.env_example b/.env_example new file mode 100644 index 00000000..98339f2d --- /dev/null +++ b/.env_example @@ -0,0 +1,13 @@ +#Version +VER=2.5.0-beta + +## SPECIFY SECRETS +#DB +MYSQLROOTPASSWORD=strongpassword +MYSQLDATABASE=aotprimeprod +MYSQLUSER=zotprimeprod +MYSQLPASSWORD=strongpassword + +#MINIO +MINIOROOTUSER=zotero +MINIOROOTPASSWORD=strongpassword \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2959db29..976aa09d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ +.env build -logs \ No newline at end of file +logs +**/secret.json +**/secret.txt +**/secret.yaml +docker-compose.yml \ No newline at end of file diff --git a/README.md b/README.md index f923312f..c4682cff 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,11 @@ $ cd zotprime *Configure and run*: ```bash +$ cp .env_example .env +$ cp docker-compose-prod.yml docker-compose.yml +``` +edit .env and add strong passwords +```bash $ sudo docker compose up -d ``` diff --git a/client.Dockerfile b/client.Dockerfile index 0bac82ba..9714b373 100644 --- a/client.Dockerfile +++ b/client.Dockerfile @@ -1,5 +1,7 @@ FROM node:16-alpine as intermediate +ARG ZOTPRIME_VERSION=2 + RUN set -eux; \ apk update && apk upgrade && \ apk add --update --no-cache git bash curl python3 zip perl rsync \ diff --git a/client.Dockerfile.dockerignore b/client.Dockerfile.dockerignore index 7a331dad..94ee3975 100644 --- a/client.Dockerfile.dockerignore +++ b/client.Dockerfile.dockerignore @@ -12,6 +12,10 @@ clinet/zotero-standalone-build/dist clinet/zotero-standalone-build/staging clinet/zotero-standalone-build/xulrunner clinet/zotero-standalone-build/pdftools +**/secret.json +**/secret.txt +**/secret.yaml +.env *.Dockerfile .github bin diff --git a/clientbuildtest.Dockerfile b/clientbuildtest.Dockerfile index 3a51483b..c79aca08 100644 --- a/clientbuildtest.Dockerfile +++ b/clientbuildtest.Dockerfile @@ -1,5 +1,6 @@ FROM node:16-alpine as intermediate +ARG ZOTPRIME_VERSION=2 RUN set -eux; \ apk update && apk upgrade && \ diff --git a/clientbuildtest.Dockerfile.dockerignore b/clientbuildtest.Dockerfile.dockerignore index 990e06c0..949b70b0 100644 --- a/clientbuildtest.Dockerfile.dockerignore +++ b/clientbuildtest.Dockerfile.dockerignore @@ -1,3 +1,7 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.env .github bin build diff --git a/db.Dockerfile b/db.Dockerfile new file mode 100644 index 00000000..7d20a7bb --- /dev/null +++ b/db.Dockerfile @@ -0,0 +1,6 @@ + +############################ +# mariadb image +############################ + +FROM mariadb:10 \ No newline at end of file diff --git a/db.Dockerfile.dockerignore b/db.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/db.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/docker-compose.yml b/docker-compose-dev.yml similarity index 65% rename from docker-compose.yml rename to docker-compose-dev.yml index 45329b6c..75b0bbb6 100644 --- a/docker-compose.yml +++ b/docker-compose-dev.yml @@ -1,15 +1,18 @@ version: '3.9' services: zotprime-db: - image: mariadb:10 + image: "zotprime-db:${VER}" # image: mysql:5.6 + build: + context: . + dockerfile: db.Dockerfile restart: always # command: --default-authentication-plugin=mysql_native_password environment: - - MYSQL_ROOT_PASSWORD=${MYSQLROOTPASSWORD} - - MYSQL_DATABASE=${MYSQLDATABASE} - - MYSQL_USER=${MYSQLUSER} - - MYSQL_PASSWORD=${MYSQLPASSWORD} + - MARIADB_ROOT_PASSWORD=${MYSQLROOTPASSWORD} + - MARIADB_DATABASE=${MYSQLDATABASE} + - MARIADB_USER=${MYSQLUSER} + - MARIADB_PASSWORD=${MYSQLPASSWORD} volumes: - dbdata:/var/lib/mysql - /etc/localtime:/etc/localtime:ro @@ -18,14 +21,19 @@ services: # soft: 262144 # hard: 262144 zotprime-elasticsearch: -# image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0 - image: docker.elastic.co/elasticsearch/elasticsearch:8.7.0 + image: "zotprime-elasticsearch:${VER}" + mem_limit: 512m + mem_reservation: 256M + build: + context: . + dockerfile: es.Dockerfile environment: - cluster.name=zotero - xpack.security.enabled=false - cluster.routing.allocation.disk.threshold_enabled=false # - cluster.routing.allocation.disk.watermark.flood_stage=500mb - discovery.type=single-node +# - "ES_JAVA_OPTS=-Xms256m -Xmx256m" volumes: - /etc/localtime:/etc/localtime:ro # privileged: true @@ -35,7 +43,10 @@ services: # - vm.max_map_count=262144 # command: "sysctl -w vm.max_map_count=262144" zotprime-redis: - image: redis:5.0 + image: "zotprime-redis:${VER}" + build: + context: . + dockerfile: r.Dockerfile # privileged: true # user: root # sysctls: @@ -43,28 +54,29 @@ services: volumes: - /etc/localtime:/etc/localtime:ro zotprime-memcached: - image: memcached:1.5 + image: "zotprime-memcached:${VER}" + build: + context: . + dockerfile: m.Dockerfile volumes: - /etc/localtime:/etc/localtime:ro zotprime-localstack: - image: atlassianlabs/localstack + image: "zotprime-localstack:${VER}" + build: + context: . + dockerfile: ls.Dockerfile environment: - SERVICES=sns,sqs,apigateway volumes: - /etc/localtime:/etc/localtime:ro zotprime-minio: -# image: minio/minio:RELEASE.2018-10-25T01-27-03Z -# image: minio/minio:RELEASE.2019-01-31T00-31-19Z -# image: minio/minio:RELEASE.2021-06-14T01-29-23Z -# image: minio/minio:RELEASE.2021-10-02T16-31-05Z - image: minio/minio + image: "zotprime-minio:${VER}" + build: + context: . + dockerfile: minio.Dockerfile environment: -# - MINIO_ACCESS_KEY=zotero -# - MINIO_SECRET_KEY=zoterodocker -# - MINIO_HTTP_TRACE=/dev/stderr - MINIO_ROOT_USER=${MINIOROOTUSER} - MINIO_ROOT_PASSWORD=${MINIOROOTPASSWORD} -# command: server /data command: server /data --console-address ":9001" ports: # - "8082:9000" @@ -72,7 +84,10 @@ services: volumes: - /etc/localtime:/etc/localtime:ro zotprime-miniomc: - image: minio/mc + image: "zotprime-miniomc:${VER}" + build: + context: . + dockerfile: miniomc.Dockerfile # entrypoint: # - /bin/sh entrypoint: > @@ -86,7 +101,7 @@ services: depends_on: - zotprime-minio zotprime-dataserver: - image: zotprime-dataserver + image: "zotprime-dataserver:${VER}" build: context: . dockerfile: ds.Dockerfile @@ -98,18 +113,18 @@ services: - "8082:8082" # - "9000:9000" volumes: - - "./dataserver/:/var/www/zotero:rw" - - "./Zend/:/var/www/zotero/include/Zend:rw" - - "./docker/dataserver/create-user.sh:/var/www/zotero/admin/create-user.sh:ro" - - "./docker/dataserver/config.inc.php:/var/www/zotero/include/config/config.inc.php:ro" - - "./docker/dataserver/dbconnect.inc.php:/var/www/zotero/include/config/dbconnect.inc.php:ro" - - "./docker/dataserver/header.inc.php:/var/www/zotero/include/header.inc.php:ro" - - "./docker/dataserver/Storage.inc.php:/var/www/zotero/model/Storage.inc.php:ro" -# - "./docker/dataserver/config/FullText.inc.php:/var/www/zotero/model/FullText.inc.php:ro" # DEBUG - - "./docker/db/init-mysql.sh:/var/www/zotero/misc/init-mysql.sh:ro" - - "./docker/db/db_update.sh:/var/www/zotero/misc/db_update.sh:ro" - - "./docker/db/www.sql:/var/www/zotero/misc/www.sql:ro" - - "./docker/db/shard.sql:/var/www/zotero/misc/shard.sql:ro" +# - "./dataserver/:/var/www/zotero:rw" +# - "./Zend/:/var/www/zotero/include/Zend:rw" +# - "./docker/dataserver/create-user.sh:/var/www/zotero/admin/create-user.sh:ro" +# - "./docker/dataserver/config.inc.php:/var/www/zotero/include/config/config.inc.php:ro" +# - "./docker/dataserver/dbconnect.inc.php:/var/www/zotero/include/config/dbconnect.inc.php:ro" +# - "./docker/dataserver/header.inc.php:/var/www/zotero/include/header.inc.php:ro" +# - "./docker/dataserver/Storage.inc.php:/var/www/zotero/model/Storage.inc.php:ro" +# - "./docker/dataserver/config/FullText.inc.php:/var/www/zotero/model/FullText.inc.php:ro" +# - "./docker/db/init-mysql.sh:/var/www/zotero/misc/init-mysql.sh:ro" +# - "./docker/db/db_update.sh:/var/www/zotero/misc/db_update.sh:ro" +# - "./docker/db/www.sql:/var/www/zotero/misc/www.sql:ro" +# - "./docker/db/shard.sql:/var/www/zotero/misc/shard.sql:ro" - "/etc/localtime:/etc/localtime:ro" environment: - RUN_USER=apache @@ -132,7 +147,7 @@ services: - zotprime-streamserver:streamserver restart: always zotprime-tinymceclean: - image: zotprime-tinymceclean + image: "zotprime-tinymceclean:${VER}" build: context: . dockerfile: tmcs.Dockerfile @@ -147,7 +162,7 @@ services: - /etc/localtime:/etc/localtime:ro restart: always zotprime-streamserver: - image: zotprime-streamserver + image: "zotprime-streamserver:${VER}" build: context: . dockerfile: sts.Dockerfile @@ -165,7 +180,10 @@ services: links: - zotprime-redis:redis zotprime-phpmyadmin: - image: phpmyadmin/phpmyadmin + image: "zotprime-phpmyadmin:${VER}" + build: + context: . + dockerfile: pa.Dockerfile ports: - "8083:80" environment: diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml new file mode 100644 index 00000000..7b4b4ce2 --- /dev/null +++ b/docker-compose-prod.yml @@ -0,0 +1,160 @@ +version: '3.9' +services: + zotprime-db: + image: "zotprime-db:${VER}" + build: + context: . + dockerfile: db.Dockerfile + restart: always + environment: + - MARIADB_ROOT_PASSWORD=${MYSQLROOTPASSWORD} + - MARIADB_DATABASE=${MYSQLDATABASE} + - MARIADB_USER=${MYSQLUSER} + - MARIADB_PASSWORD=${MYSQLPASSWORD} + volumes: + - dbdata:/var/lib/mysql + - /etc/localtime:/etc/localtime:ro + zotprime-elasticsearch: + image: "zotprime-elasticsearch:${VER}" + mem_limit: 2G + mem_reservation: 1G + build: + context: . + dockerfile: es.Dockerfile + environment: + - cluster.name=zotero + - xpack.security.enabled=false + - cluster.routing.allocation.disk.threshold_enabled=false + - discovery.type=single-node + volumes: + - /etc/localtime:/etc/localtime:ro + zotprime-redis: + image: "zotprime-redis:${VER}" + build: + context: . + dockerfile: r.Dockerfile + volumes: + - /etc/localtime:/etc/localtime:ro + zotprime-memcached: + image: "zotprime-memcached:${VER}" + build: + context: . + dockerfile: m.Dockerfile + volumes: + - /etc/localtime:/etc/localtime:ro + zotprime-localstack: + image: "zotprime-localstack:${VER}" + build: + context: . + dockerfile: ls.Dockerfile + environment: + - SERVICES=sns,sqs,apigateway + volumes: + - /etc/localtime:/etc/localtime:ro + zotprime-minio: + image: "zotprime-minio:${VER}" + build: + context: . + dockerfile: minio.Dockerfile + environment: + - MINIO_ROOT_USER=${MINIOROOTUSER} + - MINIO_ROOT_PASSWORD=${MINIOROOTPASSWORD} + command: server /data --console-address ":9001" + ports: + - "9001:9001" + volumes: + - /etc/localtime:/etc/localtime:ro + zotprime-miniomc: + image: "zotprime-miniomc:${VER}" + build: + context: . + dockerfile: miniomc.Dockerfile + entrypoint: > + /bin/sh -c " + /usr/bin/mc config host add minio http://zotprime-minio:9000 ${MINIOROOTUSER} ${MINIOROOTPASSWORD}; + exec mc admin trace -v -a minio; + " + volumes: + - /etc/localtime:/etc/localtime:ro + depends_on: + - zotprime-minio + zotprime-dataserver: + image: "zotprime-dataserver:${VER}" + build: + context: . + dockerfile: ds.Dockerfile + ports: + - "8080:80" + - "8082:8082" + volumes: + - "/etc/localtime:/etc/localtime:ro" + environment: + - RUN_USER=apache + - RUN_GROUP=apache + depends_on: + - zotprime-db + - zotprime-elasticsearch + - zotprime-redis + - zotprime-memcached + - zotprime-tinymceclean + - zotprime-streamserver + links: + - zotprime-db:mysql + - zotprime-elasticsearch:elasticsearch + - zotprime-redis:redis + - zotprime-memcached:memcached + - zotprime-localstack:localstack + - zotprime-minio:minio + - zotprime-tinymceclean:tinymceclean + - zotprime-streamserver:streamserver + restart: always + zotprime-tinymceclean: + image: "zotprime-tinymceclean:${VER}" + build: + context: . + dockerfile: tmcs.Dockerfile + depends_on: + - zotprime-db + - zotprime-elasticsearch + - zotprime-redis + - zotprime-memcached + links: + - zotprime-redis:redis + volumes: + - /etc/localtime:/etc/localtime:ro + restart: always + zotprime-streamserver: + image: "zotprime-streamserver:${VER}" + build: + context: . + dockerfile: sts.Dockerfile + ports: + - "8081:81" + volumes: + - "./docker/stream-server/default.js:/usr/src/app/config/default.js:ro" + - /etc/localtime:/etc/localtime:ro + restart: always + depends_on: + - zotprime-db + - zotprime-elasticsearch + - zotprime-redis + - zotprime-memcached + links: + - zotprime-redis:redis + zotprime-phpmyadmin: + image: "zotprime-phpmyadmin:${VER}" + build: + context: . + dockerfile: pa.Dockerfile + ports: + - "8083:80" + environment: + - PMA_HOST=mysql + links: + - zotprime-db:mysql + volumes: + - /etc/localtime:/etc/localtime:ro +volumes: + dbdata: + driver: local + diff --git a/docker/dataserver/FullText.inc.php b/docker/dataserver/FullText.inc.php index 2050b35f..9edc3d7a 100644 --- a/docker/dataserver/FullText.inc.php +++ b/docker/dataserver/FullText.inc.php @@ -79,7 +79,7 @@ public static function indexItem(Zotero_Item $item, $data) { 'Key' => $libraryID . "/" . $key, 'Body' => $json, 'ContentType' => 'application/gzip', - 'StorageClass' => strlen($json) < self::$minFileSizeStandardIA ? 'STANDARD' : 'STANDARD_IA' + 'StorageClass' => 'STANDARD' ]); StatsD::timing("s3.fulltext.put", (microtime(true) - $start) * 1000); diff --git a/docker/minio/minio b/docker/minio/minio deleted file mode 100755 index e21313ba..00000000 Binary files a/docker/minio/minio and /dev/null differ diff --git a/ds.Dockerfile b/ds.Dockerfile index 114e1fb7..b055cee7 100644 --- a/ds.Dockerfile +++ b/ds.Dockerfile @@ -1,5 +1,5 @@ FROM alpine:3 AS builder - +ARG ZOTPRIME_VERSION=2 #RUN apk add gnu-libiconv --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted #ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php @@ -28,6 +28,8 @@ RUN set -eux \ FROM alpine:3 +ARG ZOTPRIME_VERSION=2 + #FROM php:8.1-alpine #FROM php:alpine COPY --from=builder /tmp/rinetd/rinetd /usr/sbin/rinetd @@ -319,10 +321,26 @@ ENV APACHE_PID_FILE=/var/run/apache2/apache2.pid ENV APACHE_RUN_DIR=/var/run/apache2 ENV APACHE_LOG_DIR=/var/log/apache2 +COPY dataserver/. /var/www/zotero/ + +RUN rm -rf /var/www/zotero/include/Zend +COPY Zend /var/www/zotero/include/Zend +COPY docker/dataserver/create-user.sh /var/www/zotero/admin/ +COPY docker/dataserver/config.inc.php /var/www/zotero/include/config/ +COPY docker/dataserver/dbconnect.inc.php /var/www/zotero/include/config/ +COPY docker/dataserver/header.inc.php /var/www/zotero/include/ +COPY docker/dataserver/Storage.inc.php /var/www/zotero/model/ +COPY docker/dataserver/FullText.inc.php /var/www/zotero/model/ +COPY docker/db/init-mysql.sh /var/www/zotero/misc/ +COPY docker/db/db_update.sh /var/www/zotero/misc/ +COPY docker/db/www.sql /var/www/zotero/misc/ +COPY docker/db/shard.sql /var/www/zotero/misc/ + + # Expose and entrypoint COPY docker/dataserver/entrypoint.sh / RUN chmod +x /entrypoint.sh -VOLUME /var/www/zotero +#VOLUME /var/www/zotero EXPOSE 80/tcp #EXPOSE 81/TCP #EXPOSE 82/TCP diff --git a/ds.Dockerfile.dockerignore b/ds.Dockerfile.dockerignore index 718d8171..7dd337b6 100644 --- a/ds.Dockerfile.dockerignore +++ b/ds.Dockerfile.dockerignore @@ -1,9 +1,13 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.env .git .github bin build client -dataserver +#dataserver doc docker/stream-server docker/minio @@ -11,6 +15,6 @@ docker-compose.yml logs stream-server tinymce-clean-server -Zend +#Zend zotprime-k8s diff --git a/es.Dockerfile b/es.Dockerfile new file mode 100644 index 00000000..d4077afa --- /dev/null +++ b/es.Dockerfile @@ -0,0 +1,7 @@ + +############################ +# elasticsearch image +############################ + +# image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0 +FROM docker.elastic.co/elasticsearch/elasticsearch:8.7.0 \ No newline at end of file diff --git a/es.Dockerfile.dockerignore b/es.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/es.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/ls.Dockerfile b/ls.Dockerfile new file mode 100644 index 00000000..892c50a3 --- /dev/null +++ b/ls.Dockerfile @@ -0,0 +1,6 @@ + +############################ +# localstack image +############################ + +FROM atlassianlabs/localstack \ No newline at end of file diff --git a/ls.Dockerfile.dockerignore b/ls.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/ls.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/m.Dockerfile b/m.Dockerfile new file mode 100644 index 00000000..2ad06618 --- /dev/null +++ b/m.Dockerfile @@ -0,0 +1,6 @@ + +############################ +# memcached image +############################ + +FROM memcached:1.5 \ No newline at end of file diff --git a/m.Dockerfile.dockerignore b/m.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/m.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/minio.Dockerfile b/minio.Dockerfile index e93ec49d..e4723d73 100644 --- a/minio.Dockerfile +++ b/minio.Dockerfile @@ -1,4 +1,10 @@ -FROM minio/minio:RELEASE.2018-10-25T01-27-03Z -COPY docker/minio /usr/bin/ -RUN chmod +x /usr/bin/minio +############################ +# minio image +############################ + +# image: minio/minio:RELEASE.2018-10-25T01-27-03Z +# image: minio/minio:RELEASE.2019-01-31T00-31-19Z +# image: minio/minio:RELEASE.2021-06-14T01-29-23Z +# image: minio/minio:RELEASE.2021-10-02T16-31-05Z +FROM minio/minio \ No newline at end of file diff --git a/minio.Dockerfile.dockerignore b/minio.Dockerfile.dockerignore index f2d7355c..a9066453 100644 --- a/minio.Dockerfile.dockerignore +++ b/minio.Dockerfile.dockerignore @@ -1,12 +1,15 @@ +**/secret.json +**/secret.txt +**/secret.yaml .git .github +.env bin build client dataserver doc -docker/dataserver -docker/stream-server +docker docker-compose.yml logs stream-server diff --git a/miniomc.Dockerfile b/miniomc.Dockerfile new file mode 100644 index 00000000..6427a64c --- /dev/null +++ b/miniomc.Dockerfile @@ -0,0 +1,6 @@ + +############################ +# mc image +############################ + +FROM minio/mc \ No newline at end of file diff --git a/miniomc.Dockerfile.dockerignore b/miniomc.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/miniomc.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/pa.Dockerfile b/pa.Dockerfile new file mode 100644 index 00000000..866e95a8 --- /dev/null +++ b/pa.Dockerfile @@ -0,0 +1,6 @@ + +############################ +# phpmyadmin image +############################ + +FROM phpmyadmin/phpmyadmin \ No newline at end of file diff --git a/pa.Dockerfile.dockerignore b/pa.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/pa.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/r.Dockerfile b/r.Dockerfile new file mode 100644 index 00000000..641c8a32 --- /dev/null +++ b/r.Dockerfile @@ -0,0 +1,6 @@ + +############################ +# redis image +############################ + +FROM redis:5.0 \ No newline at end of file diff --git a/r.Dockerfile.dockerignore b/r.Dockerfile.dockerignore new file mode 100644 index 00000000..a9066453 --- /dev/null +++ b/r.Dockerfile.dockerignore @@ -0,0 +1,19 @@ +**/secret.json +**/secret.txt +**/secret.yaml +.git +.github +.env +bin +build +client +dataserver +doc +docker +docker-compose.yml +logs +stream-server +tinymce-clean-server +Zend +zotprime-k8s + diff --git a/sts.Dockerfile b/sts.Dockerfile index 41dd92f8..d8b97828 100644 --- a/sts.Dockerfile +++ b/sts.Dockerfile @@ -1,4 +1,5 @@ FROM node:8.9-alpine +ARG ZOTPRIME_VERSION=2 RUN apk add --update --no-cache \ libc6-compat diff --git a/sts.Dockerfile.dockerignore b/sts.Dockerfile.dockerignore index 6dfd6c90..c191700e 100644 --- a/sts.Dockerfile.dockerignore +++ b/sts.Dockerfile.dockerignore @@ -1,5 +1,9 @@ .git .github +**/secret.json +**/secret.txt +**/secret.yaml +.env bin build client diff --git a/tmcs.Dockerfile b/tmcs.Dockerfile index 82d98cbb..438fc8c0 100644 --- a/tmcs.Dockerfile +++ b/tmcs.Dockerfile @@ -1,4 +1,5 @@ FROM node:7-alpine +ARG ZOTPRIME_VERSION=2 WORKDIR /usr/src/app COPY ./tinymce-clean-server . diff --git a/tmcs.Dockerfile.dockerignore b/tmcs.Dockerfile.dockerignore index 4d850219..3532cdc5 100644 --- a/tmcs.Dockerfile.dockerignore +++ b/tmcs.Dockerfile.dockerignore @@ -1,5 +1,9 @@ .git .github +**/secret.json +**/secret.txt +**/secret.yaml +.env bin build client diff --git a/zotprime-k8s/deploy/yamls/app-zotprime-streamserver-service.yaml b/zotprime-k8s/deploy/yamls/app-zotprime-streamserver-service.yaml deleted file mode 100644 index 3dfb0747..00000000 --- a/zotprime-k8s/deploy/yamls/app-zotprime-streamserver-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - creationTimestamp: null - labels: - move2kube.konveyor.io/service: zotprime-streamserver - name: zotprime-streamserver -spec: - ports: - - name: port-8081 - port: 8081 - targetPort: 81 - selector: - move2kube.konveyor.io/service: zotprime-streamserver - type: ClusterIP -status: - loadBalancer: {} diff --git a/zotprime-k8s/deploy/yamls/app-zotprime-tinymceclean-service.yaml b/zotprime-k8s/deploy/yamls/app-zotprime-tinymceclean-service.yaml deleted file mode 100644 index 81839f40..00000000 --- a/zotprime-k8s/deploy/yamls/app-zotprime-tinymceclean-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - creationTimestamp: null - labels: - move2kube.konveyor.io/service: zotprime-tinymceclean - name: zotprime-tinymceclean -spec: -# ports: -# - name: port-16342 -# port: 16342 -# targetPort: 16342 - selector: - move2kube.konveyor.io/service: zotprime-tinymceclean - type: ClusterIP -status: - loadBalancer: {} diff --git a/zotprime-k8s/deploy/yamls/db-zotprime-db.yaml b/zotprime-k8s/deploy/yamls/db-zotprime-db.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/zotprime-k8s/deploy/yamls/db-zotprime-minio-deployment.yaml b/zotprime-k8s/deploy/yamls/db-zotprime-minio-deployment.yaml deleted file mode 100644 index 4dc31951..00000000 --- a/zotprime-k8s/deploy/yamls/db-zotprime-minio-deployment.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - creationTimestamp: null - labels: - move2kube.konveyor.io/service: db-zotprime-minio - name: db-zotprime-minio -spec: - replicas: 1 - selector: - matchLabels: - move2kube.konveyor.io/service: db-zotprime-minio - strategy: {} - template: - metadata: - creationTimestamp: null - labels: - move2kube.konveyor.io/service: db-zotprime-minio - name: db-zotprime-minio - spec: - containers: - - image: localhost:32000/zotprime-k8s/db-zotprime-minio:latest - imagePullPolicy: Always - name: db-zotprime-minio - ports: - - containerPort: 9000 - resources: {} - restartPolicy: Always - securityContext: {} -status: {} diff --git a/zotprime-k8s/deploy/yamls/db-zotprime-minio-service.yaml b/zotprime-k8s/deploy/yamls/db-zotprime-minio-service.yaml deleted file mode 100644 index ebb5d67d..00000000 --- a/zotprime-k8s/deploy/yamls/db-zotprime-minio-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - creationTimestamp: null - labels: - move2kube.konveyor.io/service: db-zotprime-minio - name: db-zotprime-minio -spec: -# ports: -# - name: port-8080 -# port: 8080 -# targetPort: 8080 - selector: - move2kube.konveyor.io/service: db-zotprime-minio - type: ClusterIP -status: - loadBalancer: {} diff --git a/zotprime-k8s/deploy/yamls/zotprime-k8s-ingress.yaml b/zotprime-k8s/deploy/yamls/zotprime-k8s-ingress.yaml deleted file mode 100644 index 3ca1318a..00000000 --- a/zotprime-k8s/deploy/yamls/zotprime-k8s-ingress.yaml +++ /dev/null @@ -1,42 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - creationTimestamp: null - labels: - move2kube.konveyor.io/service: zotprime-k8s - name: zotprime-k8s -spec: - rules: - - host: localhost - http: - paths: - - backend: - service: - name: zotprime-streamserver - port: - name: port-8081 - path: /stream-server - pathType: Prefix -# - backend: -# service: -# name: zotprime-tinymceclean -# port: -# name: port-16342 -# path: /zotprime-tinymceclean -# pathType: Prefix -# - backend: -# service: -# name: zotprime-minio -# port: -# name: port-8080 -# path: / -# pathType: Prefix - - backend: - service: - name: zotprime-dataserver - port: - name: port-8080 - path: / - pathType: Prefix -status: - loadBalancer: {} diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/Chart.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/Chart.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/Chart.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/Chart.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-deployment.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-deployment.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-deployment.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-deployment.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-service.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-service.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-service.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/app-tinymce-clean-server-service.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-deployment.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-deployment.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-deployment.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-deployment.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-service.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-service.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-service.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotero-stream-server-service.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotprime-deployment.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotprime-deployment.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotprime-deployment.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotprime-deployment.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotprime-service.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotprime-service.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/app-zotprime-service.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/app-zotprime-service.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/db-zotprime-minio-deployment.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/db-zotprime-minio-deployment.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/db-zotprime-minio-deployment.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/db-zotprime-minio-deployment.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/db-zotprime-minio-service.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/db-zotprime-minio-service.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/db-zotprime-minio-service.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/db-zotprime-minio-service.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/zotprime-k8s-ingress.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/templates/zotprime-k8s-ingress.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/templates/zotprime-k8s-ingress.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/templates/zotprime-k8s-ingress.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/values-dev.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/values-dev.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/values-dev.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/values-dev.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/values-prod.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/values-prod.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/values-prod.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/values-prod.yaml diff --git a/zotprime-k8s/deploy/helm-chart/zotprime-k8s/values-staging.yaml b/zotprime-k8s/helm-chart/zotprime-k8s/values-staging.yaml similarity index 100% rename from zotprime-k8s/deploy/helm-chart/zotprime-k8s/values-staging.yaml rename to zotprime-k8s/helm-chart/zotprime-k8s/values-staging.yaml diff --git a/zotprime-k8s/scripts/buildimages.sh b/zotprime-k8s/scripts/buildimages.sh index 1cf89bb9..71de5591 100755 --- a/zotprime-k8s/scripts/buildimages.sh +++ b/zotprime-k8s/scripts/buildimages.sh @@ -39,7 +39,7 @@ ${CONTAINER_RUNTIME} build -f ds.Dockerfile -t zotprime-dataserver . echo 'building image zotprime-minio' -${CONTAINER_RUNTIME} build -f minio.Dockerfile -t db-zotprime-minio . +${CONTAINER_RUNTIME} build -f minio.Dockerfile -t zotprime-minio . echo 'building image zotprime-tinymceclean' @@ -48,7 +48,7 @@ ${CONTAINER_RUNTIME} build -f tmcs.Dockerfile -t zotprime-tinymceclean . echo 'building image zotprime-streamserver' -cd source/stream-server + ${CONTAINER_RUNTIME} build -f sts.Dockerfile -t zotprime-streamserver . cd - diff --git a/zotprime-k8s/scripts/pushimages.sh b/zotprime-k8s/scripts/pushimages.sh index c299e1d2..8fb9f81b 100755 --- a/zotprime-k8s/scripts/pushimages.sh +++ b/zotprime-k8s/scripts/pushimages.sh @@ -50,6 +50,6 @@ ${CONTAINER_RUNTIME} push ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/zotprime-tinymce echo 'pushing image db-zotprime-minio' ${CONTAINER_RUNTIME} tag zotprime-minio ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/zotprime-minio -${CONTAINER_RUNTIME} push ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/db-zotprime-minio +${CONTAINER_RUNTIME} push ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/zotprime-minio echo 'done' diff --git a/zotprime-k8s/deploy/yamls/app-zotprime-dataserver-deployment.yaml b/zotprime-k8s/yamls/dataserver/zotprime-dataserver-deployment.yaml similarity index 100% rename from zotprime-k8s/deploy/yamls/app-zotprime-dataserver-deployment.yaml rename to zotprime-k8s/yamls/dataserver/zotprime-dataserver-deployment.yaml diff --git a/zotprime-k8s/deploy/yamls/app-zotprime-dataserver-service.yaml b/zotprime-k8s/yamls/dataserver/zotprime-dataserver-service.yaml similarity index 100% rename from zotprime-k8s/deploy/yamls/app-zotprime-dataserver-service.yaml rename to zotprime-k8s/yamls/dataserver/zotprime-dataserver-service.yaml diff --git a/zotprime-k8s/yamls/db/configmap.yaml b/zotprime-k8s/yamls/db/configmap.yaml new file mode 100644 index 00000000..2ea61ce3 --- /dev/null +++ b/zotprime-k8s/yamls/db/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: db-config + namespace: zotprime +data: + mariadb-user: zotero + mariadb-databasename: zoterotest \ No newline at end of file diff --git a/zotprime-k8s/yamls/db/secret.yaml_example b/zotprime-k8s/yamls/db/secret.yaml_example new file mode 100644 index 00000000..2ce72a70 --- /dev/null +++ b/zotprime-k8s/yamls/db/secret.yaml_example @@ -0,0 +1,8 @@ +apiVersion: v1 +data: + secret.txt: TUFSSUFEQl9ST09UX1BBU1NXT1JEPXpvdGVybwpNQVJJQURCX1BBU1NXT1JEPXpvdGVyb3Rlc3QK +kind: Secret +metadata: + name: db-secret + namespace: zotprime +type: Opaque diff --git a/zotprime-k8s/yamls/db/secret/secret.txt_example b/zotprime-k8s/yamls/db/secret/secret.txt_example new file mode 100644 index 00000000..a6773e99 --- /dev/null +++ b/zotprime-k8s/yamls/db/secret/secret.txt_example @@ -0,0 +1,2 @@ +MARIADB_ROOT_PASSWORD=zotero +MARIADB_PASSWORD=zoterotest diff --git a/zotprime-k8s/yamls/db/zotprime-db-service.yaml b/zotprime-k8s/yamls/db/zotprime-db-service.yaml new file mode 100644 index 00000000..c5a8afc7 --- /dev/null +++ b/zotprime-k8s/yamls/db/zotprime-db-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: mysql + namespace: zotprime + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + labels: + apps: mysql +spec: + ports: + - port: 3306 + targetPort: 3306 + name: mariadb + selector: + apps: zotprime-db +# clusterIP: None +# publishNotReadyAddresses: True diff --git a/zotprime-k8s/yamls/db/zotprime-db.yaml b/zotprime-k8s/yamls/db/zotprime-db.yaml new file mode 100644 index 00000000..5f142235 --- /dev/null +++ b/zotprime-k8s/yamls/db/zotprime-db.yaml @@ -0,0 +1,65 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: zotprime-db + namespace: zotprime + labels: + apps: zotprime-db +spec: + serviceName: "db-service" + replicas: 1 + selector: + matchLabels: + apps: zotprime-db + template: + metadata: + labels: + apps: zotprime-db + spec: + containers: + - name: mariadb + image: localhost:32000/zotprime-db:dev + ports: + - containerPort: 3306 + name: mariadb-port + resources: + limits: + memory: 512Mi +# cpu: "1" + cpu: "0.5" + command: + - /bin/bash + - -c + args: + - set -o allexport && source tmp/_key/secret.txt && set +o allexport && /usr/local/bin/docker-entrypoint.sh mysqld + env: + - name: MARIADB_USER + valueFrom: + configMapKeyRef: + name: db-config + key: mariadb-user + - name: MARIADB_DATABASE + valueFrom: + configMapKeyRef: + name: db-config + key: mariadb-databasename + volumeMounts: + - name: datadir + mountPath: /var/lib/mysql/ + - name: db-secret + mountPath: "/tmp/_key" + securityContext: + runAsUser: 999 + runAsGroup: 999 + volumes: + - name: db-secret + secret: + secretName: db-secret + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 300M \ No newline at end of file diff --git a/zotprime-k8s/yamls/elasticsearch/zotprime-elasticsearch-service.yaml b/zotprime-k8s/yamls/elasticsearch/zotprime-elasticsearch-service.yaml new file mode 100644 index 00000000..244d5d48 --- /dev/null +++ b/zotprime-k8s/yamls/elasticsearch/zotprime-elasticsearch-service.yaml @@ -0,0 +1,15 @@ + +apiVersion: v1 +kind: Service +metadata: + name: elasticsearch + namespace: zotprime + labels: + apps: elasticsearch +spec: + ports: + - port: 9300 + name: transport + clusterIP: None + selector: + apps: zotprime-elasticsearch \ No newline at end of file diff --git a/zotprime-k8s/yamls/elasticsearch/zotprime-elasticsearch.yaml b/zotprime-k8s/yamls/elasticsearch/zotprime-elasticsearch.yaml new file mode 100644 index 00000000..7e65ba37 --- /dev/null +++ b/zotprime-k8s/yamls/elasticsearch/zotprime-elasticsearch.yaml @@ -0,0 +1,97 @@ + +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: zotprime-elasticsearch + namespace: zotprime + labels: +# component: elasticsearch + apps: zotprime-elasticsearch +spec: + selector: + matchLabels: + apps: zotprime-elasticsearch + serviceName: "elasticsearch-masterservice" + replicas: 1 + template: + metadata: + labels: +# component: elasticsearch + apps: zotprime-elasticsearch + spec: + initContainers: + - name: init-sysctl + image: busybox:1.27.2 + command: + - sysctl + - -w + - vm.max_map_count=262144 + securityContext: + privileged: true + containers: + - name: elasticsearch + image: "localhost:32000/elasticsearch:8.7.0" + env: + - name: CLUSTER_NAME + value: zotero + - name: xpack.security.enabled + value: "true" + - name: cluster.routing.allocation.disk.threshold_enabled + value: "false" + - name: discovery.type + value: single-node + - name: NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace +# - name: NODE_NAME +# valueFrom: +# fieldRef: +# fieldPath: metadata.name +# - name: NUMBER_OF_MASTERS +# value: "2" +# - name: NODE_MASTER +# value: "true" +# - name: NODE_INGEST +# value: "false" +# - name: NODE_DATA +# value: "false" +# - name: HTTP_ENABLE +# value: "false" +# - name: ES_JAVA_OPTS +# value: -Xms256m -Xmx256m + - name: PROCESSORS + valueFrom: + resourceFieldRef: + resource: limits.cpu + resources: + limits: + cpu: "0.5" +# cpu: "1" +# memory: 2Gi + memory: 512M + requests: + cpu: 100m +# cpu: "0.25" +# memory: 1500Mi + memory: 256M + ports: + - containerPort: 9300 + name: transport +# livenessProbe: +# tcpSocket: +# port: transport +# initialDelaySeconds: 120 +# periodSeconds: 10 + volumeMounts: + - name: storage + mountPath: /data + volumeClaimTemplates: + - metadata: + name: storage + spec: +# storageClassName: standard + accessModes: [ ReadWriteOnce ] + resources: + requests: + storage: 2Gi diff --git a/zotprime-k8s/yamls/k8s/ingress/zotprime-k8s-ingress.yaml b/zotprime-k8s/yamls/k8s/ingress/zotprime-k8s-ingress.yaml new file mode 100644 index 00000000..f87a7c7b --- /dev/null +++ b/zotprime-k8s/yamls/k8s/ingress/zotprime-k8s-ingress.yaml @@ -0,0 +1,68 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + creationTimestamp: null + labels: + zotprime/service: zotprime-k8s + name: zotprime-k8s + namespace: zotprime + annotations: +# nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/rewrite-target: /$1 + nginx.ingress.kubernetes.io/use-forwarded-headers: "true" +spec: + rules: + - host: zotprime.localdomain + http: + paths: + - backend: + service: + name: zotprime-streamserver + port: + name: port-8081 + path: /streamserver + pathType: Prefix +# - backend: +# service: +# name: zotprime-tinymceclean +# port: +# name: port-16342 +# path: /zotprime-tinymceclean +# pathType: Prefix + - backend: + service: + name: zotprime-minio + port: + name: port-9001 + path: /minio + pathType: Prefix + - backend: + service: + name: zotprime-dataserver + port: + name: port-8080 + path: /dataserver + pathType: Prefix +#status: +# loadBalancer: {} +--- +apiVersion: v1 +kind: Service +metadata: + name: zotprime-ingress + namespace: ingress +spec: + selector: + zotprime/service: zotprime-k8s +# name: zotprime-k8s + type: LoadBalancer + loadBalancerIP: 10.77.77.228 + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 80 + - name: https + protocol: TCP + port: 443 + targetPort: 443 \ No newline at end of file diff --git a/zotprime-k8s/yamls/k8s/namespace/zotprime-namespace.yaml b/zotprime-k8s/yamls/k8s/namespace/zotprime-namespace.yaml new file mode 100644 index 00000000..764e2f42 --- /dev/null +++ b/zotprime-k8s/yamls/k8s/namespace/zotprime-namespace.yaml @@ -0,0 +1,7 @@ +# Deploys a new Namespace for the ZotPrime +apiVersion: v1 +kind: Namespace +metadata: + name: zotprime + labels: + name: zotprime \ No newline at end of file diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/deployment.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/deployment.yaml new file mode 100644 index 00000000..a923779f --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/deployment.yaml @@ -0,0 +1,234 @@ +--- +# Source: localstack/templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: localstack + namespace: "default" + labels: + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + app.kubernetes.io/version: "latest" + app.kubernetes.io/managed-by: Helm + annotations: + +spec: + replicas: 1 + strategy: + type: RollingUpdate + selector: + matchLabels: + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + template: + metadata: + labels: + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + spec: + serviceAccountName: localstack + securityContext: + {} + containers: + - name: localstack + securityContext: + {} + image: "localstack/localstack:latest" + imagePullPolicy: IfNotPresent + ports: + - name: edge + containerPort: 4566 + protocol: TCP + - name: "ext-svc-4510" + containerPort: 4510 + protocol: TCP + - name: "ext-svc-4511" + containerPort: 4511 + protocol: TCP + - name: "ext-svc-4512" + containerPort: 4512 + protocol: TCP + - name: "ext-svc-4513" + containerPort: 4513 + protocol: TCP + - name: "ext-svc-4514" + containerPort: 4514 + protocol: TCP + - name: "ext-svc-4515" + containerPort: 4515 + protocol: TCP + - name: "ext-svc-4516" + containerPort: 4516 + protocol: TCP + - name: "ext-svc-4517" + containerPort: 4517 + protocol: TCP + - name: "ext-svc-4518" + containerPort: 4518 + protocol: TCP + - name: "ext-svc-4519" + containerPort: 4519 + protocol: TCP + - name: "ext-svc-4520" + containerPort: 4520 + protocol: TCP + - name: "ext-svc-4521" + containerPort: 4521 + protocol: TCP + - name: "ext-svc-4522" + containerPort: 4522 + protocol: TCP + - name: "ext-svc-4523" + containerPort: 4523 + protocol: TCP + - name: "ext-svc-4524" + containerPort: 4524 + protocol: TCP + - name: "ext-svc-4525" + containerPort: 4525 + protocol: TCP + - name: "ext-svc-4526" + containerPort: 4526 + protocol: TCP + - name: "ext-svc-4527" + containerPort: 4527 + protocol: TCP + - name: "ext-svc-4528" + containerPort: 4528 + protocol: TCP + - name: "ext-svc-4529" + containerPort: 4529 + protocol: TCP + - name: "ext-svc-4530" + containerPort: 4530 + protocol: TCP + - name: "ext-svc-4531" + containerPort: 4531 + protocol: TCP + - name: "ext-svc-4532" + containerPort: 4532 + protocol: TCP + - name: "ext-svc-4533" + containerPort: 4533 + protocol: TCP + - name: "ext-svc-4534" + containerPort: 4534 + protocol: TCP + - name: "ext-svc-4535" + containerPort: 4535 + protocol: TCP + - name: "ext-svc-4536" + containerPort: 4536 + protocol: TCP + - name: "ext-svc-4537" + containerPort: 4537 + protocol: TCP + - name: "ext-svc-4538" + containerPort: 4538 + protocol: TCP + - name: "ext-svc-4539" + containerPort: 4539 + protocol: TCP + - name: "ext-svc-4540" + containerPort: 4540 + protocol: TCP + - name: "ext-svc-4541" + containerPort: 4541 + protocol: TCP + - name: "ext-svc-4542" + containerPort: 4542 + protocol: TCP + - name: "ext-svc-4543" + containerPort: 4543 + protocol: TCP + - name: "ext-svc-4544" + containerPort: 4544 + protocol: TCP + - name: "ext-svc-4545" + containerPort: 4545 + protocol: TCP + - name: "ext-svc-4546" + containerPort: 4546 + protocol: TCP + - name: "ext-svc-4547" + containerPort: 4547 + protocol: TCP + - name: "ext-svc-4548" + containerPort: 4548 + protocol: TCP + - name: "ext-svc-4549" + containerPort: 4549 + protocol: TCP + - name: "ext-svc-4550" + containerPort: 4550 + protocol: TCP + - name: "ext-svc-4551" + containerPort: 4551 + protocol: TCP + - name: "ext-svc-4552" + containerPort: 4552 + protocol: TCP + - name: "ext-svc-4553" + containerPort: 4553 + protocol: TCP + - name: "ext-svc-4554" + containerPort: 4554 + protocol: TCP + - name: "ext-svc-4555" + containerPort: 4555 + protocol: TCP + - name: "ext-svc-4556" + containerPort: 4556 + protocol: TCP + - name: "ext-svc-4557" + containerPort: 4557 + protocol: TCP + - name: "ext-svc-4558" + containerPort: 4558 + protocol: TCP + - name: "ext-svc-4559" + containerPort: 4559 + protocol: TCP + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + httpGet: + path: /_localstack/health + port: edge + readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 0 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + httpGet: + path: /_localstack/health + port: edge + resources: + {} + env: + - name: DEBUG + value: "0" + - name: EXTERNAL_SERVICE_PORTS_START + value: "4510" + - name: EXTERNAL_SERVICE_PORTS_END + value: "4560" + - name: LOCALSTACK_K8S_SERVICE_NAME + value: localstack + - name: LOCALSTACK_K8S_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: LAMBDA_RUNTIME_EXECUTOR + value: "docker" + - name: LAMBDA_K8S_IMAGE_PREFIX + value: "localstack/lambda-" + - name: LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT + value: "60" + - name: OVERRIDE_IN_DOCKER + value: "1" + volumes: diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/role.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/role.yaml new file mode 100644 index 00000000..99d9b48c --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/role.yaml @@ -0,0 +1,17 @@ +--- +# Source: localstack/templates/role.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: "default" + name: localstack + labels: + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + app.kubernetes.io/version: "latest" + app.kubernetes.io/managed-by: Helm +rules: +- apiGroups: [""] # "" indicates the core API group + resources: ["pods"] + verbs: ["*"] diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/rolebinding.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/rolebinding.yaml new file mode 100644 index 00000000..439ff58a --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/rolebinding.yaml @@ -0,0 +1,21 @@ +--- +# Source: localstack/templates/rolebinding.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: localstack + namespace: "default" + labels: + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + app.kubernetes.io/version: "latest" + app.kubernetes.io/managed-by: Helm +subjects: +# You can specify more than one "subject" +- kind: ServiceAccount + name: localstack +roleRef: + kind: Role + name: localstack + apiGroup: rbac.authorization.k8s.io diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/service.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/service.yaml new file mode 100644 index 00000000..431eb1da --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/service.yaml @@ -0,0 +1,176 @@ +--- +# Source: localstack/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: localstack + namespace: "default" + labels: + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + app.kubernetes.io/version: "latest" + app.kubernetes.io/managed-by: Helm + annotations: + +spec: + type: NodePort + externalTrafficPolicy: "" + ports: + - name: edge + port: 4566 + targetPort: 4566 + nodePort: 31566 + - name: "external-service-port-4510" + port: 4510 + targetPort: "ext-svc-4510" + - name: "external-service-port-4511" + port: 4511 + targetPort: "ext-svc-4511" + - name: "external-service-port-4512" + port: 4512 + targetPort: "ext-svc-4512" + - name: "external-service-port-4513" + port: 4513 + targetPort: "ext-svc-4513" + - name: "external-service-port-4514" + port: 4514 + targetPort: "ext-svc-4514" + - name: "external-service-port-4515" + port: 4515 + targetPort: "ext-svc-4515" + - name: "external-service-port-4516" + port: 4516 + targetPort: "ext-svc-4516" + - name: "external-service-port-4517" + port: 4517 + targetPort: "ext-svc-4517" + - name: "external-service-port-4518" + port: 4518 + targetPort: "ext-svc-4518" + - name: "external-service-port-4519" + port: 4519 + targetPort: "ext-svc-4519" + - name: "external-service-port-4520" + port: 4520 + targetPort: "ext-svc-4520" + - name: "external-service-port-4521" + port: 4521 + targetPort: "ext-svc-4521" + - name: "external-service-port-4522" + port: 4522 + targetPort: "ext-svc-4522" + - name: "external-service-port-4523" + port: 4523 + targetPort: "ext-svc-4523" + - name: "external-service-port-4524" + port: 4524 + targetPort: "ext-svc-4524" + - name: "external-service-port-4525" + port: 4525 + targetPort: "ext-svc-4525" + - name: "external-service-port-4526" + port: 4526 + targetPort: "ext-svc-4526" + - name: "external-service-port-4527" + port: 4527 + targetPort: "ext-svc-4527" + - name: "external-service-port-4528" + port: 4528 + targetPort: "ext-svc-4528" + - name: "external-service-port-4529" + port: 4529 + targetPort: "ext-svc-4529" + - name: "external-service-port-4530" + port: 4530 + targetPort: "ext-svc-4530" + - name: "external-service-port-4531" + port: 4531 + targetPort: "ext-svc-4531" + - name: "external-service-port-4532" + port: 4532 + targetPort: "ext-svc-4532" + - name: "external-service-port-4533" + port: 4533 + targetPort: "ext-svc-4533" + - name: "external-service-port-4534" + port: 4534 + targetPort: "ext-svc-4534" + - name: "external-service-port-4535" + port: 4535 + targetPort: "ext-svc-4535" + - name: "external-service-port-4536" + port: 4536 + targetPort: "ext-svc-4536" + - name: "external-service-port-4537" + port: 4537 + targetPort: "ext-svc-4537" + - name: "external-service-port-4538" + port: 4538 + targetPort: "ext-svc-4538" + - name: "external-service-port-4539" + port: 4539 + targetPort: "ext-svc-4539" + - name: "external-service-port-4540" + port: 4540 + targetPort: "ext-svc-4540" + - name: "external-service-port-4541" + port: 4541 + targetPort: "ext-svc-4541" + - name: "external-service-port-4542" + port: 4542 + targetPort: "ext-svc-4542" + - name: "external-service-port-4543" + port: 4543 + targetPort: "ext-svc-4543" + - name: "external-service-port-4544" + port: 4544 + targetPort: "ext-svc-4544" + - name: "external-service-port-4545" + port: 4545 + targetPort: "ext-svc-4545" + - name: "external-service-port-4546" + port: 4546 + targetPort: "ext-svc-4546" + - name: "external-service-port-4547" + port: 4547 + targetPort: "ext-svc-4547" + - name: "external-service-port-4548" + port: 4548 + targetPort: "ext-svc-4548" + - name: "external-service-port-4549" + port: 4549 + targetPort: "ext-svc-4549" + - name: "external-service-port-4550" + port: 4550 + targetPort: "ext-svc-4550" + - name: "external-service-port-4551" + port: 4551 + targetPort: "ext-svc-4551" + - name: "external-service-port-4552" + port: 4552 + targetPort: "ext-svc-4552" + - name: "external-service-port-4553" + port: 4553 + targetPort: "ext-svc-4553" + - name: "external-service-port-4554" + port: 4554 + targetPort: "ext-svc-4554" + - name: "external-service-port-4555" + port: 4555 + targetPort: "ext-svc-4555" + - name: "external-service-port-4556" + port: 4556 + targetPort: "ext-svc-4556" + - name: "external-service-port-4557" + port: 4557 + targetPort: "ext-svc-4557" + - name: "external-service-port-4558" + port: 4558 + targetPort: "ext-svc-4558" + - name: "external-service-port-4559" + port: 4559 + targetPort: "ext-svc-4559" + selector: + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/serviceaccount.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/serviceaccount.yaml new file mode 100644 index 00000000..5b1f85a8 --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/serviceaccount.yaml @@ -0,0 +1,14 @@ +--- +# Source: localstack/templates/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: localstack + namespace: "default" + labels: + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/name: localstack + app.kubernetes.io/instance: localstack + app.kubernetes.io/version: "latest" + app.kubernetes.io/managed-by: Helm + annotations: diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/tests/test-connection.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/tests/test-connection.yaml new file mode 100644 index 00000000..5df51c23 --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/tests/test-connection.yaml @@ -0,0 +1,21 @@ +--- +# Source: localstack/templates/tests/test-connection.yaml +apiVersion: v1 +kind: Pod +metadata: + name: "localstack-test-connection" + labels: + app.kubernetes.io/name: localstack + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/instance: localstack + app.kubernetes.io/managed-by: Helm + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + containers: + - name: wget-edge + image: busybox + command: ['wget'] + args: ['-q', '--server-response', '--output-document', '-', 'localstack:4566/_localstack/health'] + restartPolicy: Never diff --git a/zotprime-k8s/yamls/localstack/localstack/templates/tests/test-s3.yaml b/zotprime-k8s/yamls/localstack/localstack/templates/tests/test-s3.yaml new file mode 100644 index 00000000..96719e1a --- /dev/null +++ b/zotprime-k8s/yamls/localstack/localstack/templates/tests/test-s3.yaml @@ -0,0 +1,27 @@ +--- +# Source: localstack/templates/tests/test-s3.yaml +apiVersion: v1 +kind: Pod +metadata: + name: "localstack-test-s3" + labels: + app.kubernetes.io/name: localstack + helm.sh/chart: localstack-0.6.0 + app.kubernetes.io/instance: localstack + app.kubernetes.io/managed-by: Helm + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + containers: + - name: awscli-s3 + image: amazon/aws-cli + args: ['--debug', '--endpoint-url', 'http://localstack:4566', 's3', 'ls'] + env: + - name: AWS_ACCESS_KEY_ID + value: test + - name: AWS_SECRET_ACCESS_KEY + value: test + - name: AWS_DEFAULT_REGION + value: us-east-1 + restartPolicy: Never diff --git a/zotprime-k8s/yamls/localstack/zotprime-localstack-service.yaml b/zotprime-k8s/yamls/localstack/zotprime-localstack-service.yaml new file mode 100644 index 00000000..921d80e9 --- /dev/null +++ b/zotprime-k8s/yamls/localstack/zotprime-localstack-service.yaml @@ -0,0 +1,27 @@ +--- +# Source: localstack/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: localstack + namespace: "zotprime" + labels: + apps: localstack +# annotations: + +spec: +# type: NodePort +# externalTrafficPolicy: "" + ports: + - name: "sns-4575" + port: 4575 + targetPort: "sns-4575" +# nodePort: 31566 + - name: "sqs-4576" + port: 4576 + targetPort: "sqs-4576" + - name: "apigateway-4567" + port: 4567 + targetPort: "apigateway-4567" + selector: + apps: zotprime-localstack diff --git a/zotprime-k8s/yamls/localstack/zotprime-localstack.yaml b/zotprime-k8s/yamls/localstack/zotprime-localstack.yaml new file mode 100644 index 00000000..be866171 --- /dev/null +++ b/zotprime-k8s/yamls/localstack/zotprime-localstack.yaml @@ -0,0 +1,242 @@ +--- +# Source: localstack/templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zotprime-localstack + namespace: "zotprime" + labels: + apps: zotprime-localstack +# annotations: + +spec: + replicas: 1 + strategy: + type: RollingUpdate + selector: + matchLabels: + apps: zotprime-localstack + + template: + metadata: + labels: + apps: zotprime-localstack + spec: +# serviceAccountName: localstack + securityContext: + {} + containers: + - name: localstack + securityContext: + {} + image: "localhost:32000/localstack:latest" + imagePullPolicy: IfNotPresent + ports: + - name: edge + containerPort: 4566 + protocol: TCP + - name: "sns-4575" + containerPort: 4575 + protocol: TCP + - name: "sqs-4576" + containerPort: 4576 + protocol: TCP + - name: "apigateway-4567" + containerPort: 4567 + protocol: TCP + - name: "ext-svc-4510" + containerPort: 4510 + protocol: TCP + - name: "ext-svc-4511" + containerPort: 4511 + protocol: TCP + - name: "ext-svc-4512" + containerPort: 4512 + protocol: TCP + - name: "ext-svc-4513" + containerPort: 4513 + protocol: TCP + - name: "ext-svc-4514" + containerPort: 4514 + protocol: TCP + - name: "ext-svc-4515" + containerPort: 4515 + protocol: TCP + - name: "ext-svc-4516" + containerPort: 4516 + protocol: TCP + - name: "ext-svc-4517" + containerPort: 4517 + protocol: TCP + - name: "ext-svc-4518" + containerPort: 4518 + protocol: TCP + - name: "ext-svc-4519" + containerPort: 4519 + protocol: TCP + - name: "ext-svc-4520" + containerPort: 4520 + protocol: TCP + - name: "ext-svc-4521" + containerPort: 4521 + protocol: TCP + - name: "ext-svc-4522" + containerPort: 4522 + protocol: TCP + - name: "ext-svc-4523" + containerPort: 4523 + protocol: TCP + - name: "ext-svc-4524" + containerPort: 4524 + protocol: TCP + - name: "ext-svc-4525" + containerPort: 4525 + protocol: TCP + - name: "ext-svc-4526" + containerPort: 4526 + protocol: TCP + - name: "ext-svc-4527" + containerPort: 4527 + protocol: TCP + - name: "ext-svc-4528" + containerPort: 4528 + protocol: TCP + - name: "ext-svc-4529" + containerPort: 4529 + protocol: TCP + - name: "ext-svc-4530" + containerPort: 4530 + protocol: TCP + - name: "ext-svc-4531" + containerPort: 4531 + protocol: TCP + - name: "ext-svc-4532" + containerPort: 4532 + protocol: TCP + - name: "ext-svc-4533" + containerPort: 4533 + protocol: TCP + - name: "ext-svc-4534" + containerPort: 4534 + protocol: TCP + - name: "ext-svc-4535" + containerPort: 4535 + protocol: TCP + - name: "ext-svc-4536" + containerPort: 4536 + protocol: TCP + - name: "ext-svc-4537" + containerPort: 4537 + protocol: TCP + - name: "ext-svc-4538" + containerPort: 4538 + protocol: TCP + - name: "ext-svc-4539" + containerPort: 4539 + protocol: TCP + - name: "ext-svc-4540" + containerPort: 4540 + protocol: TCP + - name: "ext-svc-4541" + containerPort: 4541 + protocol: TCP + - name: "ext-svc-4542" + containerPort: 4542 + protocol: TCP + - name: "ext-svc-4543" + containerPort: 4543 + protocol: TCP + - name: "ext-svc-4544" + containerPort: 4544 + protocol: TCP + - name: "ext-svc-4545" + containerPort: 4545 + protocol: TCP + - name: "ext-svc-4546" + containerPort: 4546 + protocol: TCP + - name: "ext-svc-4547" + containerPort: 4547 + protocol: TCP + - name: "ext-svc-4548" + containerPort: 4548 + protocol: TCP + - name: "ext-svc-4549" + containerPort: 4549 + protocol: TCP + - name: "ext-svc-4550" + containerPort: 4550 + protocol: TCP + - name: "ext-svc-4551" + containerPort: 4551 + protocol: TCP + - name: "ext-svc-4552" + containerPort: 4552 + protocol: TCP + - name: "ext-svc-4553" + containerPort: 4553 + protocol: TCP + - name: "ext-svc-4554" + containerPort: 4554 + protocol: TCP + - name: "ext-svc-4555" + containerPort: 4555 + protocol: TCP + - name: "ext-svc-4556" + containerPort: 4556 + protocol: TCP + - name: "ext-svc-4557" + containerPort: 4557 + protocol: TCP + - name: "ext-svc-4558" + containerPort: 4558 + protocol: TCP + - name: "ext-svc-4559" + containerPort: 4559 + protocol: TCP +# livenessProbe: +# failureThreshold: 3 +# initialDelaySeconds: 0 +# periodSeconds: 10 +# successThreshold: 1 +# timeoutSeconds: 1 +# httpGet: +# path: /_localstack/health +# port: edge +# readinessProbe: +# failureThreshold: 3 +# initialDelaySeconds: 0 +# periodSeconds: 10 +# successThreshold: 1 +# timeoutSeconds: 1 +# httpGet: +# path: /_localstack/health +# port: edge + resources: + limits: + memory: 256Mi + cpu: "0.1" + env: + - name: SERVICES + value: "sns,sqs,apigateway" + - name: DEBUG + value: "0" +# - name: EXTERNAL_SERVICE_PORTS_START +# value: "4510" +# - name: EXTERNAL_SERVICE_PORTS_END +# value: "4560" + - name: LOCALSTACK_K8S_SERVICE_NAME + value: localstack + - name: LOCALSTACK_K8S_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace +# - name: LAMBDA_RUNTIME_EXECUTOR +# value: "docker" +# - name: LAMBDA_K8S_IMAGE_PREFIX +# value: "localstack/lambda-" +# - name: LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT +# value: "60" +# - name: OVERRIDE_IN_DOCKER +# value: "1" +# volumes: diff --git a/zotprime-k8s/yamls/memcached/zotprime-memcached.yaml b/zotprime-k8s/yamls/memcached/zotprime-memcached.yaml new file mode 100644 index 00000000..85882182 --- /dev/null +++ b/zotprime-k8s/yamls/memcached/zotprime-memcached.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zotprime-memcached + namespace: zotprime + labels: + apps: zotprime-memcached +spec: + replicas: 1 + selector: + matchLabels: + apps: zotprime-memcached + template: + metadata: + name: memcached + labels: + apps: zotprime-memcached + spec: + containers: + - name: memcached + image: memcached:1.5 + resources: + limits: + cpu: 200m + memory: 2000Mi +# requests: +# cpu: 100m +# memory: 1000Mi + ports: + - containerPort: 11211 + protocol: TCP + args: + - -m 2047 + - -I 50M +# - name: memcached-exporter +# image: prom/memcached-exporter +# ports: +# - containerPort: 9150 +# protocol: TCP diff --git a/zotprime-k8s/yamls/minio/configmap.yaml b/zotprime-k8s/yamls/minio/configmap.yaml new file mode 100644 index 00000000..fb07fb61 --- /dev/null +++ b/zotprime-k8s/yamls/minio/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: minio-config + namespace: zotprime +data: + minio-user: zotero \ No newline at end of file diff --git a/zotprime-k8s/yamls/minio/secret.yaml_example b/zotprime-k8s/yamls/minio/secret.yaml_example new file mode 100644 index 00000000..bfa70dbd --- /dev/null +++ b/zotprime-k8s/yamls/minio/secret.yaml_example @@ -0,0 +1,8 @@ +apiVersion: v1 +data: + secret.txt: TUlOSU9fUk9PVF9QQVNTV09SRD16b3Rlcm9kb2NrZXIK +kind: Secret +metadata: + name: minio-secret + namespace: zotprime +type: Opaque diff --git a/zotprime-k8s/yamls/minio/secret/secret.txt_example b/zotprime-k8s/yamls/minio/secret/secret.txt_example new file mode 100644 index 00000000..96006eed --- /dev/null +++ b/zotprime-k8s/yamls/minio/secret/secret.txt_example @@ -0,0 +1 @@ +MINIO_ROOT_PASSWORD=zoterodocker diff --git a/zotprime-k8s/yamls/minio/zotprime-minio-service.yaml b/zotprime-k8s/yamls/minio/zotprime-minio-service.yaml new file mode 100644 index 00000000..93402c6b --- /dev/null +++ b/zotprime-k8s/yamls/minio/zotprime-minio-service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: +# move2kube.konveyor.io/service: zotprime-minio + app: zotprime-minio + name: zotprime-minio + namespace: zotprime +spec: + ports: + - name: port-9001 + port: 9001 + targetPort: 9001 + selector: +# move2kube.konveyor.io/service: zotprime-minio + app: zotprime-minio + type: ClusterIP +status: + loadBalancer: {} diff --git a/zotprime-k8s/yamls/minio/zotprime-minio.yaml b/zotprime-k8s/yamls/minio/zotprime-minio.yaml new file mode 100644 index 00000000..44ea261f --- /dev/null +++ b/zotprime-k8s/yamls/minio/zotprime-minio.yaml @@ -0,0 +1,76 @@ +# Deploys a new MinIO Pod into the metadata.namespace Kubernetes namespace +# +# The `spec.containers[0].args` contains the command run on the pod +# The `/data` directory corresponds to the `spec.containers[0].volumeMounts[0].mountPath` +# That mount path corresponds to a Kubernetes HostPath which binds `/data` to a local drive or volume on the worker node where the pod runs +# +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: zotprime-minio + name: zotprime-minio + namespace: zotprime # Change this value to match the namespace metadata.name +spec: + replicas: 1 + selector: + matchLabels: + apps: zotprime-minio + strategy: {} + template: + metadata: + labels: + apps: zotprime-minio + name: zotprime-minio + spec: + containers: + - name: zotprime-minio + image: quay.io/minio/minio:latest +# imagePullPolicy: Always + resources: + limits: + memory: 512Mi + cpu: "1" + command: + - /bin/bash + - -c + args: + - set -o allexport && source tmp/_key/secret.txt && set +o allexport && minio server /data --console-address :9001 +#| tee /data/test.log +# lifecycle: +# preStop: +# exec: +# command: +# - /bin/sh +# - -c +# args: ls -lha /tmp/_key/ + env: + - name: MINIO_ROOT_USER + valueFrom: + configMapKeyRef: + name: minio-config + key: minio-user + volumeMounts: + - name: localvolumeminio # Corresponds to the `spec.volumes` Persistent Volume + mountPath: /data + - name: minio-secret + mountPath: "/tmp/_key" +# subPath: secret.txt + readOnly: true + nodeSelector: + kubernetes.io/hostname: localhost.localdomain # Specify a node label associated to the Worker Node on which you want to deploy the pod. +# terminationGracePeriodSeconds: 30 + restartPolicy: Always + securityContext: {} + volumes: + - name: localvolumeminio + hostPath: # MinIO generally recommends using locally-attached volumes + path: /mnt/disk1/data # Specify a path to a local drive or volume on the Kubernetes worker node + type: DirectoryOrCreate # The path to the last directory must exist + - name: minio-secret + secret: + secretName: minio-secret +# items: +# - key: _key +# path: _key +status: {} diff --git a/zotprime-k8s/yamls/phpmyadmin/zotprime-phpmyadmin.yaml b/zotprime-k8s/yamls/phpmyadmin/zotprime-phpmyadmin.yaml new file mode 100644 index 00000000..335230ff --- /dev/null +++ b/zotprime-k8s/yamls/phpmyadmin/zotprime-phpmyadmin.yaml @@ -0,0 +1,41 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zotprime-phpmyadmin + namespace: zotprime + labels: + apps: zotprime-phpmyadmin +spec: + selector: + matchLabels: + apps: zotprime-phpmyadmin + template: + metadata: + labels: + apps: zotprime-phpmyadmin + spec: + containers: + - name: phpmyadmin + image: localhost:32000/zotprime-phpmyadmin:dev + ports: + - containerPort: 80 + resources: + limits: + memory: 256Mi + cpu: "0.1" + env: + - name: PMA_HOST + value: mysql + - name: PMA_PORT + value: "3306" +# - name: PMA_ARBITRARY +# value: "1" +# - name: PMA_ABSOLUTE_URI +# value: [uri] + +# - name: MYSQL_ROOT_PASSWORD +# valueFrom: +# secretKeyRef: +# name: mysql-secret +# key: root_password \ No newline at end of file diff --git a/zotprime-k8s/yamls/redis/configmap.yaml b/zotprime-k8s/yamls/redis/configmap.yaml new file mode 100644 index 00000000..44bd7c59 --- /dev/null +++ b/zotprime-k8s/yamls/redis/configmap.yaml @@ -0,0 +1,44 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: redis-config + namespace: zotprime +data: + redis.conf: |+ + cluster-enabled no + appendonly yes + protected-mode no + dir /data + port 6379 + +# cluster-node-timeout 15000 +# cluster-config-file /data/nodes.conf +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: redis-probes + namespace: zotprime +data: + readiness.sh: |- + #!/bin/sh + pingResponse="$(redis-cli -h localhost ping)" + if [ "$?" -eq "124" ]; then + echo "PING timed out" + exit 1 + fi + if [ "$pingResponse" != "PONG"]; then + echo "$pingResponse" + exit 1 + fi + liveness.sh: |- + #!/bin/sh + pingResponse="$(redis-cli -h localhost ping | head -n1 | awk '{print $1;}')" + if [ "$?" -eq "124" ]; then + echo "PING timed out" + exit 1 + fi + if [ "$pingResponse" != "PONG"] && [ "$pingResponse" != "LOADING" ] && [ "$pingResponse" != "MASTERDOWN" ]; then + echo "$pingResponse" + exit 1 + fi \ No newline at end of file diff --git a/zotprime-k8s/yamls/redis/zotprime-redis-service.yaml b/zotprime-k8s/yamls/redis/zotprime-redis-service.yaml new file mode 100644 index 00000000..bfa4ed30 --- /dev/null +++ b/zotprime-k8s/yamls/redis/zotprime-redis-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis + namespace: zotprime +# annotations: +# service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + labels: + apps: redis +spec: + ports: + - port: 6379 + targetPort: 6379 + name: redis + selector: + apps: zotprime-redis +# clusterIP: None +# publishNotReadyAddresses: True diff --git a/zotprime-k8s/yamls/redis/zotprime-redis.yaml b/zotprime-k8s/yamls/redis/zotprime-redis.yaml new file mode 100644 index 00000000..9b913d7d --- /dev/null +++ b/zotprime-k8s/yamls/redis/zotprime-redis.yaml @@ -0,0 +1,100 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: zotprime-redis + namespace: zotprime + labels: + apps: zotprime-redis +spec: + serviceName: "redis-service" + replicas: 1 + selector: + matchLabels: + apps: zotprime-redis + template: + metadata: + labels: + apps: zotprime-redis +# appCluster: redis-cluster + spec: + terminationGracePeriodSeconds: 20 + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - redis + topologyKey: kubernetes.io/hostname + containers: + - name: redis + image: "redis:5.0" + command: + - "redis-server" + args: + - "/conf/redis.conf" + - "--protected-mode" + - "no" + resources: + requests: + cpu: "100m" + memory: "100Mi" + ports: + - name: redis + containerPort: 6379 + protocol: "TCP" + - name: cluster + containerPort: 16379 + protocol: "TCP" + startupProbe: + periodSeconds: 5 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 20 + tcpSocket: + port: redis + livenessProbe: + periodSeconds: 5 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 5 + exec: + command: ["sh", "-c", "/probes/liveness.sh"] + readinessProbe: + periodSeconds: 5 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 5 + exec: + command: ["sh", "-c", "/probes/readiness.sh"] + volumeMounts: + - name: conf + mountPath: /conf + readOnly: false + - name: data + mountPath: /data + readOnly: false + - name: probes + mountPath: /probes + readOnly: true + volumes: + - name: conf + configMap: + name: redis-config + defaultMode: 0755 + - name: probes + configMap: + name: redis-probes + defaultMode: 0555 + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi \ No newline at end of file diff --git a/zotprime-k8s/yamls/streamserver/configmap.yaml b/zotprime-k8s/yamls/streamserver/configmap.yaml new file mode 100644 index 00000000..f2dd1e82 --- /dev/null +++ b/zotprime-k8s/yamls/streamserver/configmap.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +data: + default.js: "var os = require(\"os\");\n\n// Default config\nvar config = {\n\tdev: + false,\n\tlogLevel: 'info',\n\thostname: os.hostname().split('.')[0],\n\thttpPort: + 81,\n\tproxyProtocol: false,\n\thttps: false,\n\ttrustedProxies: [],\n\tstatusInterval: + 10,\n\tkeepaliveInterval: 25,\n\tretryTime: 10,\n\tshutdownDelay: 100,\n\tredis: + {\n\t\thost: 'redis',\n\t\tprefix: ''\n\t},\n\tapiURL: 'http://zotprime-dataserver/',\n\tapiVersion: + 3,\n\tapiRequestHeaders: {},\n\tlongStackTraces: false,\n\tglobalTopics: [\n\t\t'styles',\n\t\t'translators'\n\t],\n\t// + Minimum delay before clients should act on global topic notifications -- since + these are triggered\n\t// by webhooks or other queued notifications, they need + time to be processed elsewhere\n\tglobalTopicsMinDelay: 30 * 1000,\n\t// Notification + action period -- clients are given a randomly chosen delay within this time\n\t// + period before they should act upon the notification, so that we don't DDoS ourselves\n\tglobalTopicsDelayPeriod: + 60 * 1000,\n\tcontinuedDelayDefault: 3 * 1000,\n\tcontinuedDelay: 30 * 1000,\n\tstatsD: + {\n\t\thost: ''\n\t}\n};\n\nmodule.exports = config;\n" +kind: ConfigMap +metadata: + name: streamserver-config + namespace: zotprime \ No newline at end of file diff --git a/zotprime-k8s/yamls/streamserver/zotprime-streamserver-service.yaml b/zotprime-k8s/yamls/streamserver/zotprime-streamserver-service.yaml new file mode 100644 index 00000000..5e0b97fc --- /dev/null +++ b/zotprime-k8s/yamls/streamserver/zotprime-streamserver-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + apps: streamserver + name: streamserver + namespace: zotprime +spec: + ports: + - name: port-8081 + port: 8081 + targetPort: 81 + selector: + apps: zotprime-streamserver + type: ClusterIP +#status: +# loadBalancer: {} diff --git a/zotprime-k8s/deploy/yamls/app-zotprime-streamserver-deployment.yaml b/zotprime-k8s/yamls/streamserver/zotprime-streamserver.yaml similarity index 51% rename from zotprime-k8s/deploy/yamls/app-zotprime-streamserver-deployment.yaml rename to zotprime-k8s/yamls/streamserver/zotprime-streamserver.yaml index 8de5bc8b..1b66e5a3 100644 --- a/zotprime-k8s/deploy/yamls/app-zotprime-streamserver-deployment.yaml +++ b/zotprime-k8s/yamls/streamserver/zotprime-streamserver.yaml @@ -1,21 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - creationTimestamp: null labels: - move2kube.konveyor.io/service: zotprime-streamserver + apps: zotprime-streamserver name: zotprime-streamserver + namespace: zotprime spec: replicas: 1 selector: matchLabels: - move2kube.konveyor.io/service: zotprime-streamserver + apps: zotprime-streamserver strategy: {} template: metadata: - creationTimestamp: null labels: - move2kube.konveyor.io/service: zotprime-streamserver + apps: zotprime-streamserver name: zotprime-streamserver spec: containers: @@ -24,7 +23,18 @@ spec: name: zotprime-streamserver ports: - containerPort: 81 - resources: {} + volumeMounts: + - name: streamserver-config + mountPath: /usr/src/app/config/ + readOnly: true + resources: + limits: + memory: 256Mi + cpu: "0.1" + volumes: + - name: streamserver-config + configMap: + name: streamserver-config restartPolicy: Always securityContext: {} status: {} diff --git a/zotprime-k8s/yamls/tinymceclean/zotprime-tinymceclean-service.yaml b/zotprime-k8s/yamls/tinymceclean/zotprime-tinymceclean-service.yaml new file mode 100644 index 00000000..60a75874 --- /dev/null +++ b/zotprime-k8s/yamls/tinymceclean/zotprime-tinymceclean-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + apps: tinymceclean + name: tinymceclean + namespace: zotprime +spec: + ports: + - name: port-16342 + port: 16342 + targetPort: 16342 + selector: + apps: zotprime-tinymceclean + type: ClusterIP +#status: +# loadBalancer: {} diff --git a/zotprime-k8s/deploy/yamls/app-zotprime-tinymceclean-deployment.yaml b/zotprime-k8s/yamls/tinymceclean/zotprime-tinymceclean.yaml similarity index 66% rename from zotprime-k8s/deploy/yamls/app-zotprime-tinymceclean-deployment.yaml rename to zotprime-k8s/yamls/tinymceclean/zotprime-tinymceclean.yaml index 7c230a8e..402845f9 100644 --- a/zotprime-k8s/deploy/yamls/app-zotprime-tinymceclean-deployment.yaml +++ b/zotprime-k8s/yamls/tinymceclean/zotprime-tinymceclean.yaml @@ -1,21 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - creationTimestamp: null labels: - move2kube.konveyor.io/service: zotprime-tinymceclean + apps: zotprime-tinymceclean name: zotprime-tinymceclean + namespace: zotprime spec: replicas: 1 selector: matchLabels: - move2kube.konveyor.io/service: zotprime-tinymceclean + apps: zotprime-tinymceclean strategy: {} template: metadata: - creationTimestamp: null labels: - move2kube.konveyor.io/service: zotprime-tinymceclean + apps: zotprime-tinymceclean name: zotprime-tinymceclean spec: containers: @@ -24,7 +23,10 @@ spec: name: zotprime-tinymceclean ports: - containerPort: 16342 - resources: {} + resources: + limits: + memory: 256Mi + cpu: "0.1" restartPolicy: Always securityContext: {} status: {}