From dc49829d19c8dded34f9389cd031b04b4ef5e840 Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Tue, 4 Mar 2025 14:59:43 +0100 Subject: [PATCH] initial commit --- .gitignore | 1 + dockerized/nextcloud-aio/compose.yaml | 34 ++++++ dockerized/nextcloud-aio/docker_run.sh | 16 +++ dockerized/simple_site/Dockerfile | 14 +++ dockerized/simple_site/README.md | 4 + dockerized/simple_site/docker-compose.yaml | 25 +++++ dockerized/simple_site/index.html | 114 +++++++++++++++++++++ dockerized/simple_site/package.json | 16 +++ dockerized/simple_site/server.js | 18 ++++ 9 files changed, 242 insertions(+) create mode 100644 .gitignore create mode 100644 dockerized/nextcloud-aio/compose.yaml create mode 100644 dockerized/nextcloud-aio/docker_run.sh create mode 100644 dockerized/simple_site/Dockerfile create mode 100644 dockerized/simple_site/README.md create mode 100644 dockerized/simple_site/docker-compose.yaml create mode 100644 dockerized/simple_site/index.html create mode 100644 dockerized/simple_site/package.json create mode 100644 dockerized/simple_site/server.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/dockerized/nextcloud-aio/compose.yaml b/dockerized/nextcloud-aio/compose.yaml new file mode 100644 index 0000000..a6b1454 --- /dev/null +++ b/dockerized/nextcloud-aio/compose.yaml @@ -0,0 +1,34 @@ +version: "3.8" + +#Imported from https://github.com/nextcloud/all-in-one/discussions/575#discussion-4055615 + +services: + caddy: + image: caddy:alpine + restart: unless-stopped + container_name: caddy + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile + - ./certs:/certs + - ./config:/config + - ./data:/data + - ./sites:/srv + network_mode: "host" + + nextcloud: + image: nextcloud/all-in-one:latest + restart: unless-stopped + container_name: nextcloud-aio-mastercontainer + ports: + - "8080:8080" + environment: + - APACHE_PORT=11000 + volumes: + - nextcloud_aio_mastercontainer:/mnt/docker-aio-config + - /var/run/docker.sock:/var/run/docker.sock:ro + depends_on: + - caddy + +volumes: + nextcloud_aio_mastercontainer: + name: nextcloud_aio_mastercontainer \ No newline at end of file diff --git a/dockerized/nextcloud-aio/docker_run.sh b/dockerized/nextcloud-aio/docker_run.sh new file mode 100644 index 0000000..4f3e352 --- /dev/null +++ b/dockerized/nextcloud-aio/docker_run.sh @@ -0,0 +1,16 @@ +#! /usr/bin/bash +echo "Installing denpendency packages..." + +docker run \ +--init \ +--sig-proxy=false \ +--name nextcloud-aio-mastercontainer \ +--restart always \ +--publish 8080:8080 \ +--env APACHE_PORT=11000 \ +--env APACHE_IP_BINDING=0.0.0.0 \ +--env APACHE_ADDITIONAL_NETWORK="" \ +--env SKIP_DOMAIN_VALIDATION=false \ +--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \ +--volume /var/run/docker.sock:/var/run/docker.sock:ro \ +nextcloud/all-in-one:latest \ No newline at end of file diff --git a/dockerized/simple_site/Dockerfile b/dockerized/simple_site/Dockerfile new file mode 100644 index 0000000..5c5d2e3 --- /dev/null +++ b/dockerized/simple_site/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14 + +WORKDIR /app + +COPY server.js . +COPY index.html . +#COPY images ./images +COPY package.json . + +RUN npm install + +EXPOSE 3000 + +CMD ["node","server.js"] \ No newline at end of file diff --git a/dockerized/simple_site/README.md b/dockerized/simple_site/README.md new file mode 100644 index 0000000..d7ff83c --- /dev/null +++ b/dockerized/simple_site/README.md @@ -0,0 +1,4 @@ +Simple Site +=========== + +Simple dockerized application using Node.js behind NGINX in order to securely serve a static webapp \ No newline at end of file diff --git a/dockerized/simple_site/docker-compose.yaml b/dockerized/simple_site/docker-compose.yaml new file mode 100644 index 0000000..d6faef0 --- /dev/null +++ b/dockerized/simple_site/docker-compose.yaml @@ -0,0 +1,25 @@ +version: '3' +services: + +# 3 versions of the same app responding to host's 3001-3 + app1: + build: . + environment: + - APP_NAME=App1 + ports: + - "3001:3000" + + app2: + build: . + environment: + - APP_NAME=App2 + ports: + - "3002:3000" + + app3: + build: . + environment: + - APP_NAME=App3 + ports: + - "3003:3000" + diff --git a/dockerized/simple_site/index.html b/dockerized/simple_site/index.html new file mode 100644 index 0000000..73e9c52 --- /dev/null +++ b/dockerized/simple_site/index.html @@ -0,0 +1,114 @@ + + + + + + + Beautiful Landing Page + + + + +
+
+ +
+

TechWorld with Nana Programs

+
+
+ Service 1 +

DevOps Bootcamp

+

Finally learn with structured guided course, all DevOps tools together

+
+
+ Service 2 +

Software Development LifeCycle Course

+

Learn the entire software Development lifecycle, from developing, to testing, to provisioning server and deploying

+
+
+ Service 3 +

DevSecOps Bootcamp

+

If you wanna become a DevOps engineer on steroids, you can face this advanced bootcamp

+
+
+
+ + + + diff --git a/dockerized/simple_site/package.json b/dockerized/simple_site/package.json new file mode 100644 index 0000000..b3f2d9c --- /dev/null +++ b/dockerized/simple_site/package.json @@ -0,0 +1,16 @@ +{ + "name": "simple_site", + "version": "1.0.0", + "description": "A Node.js application serving a static HTML file, used for load balancing with NGINX.", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "author": "Fabio Sinibaldi", + "license": "MIT", + "dependencies": { + "express": "^4.17.1", + "path": "^0.12.7" + } + } + \ No newline at end of file diff --git a/dockerized/simple_site/server.js b/dockerized/simple_site/server.js new file mode 100644 index 0000000..57780e7 --- /dev/null +++ b/dockerized/simple_site/server.js @@ -0,0 +1,18 @@ +const express = require('express'); +const path = require('path'); +const app = express(); +const port = 3000; + +// Defined in compose file +const appName = process.env.APP_NAME + +app.use('/images', express.static(path.join(__dirname, 'images'))); + +app.use('/', (req, res) => { + res.sendFile(path.join(__dirname, 'index.html')); + console.log(`Request served by ${appName}`); +}); + +app.listen(port, () => { + console.log(`${appName} is listening on port ${port}`); +});