2020年4月15日水曜日

YouPHPTube(avideo)を試してみる

動画管理・・・気になってやってみたかった。
https://www.moongift.jp/2017/06/youphptube-php製のyoutubeクローン/
試すだけ、、、なのできっとDockerがいいんじゃないかなと思った。


↑はフリー素材の犬 かわいい
https://pixabay.com/ja/videos/犬-飲酒-ペット-食品-5631/

Dockerでやってみる

久しぶりです。
Docker自体のインストールもやらないとね

Docker自体のインストール

・docker-ce
https://docs.docker.com/engine/install/ubuntu/
LinuxMintの場合は、Ubuntuじゃないので、注意。
「$(lsb_release -cs)」の部分を「bionic」書き換える。
https://continue-to-challenge.blogspot.com/2019/07/redmine.html
・docker-composer
https://docs.docker.com/compose/install/

ubuntuイメージの取得

$ sudo docker pull ubuntu:18.04
18.04: Pulling from library/ubuntu
5bed26d33875: Pull complete
f11b29a9c730: Pull complete
930bda195c84: Pull complete
78bf9a5ad49e: Pull complete
Digest: sha256:bec5a2727be7fff3d308193cfde3491f8fba1a2ba392b7546b43a051853a341d
Status: Downloaded newer image for ubuntu:18.04
docker.io/library/ubuntu:18.04

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              18.04               4e5021d210f6        2 weeks ago         64.2MB
起動
$ sudo docker run -it -d --name YouPHPTube -p 127.0.0.1:10080:80 ubuntu:18.04
1e9996bda6d080f5c7697bacdefd5f0f817dc6303b15003726c2bc2cbb10178c
$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                     NAMES
1e9996bda6d0        ubuntu:18.04        "/bin/bash"         18 seconds ago      Up 17 seconds       127.0.0.1:10080->80/tcp   YouPHPTube

環境の準備

起動したコンテナにアタッチする
$ sudo docker attach 1e9996bda6d0
<コンテナ側>
apt upate
apt upgrade
これで準備OKのはず

apacheのインストール

作成したコンテナにapacheをインストールしてみる
<コンテナ側>
apt install -y apache2 apache2-utils
service apache2 start
母艦側のでlocalhost:10080にアクセスしてみる


まずはOK

MariaDBのインストール

本当は、1コンテナ(イメージ)に複数のサービスを入れるのは推奨されないみたいだけど、今回はお試しということで、詰め込んじゃう。
公式の手順では、MySQLになっているけど、なんとなくMariaDBにしてみた。
apt install mariadb-server mariadb-client
service mysql start
mysql_secure_installation
アクセスできるかな?
mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 51
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
OKそう

AVideo用のユーザー・データベース作成

データベース:AVideo
ユーザー:AVideo
mysql -u root
create database AVideo;
create user AVideo@localhost identified by '**********';
grant all privileges on AVideo.* to AVideo@localhost;
もうひとつEncoder用
データベース:AVideoEncoder
mysql -u root
create database AVideoEncoder;
grant all privileges on AVideoEncoder.* to AVideo@localhost;

その他必要なもの

apt install php libapache2-mod-php php-mysql php-curl php-gd php-intl ffmpeg git libimage-exiftool-perl php-mbstring php-gettext python curl
これで、下準備完了

YouPHPTube(AVideo)のインストール

手順書どおりにやってみる
cd /var/www/html
git clone https://github.com/WWBN/AVideo.git
git clone https://github.com/WWBN/AVideo-Encoder.git
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
chmod a+rx /usr/local/bin/youtube-dl
a2enmod rewrite
phpenmod mbstring
service apache2 restart

apacheの設定

/etc/apache2/apache2.confで AllowOverride All に変更する
<Directory /var/www/>
          Options Indexes FollowSymLinks
          AllowOverride All
          Require all granted
</Directory>
そのあと更新
a2enmod rewrite
service apache2 restart

アクセスしてみよう

母艦から
http://localhost:10080/AVideo
にアクセスしてみる


ほう。
指示に従って解決していこう

Your videos directory must be writable

「>Details」を開くとやり方が出てきた
mkdir /var/www/html/AVideo/videos
chown www-data:www-data /var/www/html/AVideo/videos && chmod 755 /var/www/html/AVideo/videos

Your post_max_size is 8M, it must be at least 100M

POSTのサイズ
nano /etc/php/7.2/apache2/php.ini
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 8M
とりあえず2Gにしてみた。

Your upload_max_filesize is 2M, it must be at least 100M

アップロードサイズ的なやつか
nano /etc/php/7.2/apache2/php.ini
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M
こちらも2Gにしてみた
変更後は、apacheの再起動を行う

セットアップを続けてみよう

あれー


もう一度やろうとすると、、起動しちゃったYO


こっちはこれでいいのかな

YouPHPTube(AVideo)-Encoder にアクセスしてみよう

セットアップウィザード

母艦から
http://localhost:10080/AVideo-Encoder
にアクセスしてみる


ほう。
指示に従って解決していこう
  • Your videos directory must be writable
  • Your max_execution_time is 30, it must be at least 7200
     とりあえず、7200にしてみた
  • Your memory_limit is 128M, it must be at least 512M
    とりあえず2Gにしてみた
これでよし


ここでのSteramerURLはDockerの中なので、**localhost:80/AVideo/**になるので注意

各種設定

基本設定

管理者でログインして
[設定]-[サイトの構成]から各種設定を行っていく

サインイン/アップ

[設定]-[一般的な設定]から
名称 説明 設定値
userMustBeLoggedIn Hide the website to non logged users 有効
doNotIndentifyByEmail Do not show user’s email on the site 有効
doNotIndentifyByUserName Do not show user’s username on the site 有効

プラグイン

[設定]-[その他]-[プラグイン]
名前 要約
Hotkeys Enable hotkeys for videos, like F for fullscreen, space for play/pause, etc…
SeekButton Add seek buttons to the control bar
VideoTags User interface for managing tags
これでしばらく使ってみようかね

コンテナの開始と終了など

忘れてたけど、まだアタッチで起動していただけだった。
アタッチで起動したものはコマンドプロンプトからCtrl+P → Ctrl+Qで抜ける
sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                     NAMES
1e9996bda6d0        ubuntu:18.04        "/bin/bash"         3 days ago          Up 3 days           127.0.0.1:10080->80/tcp   YouPHPTube

#終了
sudo docker stop 1e9996bda6d0

#開始
sudo docker start 1e9996bda6d0

#各種サービス起動
sudo docker exec -it 1e9996bda6d0 service apache2 start
sudo docker exec -it 1e9996bda6d0 service mysql start

#アタッチ
sudo docker attach 1e9996bda6d0

参考

https://github.com/WWBN/AVideo/wiki/How-to-install-LAMP,-FFMPEG-and-Git-on-a-fresh-Ubuntu-18.x-for-AVideo-Platform-version-4.x-or-newer
https://qiita.com/tsumtsumyuma/items/de7678d7f118793ea3e0
http://enakai00.hatenablog.com/entry/20140628/1403933390

0 件のコメント:

コメントを投稿