commit 5f63b7143b971e72656853fc1b446f658c2ae5f6 Author: Artem Anufrij Date: Wed Feb 8 12:33:50 2023 +0100 move diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 0000000..4036355 --- /dev/null +++ b/.env.production.example @@ -0,0 +1,2 @@ +# YOU INSTANCE DOMAIN +DOMAIN=example.com \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dce466c --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/cache +/database +/music +/uploads +/videos +.env.production \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a0fdc66 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# Setup your own WebPlay instance + +## Requirements +For run WebPlay as a docker container you need: +* docker +* docker-compose + +installed on your server/computer + +## Clone this repository +* `git clone https://gitea.com/WebPlay/docker.git webplay` + +Change into folder +* `cd webplay` + +Run docker-compose build +* `docker-compose build` + +### Important +Open `docker-compose.yml` file and edit following lines: +``` +volumes: + - ./videos:/webplay/videos + - ./music:/webplay/music + - ./cache:/webplay/cache + - ./uploads:/webplay/uploads +``` +as example: +``` +volumes: + - /path/to/your/video/files:/webplay/videos + - /path/to/your/audio/files:/webplay/music + - /path/for/cache:/webplay/cache + - /path/for/manual/uploads:/webplay/uploads +``` + +Optional you can change the client port (8081 by default): +``` +ports: + - 8081:80 +``` + +Start your instance +* `docker-compose up` or `docker-compose up -d` for running WebPlay in background + +Open your browser and navigate to WebPlay +* `http://YOURSERVERADRESS:8081` + +That's it. + +Have fun + +## Support +Join our Matrix room: #WebPlay:matrix.anufrij.de \ No newline at end of file diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..9bf7be9 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,17 @@ +FROM node:lts-alpine as build-client + +RUN echo "Build WebPlay Client" +RUN apk update +RUN apk add git +RUN git clone https://gitea.com/WebPlay/client.git && cd client +RUN sed -i '/"electron":/d' client/package.json +RUN sed -i '/"electron-builder":/d' client/package.json +RUN sed -i '/"express":/d' client/package.json + +RUN cd client && npm install +RUN cd client && npm run build + +FROM nginx:alpine + +COPY --from=build-client /client/dist /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/conf.d/default.conf diff --git a/client/nginx.conf b/client/nginx.conf new file mode 100644 index 0000000..45c7b41 --- /dev/null +++ b/client/nginx.conf @@ -0,0 +1,20 @@ +server { + listen 80; + root /usr/share/nginx/html; + client_max_body_size 2G; + location /.well-known { + resolver 127.0.0.11; + proxy_set_header Host $http_host; + proxy_pass http://server:31204/well-known; + } + location /api { + resolver 127.0.0.11; + proxy_set_header Host $http_host; + proxy_pass http://server:31204/api; + } + location /users { + resolver 127.0.0.11; + proxy_set_header Host $http_host; + proxy_pass http://server:31204/users; + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7210125 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +version: "3" +services: + database: + image: mongo:4.4 + restart: always + volumes: + - ./database:/data/db + + redis: + image: redis:alpine + restart: always + + server: + build: server/. + image: artemanufrij/webplay-server:latest + restart: always + env_file: .env.production + working_dir: /server + command: bash -c "node ./server.js" + ports: + - "31204:31204" + volumes: + - ./videos:/webplay/videos + - ./music:/webplay/music + - ./cache:/webplay/cache + - ./uploads:/webplay/uploads + depends_on: + - database + - redis + links: + - redis + - database + + client: + build: client/. + image: artemanufrij/webplay-client:latest + restart: always + ports: + - 8081:80 + depends_on: + - server \ No newline at end of file diff --git a/docker-rebuild.sh b/docker-rebuild.sh new file mode 100644 index 0000000..2bad1b0 --- /dev/null +++ b/docker-rebuild.sh @@ -0,0 +1,6 @@ +#/bin/sh +docker-compose build --no-cache +docker-compose down +docker-compose up -d +docker image prune -af +docker volume prune -f \ No newline at end of file diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..5a085cb --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,8 @@ +FROM node:lts + +RUN echo "Build WebPlay Server" +RUN apt update +RUN apt install -y --no-install-recommends ffmpeg lame +RUN git clone https://gitea.com/WebPlay/server.git && cd server && npm install + +WORKDIR /server