For cool melon cloud classroom ( Tencent cloud Edition ) course-tencent-cloud Provide environmental support
install docker and docker-compose
install docker, Official documents : install-docker
download docker
sudo curl -sSL https://get.daocloud.io/docker | sh
change docker The default address of the warehouse
modify /etc/docker/daemon.json file ( No, please create it yourself )
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com"
]
}
start-up docker
sudo service docker start
install docker-compose, Official documents : install-compose
download docker-compose
sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
to docker-compose Add execution permission
sudo chmod +x /usr/local/bin/docker-compose
Download the relevant code
Suppose there is a directory /home/koogua
adopt git clone Download the build code , The original name is too long , We use a short name
cd /home/koogua
git clone https://gitee.com/koogua/course-tencent-cloud-docker.git ctc-docker
adopt git clone Download project code , The original name is too long , We use a short name
cd /home/koogua/ctc-docker/html
git clone https://gitee.com/koogua/course-tencent-cloud.git ctc
Configure the operating environment
(1) Modify the build configuration
Copy build .env And modify the relevant parameters
cd /home/koogua/ctc-docker
cp .env.default .env
(2) To configure nginx Default site
There is no need to HTTPS: Copy build default.conf And modify the relevant parameters
cd /home/koogua/ctc-docker/nginx/conf.d
cp default.conf.sample default.conf
need HTTPS: Copy build default.conf And modify the relevant parameters
cd /home/koogua/ctc-docker/nginx/conf.d
cp ssl-default.conf.sample ssl-default.conf
Build a mirror image
cd /home/koogua/ctc-docker
docker-compose build
Run container
cd /home/koogua/ctc-docker
docker-compose up -d
Configure the application
Get into php Containers
docker exec -it ctc-php bash
Copy build config.php And modify the relevant parameters
cd /var/www/html/ctc/config
cp config.default.php config.php
Copy build xunsearch The configuration file
cd /var/www/html/ctc/config
cp xs.course.default.ini xs.course.ini
cp xs.group.default.ini xs.group.ini
cp xs.user.default.ini xs.user.ini
modify storage Directory read and write permissions
chmod -R 777 /var/www/html/ctc/storage
modify sitemap.xml File read and write permissions
chmod 777 /var/www/html/ctc/public/sitemap.xml
Install dependency packages
cd /var/www/html/ctc
composer install --no-dev
Database migration
cd /var/www/html/ctc
vendor/bin/phinx migrate
Perform upgrade
cd /var/www/html/ctc
php console.php upgrade
Visit website
- Manage accounts :[email protected] / 123456
- Front desk address :http://{your-domain}.com
- Backstage address :http://{your-domain}.com/admin
Follow up settings : Tencent cloud services and application settings
Test data
The new system is blank , In order to better experience the system , We provide some test data ( Collected from the network )
Be careful : The import operation will delete the initialization created table and recreate the table
Manage accounts :[email protected] / 123456
(1) Import resource file
Create a new bucket in Tencent cloud storage (bucket), And backstage -> The system configuration -> Storage settings modify relevant parameters
Download resource file , Use... After decompression COSBrowser Upload img And other relevant directory to the new bucket
(2) Import data ,mysql There is no download tool in the container , It needs to be installed
docker exec -it ctc-mysql bash
apt-get update && apt-get install curl
curl -o ctc-test.sql.gz http://download.koogua.com/ctc-test.sql.gz
gunzip < ctc-test.sql.gz | mysql -u ctc -p ctc
(3) Rebuild index
docker exec -it ctc-php bash
cd /var/www/html/ctc
php console.php course_index rebuild
php console.php group_index rebuild
php console.php user_index rebuild
(4) Perform upgrade
cd /var/www/html/ctc
php console.php upgrade