Deploy v2board with docker locally on Macbook for testing - naiping2023/v2board-docker GitHub Wiki

Prerequisite

Install Docker Desktop

Download Docker Desktop from https://docs.docker.com/desktop/install/mac-install/ and install (The version is 4.25.2 (129061) when I'm writing)

Create a System link to Docker Compose

(The docker-compose has been installed together with docker)

ln -s /Applications/Docker.app/Contents/Resources/bin/docker-compose /usr/local/bin/dc

Install v2board

clone the repository

git clone https://github.com/naiping2023/v2board-docker
mv v2board-docker v2b

config submodule

cd v2b/
git submodule update --init
echo '  branch = master' >> .gitmodules
git submodule update --remote

Modify docker-compose.yaml

version: '3'
services:
  www:
    image: tokumeikoi/lcrp
    volumes:
      - './www:/www'
      - './wwwlogs:/wwwlogs'
      - './caddy.conf:/run/caddy/caddy.conf'
      - './supervisord.conf:/run/supervisor/supervisord.conf'
      - './crontabs.conf:/etc/crontabs/root'
      - './.caddy:/root/.caddy'
    ports:
      - '80:80'
      - '443:443'
    restart: always
+   links:
+     - mysql
  mysql:
    image: mysql:5.7.29
    volumes:
      - './mysql:/var/lib/mysql'
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: <your db password>
      MYSQL_DATABASE: v2b

Update caddy.conf (suppose your IP address is 172.16.9.202)

http://localhost {
   root /www/public
   fastcgi / /tmp/php-cgi.sock php
    rewrite {
        to {path} {path}/ /index.php?{query}
    }
}
http://172.16.9.202 {
   root /www/public
   fastcgi / /tmp/php-cgi.sock php
    rewrite {
        to {path} {path}/ /index.php?{query}
    }
}

Install

start docker

dc up -d

Go into container

dc exec www bash

Config & install

wget https://getcomposer.org/download/1.9.0/composer.phar
php composer.phar global require hirak/prestissimo
php -d memory_limit=-1 composer.phar install
php artisan v2board:install

There should be prompts in the screen, Config as the following:

__     ______  ____                      _
\ \   / /___ \| __ )  ___   __ _ _ __ __| |
 \ \ / /  __) |  _ \ / _ \ / _` | '__/ _` |
  \ V /  / __/| |_) | (_) | (_| | | | (_| |
   \_/  |_____|____/ \___/ \__,_|_|  \__,_|
 请输入数据库地址(默认:localhost) [localhost]:
 > mysql
 请输入数据库名:
 > v2b
 请输入数据库用户名:
 > root
 请输入数据库密码:
 > <type the password you set in the docker-compose.yaml above>
正在导入数据库请稍等...
数据库导入完成
 请输入管理员邮箱?:
 > [email protected]
 请输入管理员密码?:
 > 12345678
一切就绪
管理员邮箱:xxxx
管理员密码:xxxx
访问 http(s)://你的站点/897890 进入管理面板,你可以在用户中心修改你的密码。

Save above info (email, password, url). Then you should be able to login the admin console with above info later.

Start horizon (within the www container)

php artisan horizon &

Upgrade (optional)

dc exec www bash
sh update.sh
php artisan horizon &

Misc

clean log

After v2borad running for a few days, you may notice the available disc become low, it's very likely due to the log of laravel. Then you remove the log (if not needed)

dc exec www bash
cd storage/logs
rm *