shannah / swete

Web Internationalization Proxy
GNU General Public License v3.0
13 stars 7 forks source link

User guide #15

Open simonpalmer123 opened 4 years ago

simonpalmer123 commented 4 years ago

Hi Steve, I've been trying to get this to work on my kit on Ubuntu 18.4 Neither the default mysql-server or mariadb-server work (two different probelms with the default databases) I successfully used mariadb 10.4

Here are my install notes if it's useful:

packages:

apt install unzip php-mbstring php-mysql apache2 libapache2-mod-php php-xml mariadb-server -y

Get swete:

cd /var/www/html git clone https://github.com/shannah/swete.git cd swete/bin ./setup.sh

SQL:

mysql -uroot -p create database website; create user website@localhost identified by 'password'; grant all privileges on website.* to website@localhost; flush privileges;

Set up swete to connect to the db

cd /var/www/html/swete/ cp swete-admin/conf.db.ini.sample swete-admin/conf.db.ini

edit the db config file

sed -i 's/database username here/website/' swete-admin/conf.db.ini sed -i 's/database name here/website/' swete-admin/conf.db.ini

Permissions for the templates_c and livecache

chown www-data:www-data /var/www/html/swete/swete-admin/templates_c chown www-data:www-data /var/www/html/swete/swete-admin/livecache chmod 1777 swete-admin/templates_c swete-admin/livecache

But:

with the ubuntu 18.4 mariadb-server 10.1 I get an error: PHP Fatal error: Uncaught Exception: Specified key was too long; max key length is 767 Apparently I need 10.2 or above apt remove mariadb-server follow https://tecadmin.net/install-mariadb-10-on-ubuntu/ apt install mariadb-server and I can log into the Swete web interface. a2enmod rewrite systemctl restart apache2

The website proxying doesn't seem to work for me now... Any hints? Thanks, Simon

shannah commented 4 years ago

Can you elaborate on "proxying doesn't seem to work"? Did you set up a site? What happens when you try to view that site? Blank page? Just not translated? etc..

simonpalmer123 commented 4 years ago

I set up a test site in swete, I added a language: Welsh (cy),

Website url | http://www.bbc.co.uk Publish Host | cybbc Added cybbc to my hosts file - to point at the swete serer When I isit http://cybbc - I see the apache docs page

shannah commented 4 years ago

You need to add the cybbc as an alias in the VirtualHost definition for your swete site in the apache config file.

simonpalmer123 commented 4 years ago

Thanks for this help, apologies, I'm for not understanding this. Something like this: Alias "cybbc" "/var/www/html" I haven't got a VirtualHost definition for swete seperately from the 000-default.conf - do I need one?

shannah commented 4 years ago

If you're able to reach the swete administration app, then you must have a VirtualHost definition somewhere in your Apache config. What URL do you go to to access your swete admin dashboard (e.g. http:///swete-admin/index.php)

simonpalmer123 commented 4 years ago

I just have the default apache config - I get to it: http://172.16.32.135/swete/swete-admin/index.php

shannah commented 4 years ago

OK. Then you need to set up a virtual host for your cybbc hostname so that it knows to map that to the /swete directory rather than the root.
https://github.com/shannah/swete/blob/master/docs/phparch_article/page.markdown#step-5-optional-setup-dns-and-virtual-host

In your case the ServerName would be "cybbc", and you wouldn't necessarily need the ServerAlias directive. If you add additional sites, you could add them in the ServerAlias directive.

Remember to restart apache after adding this

simonpalmer123 commented 4 years ago

cybbc.conf now has: <VirtualHost *:80> ServerAdmin info@example.com DocumentRoot /var/www/html/swete ServerName cybbc ServerAlias cybbc ErrorLog /var/log/apache2/cybbc-error_log CustomLog /var/log/apache2/cybbc-access_log common

but, when I hit http://cybbc - I still get the swete/ home directory listings.

the .htaccess is as the software default: /var/www/html/swete/.htaccess RewriteEngine On

RewriteRule .* - [E=USE_HTML5_SERIALIZER:1]

RewriteRule ^$ index.php RewriteRule ^swete-admin/ - [L,NC] RewriteRule . swete-admin/index.php?-action=swete_handle_request [L]

Thanks,

shannah commented 4 years ago

You may need to:

  1. Install mod_rewrite if it isn't already installed.
  2. Add "AllowOverride All" to the virtualhost definition.
simonpalmer123 commented 4 years ago

Ah, that's better. Blank page, and apache error: Uncaught Error: Call to undefined function curl_init() apt install php-curl systemctl restart apache2 Much better. Huge thanks for the help, I'll have a play.

