subugoe / typo3-find

TYPO3 extension providing a frontend for Solr indexes.
GNU General Public License v2.0
16 stars 20 forks source link

how to setup a typo3-find demo for students? #121

Open felixlohmeier opened 7 years ago

felixlohmeier commented 7 years ago

I have used typo3-find in a workshop at an university recently and wonder how to provide an easy to use and extensive installation manual for Solr, TYPO3 and TYPO3-find.

That's what I have got so far:

Clean install of Solr, TYPO3 and TYPO3-find with VirtualBox, TurnKey Core 14.1 (Debian 8.4) and Docker

Tested versions:
Solr 6.3.0
TYPO3 7.6.5
TYPO3-find 3.0.0
VirtualBox 5.1.12
TurnKey Core 14.1 (Debian 8.4)
Docker 1.12.5

1. Download TurnKey Core 14.1 (Debian 8.4)

https://www.turnkeylinux.org/download?file=turnkey-core-14.1-jessie-amd64.ova

2. Import Appliance in VirtualBox

Open VirtualBox Manager
Menu File / Import Appliance...
Browse to downloaded file
Change Name to TYPO3-find
Select Guest OS Type Linux/Ubuntu (64-bit)
Change RAM to 1024 MB
Click checkbox "Reinitialize the MAC address of all network cards"
Click button "Import"

3. Boot virtual machine

Click button "Start" in VirtualBox Manager
A new window opens, wait until there is a prompt for root password
Choose a root password
Skip TurnKeyHub services
Skip TurnKey mail notification
Install security updates
After reboot there is a welcome screen that shows the ip address of your machine

4. Connect via SSH

Connect with your favorite SSH client (Windows: e.g. Putty www.putty.org / Mac OS X: Terminal / Linux: Terminal)
ssh root@<ip address>:22

5. Install Docker

echo "deb http://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

apt-get update
apt-get install docker-engine

service docker start

6. Install Solr, create core and load example data

docker run --name my_solr -d -p 8983:8983 -t solr

docker exec -it --user=solr my_solr bin/solr create_core -c gettingstarted

docker exec -it --user=solr my_solr bin/post -c gettingstarted example/exampledocs/manufacturers.xml

8. Install TYPO3

docker run -d --name typo3-db \
    -e MYSQL_ROOT_PASSWORD=yoursupersecretpassword \
    -e MYSQL_USER=typo3 \
    -e MYSQL_PASSWORD=yourothersupersecretpassword \
    -e MYSQL_DATABASE=typo3 \
  mariadb:latest \
    --character-set-server=utf8 \
    --collation-server=utf8_unicode_ci

docker run -d --name typo3-web \
    --link typo3-db:db \
    --link my_solr \
    -p 80:80 \
  martinhelmich/typo3:7

Open http://<ip address> in browser on host machine
Finish install assistant with the following credentials...
Step 2:
- Username: typo3
- Password: yourothersupersecretpassword
- Host: typo3-db
Step 3:
- Use an existing empty database: typo3
Step 4:
- Choose username and password für TYPO3 backend
Step 5:
- Yes, download the list of distributions
Login to TYPO3 backend with your credentials
Click install button for "The official Introduction Package"

9. Download extension, install php5 and composer

git clone https://github.com/subugoe/typo3-find.git

apt-get install php5

cd typo3-find
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar install

apt-get update
apt-get --purge autoremove php5

10. Install extension in docker container

docker exec typo3-web mkdir /var/www/html/typo3/ext
docker cp . typo3-web:/var/www/html/typo3/ext/find
docker exec typo3-web chown www-data:www-data /var/www/html/typo3/ext/find

11. Activate TYPO3-find in TYPO3 backend

Open http://<ip address>/typo3 in browser on host machine
Menu Extensions
Click cube-button near extension "Find"

12. Insert find plugin in start page

Menu Page
Navigate to page "Congratulations"
Delete the following container (trash button): "Start browsing", "Example Pages", "Test the CMS", "Divider", "Make it your own"
Click button "+Content" in section "Normal"
- Tab Plugins / select General Plugin
- Selected Plugin: Find
- Click save button

13. Configure find plugin

Menu Template
Choose Info/Modify in pulldown menu on top of the page
Click button "Edit the whole template record"
Tab Includes: click on "Find (find)" in "Available items"
Tab General: Paste the following text in the textarea under headline "Setup" and click save button on top of the page

plugin.tx_find.settings {
        connections {
                default {
                        options {
                                host = my_solr
                                port = 8983
                                path = /solr/gettingstarted
                        }
                }
        }
        standardFields {
                title = compName_s
                snippet = address_s
        }
        facets {
                10 {
                        id = compName_s
                        field = compName_s
                        sortOrder = count
                }
                20 {
                        id = address_s
                        field = address_s
                        sortOrder = count
        }
}

14. Check results

Open http://<ip address> in browser on host machine

15. Configure VM to start services on startup

sed -i '/eth0/s/#//g' /etc/confconsole/confconsole.conf

echo -e "
Website:    http://\$ipaddr
TYPO3:      http://\$ipaddr/typo3
Solr:       http://\$ipaddr:8983" \
>> /etc/confconsole/services.txt

echo -e "[Unit]
Description=Solr
Requires=docker.service
After=docker.service\n
[Service]
ExecStart=/usr/bin/docker start -a my_solr
ExecStop=/usr/bin/docker stop my_solr\n
[Install]
WantedBy=default.target" \
> /etc/systemd/system/solr.service

echo -e "[Unit]
Description=TYPO3 database
Requires=docker.service
After=docker.service\n
[Service]
ExecStart=/usr/bin/docker start -a typo3-db
ExecStop=/usr/bin/docker stop typo3-db\n
[Install]
WantedBy=default.target" \
> /etc/systemd/system/typo3-db.service

echo -e "[Unit]
Description=TYPO3 website
Requires=docker.service solr.service typo3-db.service
After=docker.service solr.service typo3-db.service\n
[Service]
ExecStart=/usr/bin/docker start -a typo3-web
ExecStop=/usr/bin/docker stop typo3-web
ExecStopPost=/usr/bin/docker stop -t 5 typo3-db
ExecStopPost=/usr/bin/docker stop -t 5 my_solr\n
[Install]
WantedBy=default.target" \
> /etc/systemd/system/typo3-web.service

systemctl daemon-reload
systemctl enable solr.service
systemctl enable typo3-db.service
systemctl enable typo3-web.service

reboot

Unfortunately there are some javascript problems, e.g. the "show all" function of the facets does not work. Maybe there are conflicts between the bootstrap framework of the introduction package and the typo3-find assets?

Here is the corresponding vm appliance if you want to have a look at it: TYPO3-find.ova (1.5 GB)

felixlohmeier commented 7 years ago

see also: typo3-find-distribution from @cedricziel https://github.com/cedricziel/typo3-find-distribution prerequisites: composer and docker-compose