From ee811a657451920c1781b49ca7aa159728ff26ec Mon Sep 17 00:00:00 2001 From: kev Date: Sun, 10 Jul 2016 15:46:09 +0800 Subject: [PATCH] add mediagoblin --- README.md | 3 +- mediagoblin/Dockerfile | 91 ++++++++++++++++++++++++++++++++++ mediagoblin/README.md | 34 +++++++++++++ mediagoblin/docker-compose.yml | 11 ++++ mediagoblin/nginx.conf | 63 +++++++++++++++++++++++ 5 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 mediagoblin/Dockerfile create mode 100644 mediagoblin/README.md create mode 100644 mediagoblin/docker-compose.yml create mode 100644 mediagoblin/nginx.conf diff --git a/README.md b/README.md index 841d680..366c799 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ A collection of delicious docker recipes. - [x] ffserver :beetle: - [x] icecast - [x] live555 +- [x] mediagoblin - [x] minidlna - [x] murmur - [x] plex :moneybag: @@ -105,6 +106,7 @@ A collection of delicious docker recipes. - [x] tesseract - [x] youtube-dl - [x] youtube-worker :beetle: +- [x] zoneminder ## Web @@ -135,7 +137,6 @@ A collection of delicious docker recipes. - [x] phpvirtualbox-arm - [x] piwik - [x] revive -- [x] zoneminder ## Security diff --git a/mediagoblin/Dockerfile b/mediagoblin/Dockerfile new file mode 100644 index 0000000..bbc3140 --- /dev/null +++ b/mediagoblin/Dockerfile @@ -0,0 +1,91 @@ +# +# Dockerfile for mediagoblin +# + +FROM debian:jessie +MAINTAINER kev + +RUN set -xe \ + && apt-get update \ + && apt-get install -y automake \ + gir1.2-gst-plugins-base-1.0 \ + gir1.2-gstreamer-1.0 \ + git-core \ + gstreamer1.0-libav \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-tools \ + libasound2-dev \ + libgstreamer-plugins-base1.0-dev \ + libsndfile1-dev \ + nginx \ + nodejs-legacy \ + npm \ + poppler-utils \ + python \ + python-dev \ + python-gi \ + python-gst-1.0 \ + python-gst-1.0 \ + python-imaging \ + python-lxml \ + python-numpy \ + python-scipy \ + python-virtualenv \ + python3-gi \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +RUN set -xe \ + && useradd -d /var/lib/mediagoblin -m -r -g www-data mediagoblin \ + && groupadd -r mediagoblin \ + && usermod -a -G mediagoblin mediagoblin \ + && mkdir -p /var/log/mediagoblin \ + /srv/mediagoblin.example.org/mediagoblin \ + && chown -hR mediagoblin:www-data /var/log/mediagoblin \ + /srv/mediagoblin.example.org \ + && echo 'mediagoblin ALL=(ALL:ALL) NOPASSWD: /usr/sbin/nginx, /bin/chown' >> /etc/sudoers + +USER mediagoblin + +WORKDIR /srv/mediagoblin.example.org/mediagoblin + +RUN set -xe \ + && git clone http://git.savannah.gnu.org/r/mediagoblin.git . \ + && git checkout stable \ + && git submodule sync \ + && git submodule update --force --init --recursive \ + && ./bootstrap.sh \ + && ./configure \ + && make \ + && bin/easy_install flup==1.0.3.dev-20110405 \ + && bin/pip install scikits.audiolab \ + && ln -s /var/lib/mediagoblin user_dev \ + && cp -av mediagoblin.ini mediagoblin_local.ini \ + && cp -av paste.ini paste_local.ini \ + && sed -i 's@.*sql_engine = .*@sql_engine = sqlite:////var/lib/mediagoblin/mediagoblin.db@' mediagoblin_local.ini \ + && { \ + echo '[[mediagoblin.media_types.video]]'; \ + echo '[[mediagoblin.media_types.audio]]'; \ + echo '[[mediagoblin.media_types.pdf]]'; \ + } >> mediagoblin_local.ini + +COPY nginx.conf /etc/nginx/sites-enabled/default + +VOLUME /var/lib/mediagoblin + +EXPOSE 80 + +ENV MG_USER admin +ENV MG_PASS admin +ENV MG_MAIL admin@easypi.info + +CMD set -xe \ + && sudo nginx \ + && sudo chown -hR mediagoblin:www-data /var/lib/mediagoblin \ + && bin/gmg dbupdate \ + && bin/gmg adduser --username "${MG_USER}" --password "${MG_PASS}" --email "${MG_MAIL}" \ + && bin/gmg makeadmin "${MG_USER}" \ + && ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 diff --git a/mediagoblin/README.md b/mediagoblin/README.md new file mode 100644 index 0000000..c4c9084 --- /dev/null +++ b/mediagoblin/README.md @@ -0,0 +1,34 @@ +mediagoblin +=========== + +[MediaGoblin][1] is a free software media publishing platform that anyone can +run. You can think of it as a decentralized alternative to Flickr, YouTube, +SoundCloud, etc. + +## docker-compose.yml + +```yaml +mediagoblin: + image: vimagick/mediagoblin + ports: + - "8080:80" + volumes: + - ./data:/var/lib/mediagoblin + environment: + - MG_USER=admin + - MG_PASS=admin + - MG_MAIL=admin@easypi.info + restart: always +``` + +## up and running + +```bash +# start service +$ docker-compose up -d + +# open browser +$ firefox http://localhost:8080/ +``` + +[1]: http://mediagoblin.org/ diff --git a/mediagoblin/docker-compose.yml b/mediagoblin/docker-compose.yml new file mode 100644 index 0000000..90dc3fc --- /dev/null +++ b/mediagoblin/docker-compose.yml @@ -0,0 +1,11 @@ +mediagoblin: + image: vimagick/mediagoblin + ports: + - "8080:80" + volumes: + - ./data:/var/lib/mediagoblin + environment: + - MG_USER=admin + - MG_PASS=admin + - MG_MAIL=admin@easypi.info + restart: always diff --git a/mediagoblin/nginx.conf b/mediagoblin/nginx.conf new file mode 100644 index 0000000..c64da8c --- /dev/null +++ b/mediagoblin/nginx.conf @@ -0,0 +1,63 @@ +server { + ################################################# + # Stock useful config options, but ignore them :) + ################################################# + include /etc/nginx/mime.types; + + autoindex off; + default_type application/octet-stream; + sendfile on; + + # Gzip + gzip on; + gzip_min_length 1024; + gzip_buffers 4 32k; + gzip_types text/plain application/x-javascript text/javascript text/xml text/css; + + ##################################### + # Mounting MediaGoblin stuff + # This is the section you should read + ##################################### + + # Change this to update the upload size limit for your users + client_max_body_size 800m; + + # prevent attacks (someone uploading a .txt file that the browser + # interprets as an HTML file, etc.) + add_header X-Content-Type-Options nosniff; + + server_name mediagoblin.example.org www.mediagoblin.example.org; + access_log /var/log/nginx/mediagoblin.example.access.log; + error_log /var/log/nginx/mediagoblin.example.error.log; + + # MediaGoblin's stock static files: CSS, JS, etc. + location /mgoblin_static/ { + alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/; + } + + # Instance specific media: + location /mgoblin_media/ { + alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/; + } + + # Theme static files (usually symlinked in) + location /theme_static/ { + alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/; + } + + # Plugin static files (usually symlinked in) + location /plugin_static/ { + alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/; + } + + # Mounting MediaGoblin itself via FastCGI. + location / { + fastcgi_pass 127.0.0.1:26543; + include /etc/nginx/fastcgi_params; + + # our understanding vs nginx's handling of script_name vs + # path_info don't match :) + fastcgi_param PATH_INFO $fastcgi_script_name; + fastcgi_param SCRIPT_NAME ""; + } +}