goldyliang commented 3 years ago

Hi,

This sounds like a very great project. I tried to set it up for trial, but I got below error when accessing swete-admin/index.php:

==> /var/log/apache2/error.log <== [Thu Feb 18 22:28:34.260819 2021] [:error] [pid 17789] [client 135.0.248.253:55577] Error performing mysql query to get column information from table 'dashboard'. The mysql error returned was : 'Table 'swete.dashboard' doesn't exist [Thu Feb 18 22:28:34.260925 2021] [:error] [pid 17789] [client 135.0.248.253:55577] PHP Fatal error: Uncaught exception 'Exception' with message 'Error performing mysql query to get column information from table 'dashboard'. The mysql error returned was : 'Table 'swete.dashboard' doesn't exist' in /home/ubuntu/.swete/swete-admin/xataface/Dataface/Table.php:651\nStack trace:\n#0 /home/ubuntu/.swete/swete-admin/xataface/Dataface/Table.php(502): Dataface_Table->__construct('dashboard', Object(mysqli), false)\n#1 /home/ubuntu/.swete/swete-admin/xataface/actions/clear_cache.php(31): Dataface_Table::loadTable('dashboard')\n#2 /home/ubuntu/.swete/swete-admin/xataface/public-api.php(311): dataface_actions_clear_cache->clear_cache(Array)\n#3 /home/ubuntu/.swete/swete-admin/xataface/actions/install.php(47): df_clear_cache()\n#4 /home/ubuntu/.swete/swete-admin/xataface/public-api.php(128): dataface_actions_install->handle(Array)\n#5 /home/ubuntu/.swete/swete-admin/xataface/public-api.php(65): df_update()\n#6 /home/ubuntu/.swete/swete-admin/index.php(153): df_init('/home/ubuntu/.s...', 'xataface', Array)\n#7 {main}\n thrown in /home/ubuntu/.swete/swete-admin/xataface/Dataface/Table.php on line 651

==> /var/log/apache2/access.log <== 135.0.248.253 - - [18/Feb/2021:22:28:34 +0000] "GET /swete/swete-admin/index.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"

Any idea?

After this error, the table "dataface__version" is created but I dod not see "swete.dashboard".

goldyliang commented 3 years ago

Hi,

This sounds like a very great project. I tried to set it up for trial, but I got below error when accessing swete-admin/index.php:

==> /var/log/apache2/error.log <== [Thu Feb 18 22:28:34.260819 2021] [:error] [pid 17789] [client 135.0.248.253:55577] Error performing mysql query to get column information from table 'dashboard'. The mysql error returned was : 'Table 'swete.dashboard' doesn't exist [Thu Feb 18 22:28:34.260925 2021] [:error] [pid 17789] [client 135.0.248.253:55577] PHP Fatal error: Uncaught exception 'Exception' with message 'Error performing mysql query to get column information from table 'dashboard'. The mysql error returned was : 'Table 'swete.dashboard' doesn't exist' in /home/ubuntu/.swete/swete-admin/xataface/Dataface/Table.php:651\nStack trace:\n#0 /home/ubuntu/.swete/swete-admin/xataface/Dataface/Table.php(502): Dataface_Table->__construct('dashboard', Object(mysqli), false)\n#1 /home/ubuntu/.swete/swete-admin/xataface/actions/clear_cache.php(31): Dataface_Table::loadTable('dashboard')\n#2 /home/ubuntu/.swete/swete-admin/xataface/public-api.php(311): dataface_actions_clear_cache->clear_cache(Array)\n#3 /home/ubuntu/.swete/swete-admin/xataface/actions/install.php(47): df_clear_cache()\n#4 /home/ubuntu/.swete/swete-admin/xataface/public-api.php(128): dataface_actions_install->handle(Array)\n#5 /home/ubuntu/.swete/swete-admin/xataface/public-api.php(65): df_update()\n#6 /home/ubuntu/.swete/swete-admin/index.php(153): df_init('/home/ubuntu/.s...', 'xataface', Array)\n#7 {main}\n thrown in /home/ubuntu/.swete/swete-admin/xataface/Dataface/Table.php on line 651

==> /var/log/apache2/access.log <== 135.0.248.253 - - [18/Feb/2021:22:28:34 +0000] "GET /swete/swete-admin/index.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"

Any idea?

After this error, the table "dataface__version" is created but I dod not see "swete.dashboard".

I guess the issue is that xataface has some breaking changes in master branch (for 3.0 version?) Shall I try download the last release of xataface instead from master?

Update: I download xataface 2.2.5 instead from master, then the service can be up and the setup is now completed.