install notes - local copy of Exercism website
Having a locally installed Exercism website may be useful for us to nut out directly submitting from Pharo, but I've had a few difficulties with that. Opened this issue as a place to keep notes, away from other issues.
TL;DR... Installing Exercise website on Ubuntu under Windows Subsystem For Linux may be blocked by Microsoft/WSL#3100 "socketpair() syscall ignores non-blocking request (SOCK_NONBLOCK, O_NONBLOCK) "
I didn't keep an exact log as I went, but the following is pieced together from bash history...
System platform
$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"
$ uname -a Linux BENGINEER 4.4.0-17134-Microsoft #137-Microsoft Thu Jun 14 18:46:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
Updated system and installed required system packages
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install yarn mysql-server mysql-client libmysqlclient-dev cmake
$ yarn --version 1.9.4
$ mysql --version mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper
$ cmake --version cmake version 3.5.1
Installed Ruby via Ruby Version Manager per http://rvm.io/
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$ \curl -sSL https://get.rvm.io | bash -s stable
$ rvm --version rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ rvm use 2.4 --default Using /home/ben/.rvm/gems/ruby-2.4.4
$ ruby --version ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
$ gem install bundler
$ bundler --version Bundler version 1.16.4
Configured database
$ sudo /etc/init.d/mysql start $ mysql -u root -p
CREATE USER 'exercism_reboot'@'localhost' IDENTIFIED BY 'exercism_reboot';
CREATE DATABASE exercism_reboot_test;
CREATE DATABASE exercism_reboot_development;
ALTER DATABASE exercism_reboot_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER DATABASE exercism_reboot_development CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON exercism_reboot_test.* TO 'exercism_reboot'@'localhost';
GRANT ALL PRIVILEGES ON exercism_reboot_development.* TO 'exercism_reboot'@'localhost';
Cloned website and install bundle
$ mkdir -p Repos/Exercism && cd Repos/Exercism
$ git clone [email protected]:exercism/website.git
$ cd website
$ echo "myhost" > server_identity
$ bundle install
$ bundle exec rake exercism:setup
$ bundle exec rails server
In web browser, opened http://lvh:3000 and up popped Exercism web site (yay! the crowd cheered!), but its empty of tracks (augh... the crowd was disappointed...)
Poke around blindly
At the risk of breaking things (since I haven't used ruby/rails before)...
$ bundle exec rake -T # list of available tasks
$ bundle exec rake db:drop Dropped database 'exercism_reboot_development' Dropped database 'exercism_reboot_test'
$ bundle exec rake db:create Created database 'exercism_reboot_development' Created database 'exercism_reboot_test'
$ bundle exec rake --trace exercism:setup
All the create_table() and add_foreign_key() succeeded. Here is the log carrying on from the last one...
-- add_foreign_key("user_tracks", "users")
-> 0.1765s
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke db:load_config
** Execute db:abort_if_pending_migrations
rake aborted!
IO::EINPROGRESSWaitWritable: Operation now in progress - connect(2) would block
/home/ben/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/socket.rb:1198:in __connect_nonblock' /home/ben/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/socket.rb:1198:in connect_nonblock'
/home/ben/.rvm/gems/ruby-2.4.4/gems/redis-4.0.1/lib/redis/connection/ruby.rb:187:in rescue in connect_addrinfo' /home/ben/.rvm/gems/ruby-2.4.4/gems/redis-4.0.1/lib/redis/connection/ruby.rb:179:in connect_addrinfo'
P.S. I wonder what is the best way for wipe the slate clean for another try.
In another thread, @ihid suggested...
bundle exec rake git:fetch
bundle exec rake git:sync
Tried the first line. Didn't seem to do anything for 10 minutes so I dug in...
It seems bundle exec rake git:fetch has a forever loop and perhaps aimed at keeping things in continual sync than first seed?? Tracing through it but being unfamiliar with the code, in fetches_updated_repos.rb it seems bad that RepoUpdate.all.size is 0.
def repo_updates
print ClusterConfig.server_identity
fetched = RepoUpdate.
includes(:repo_update_fetches).
where(repo_update_fetches: { host: ClusterConfig.server_identity })
print fetched
puts "#{RepoUpdate.all.size}"
RepoUpdate.
where(synced_at: nil).
where.not(id: fetched.pluck(:id))
end
I think my problem is earlier, getting the initial seeds configured.
But I should park this on my WSL box and next try another machine.
bundle exec rake exercism:setup should do the track stuff. Did it definitely finish without error?
@iHiD, It was a bit of a fight getting it working on another Linux system that was old, but I got there!! Full install log including all twists and turns is below. Probably there are a few missteps since I haven't used Ruby/Rails/Rake before.
It maybe good to mention in the website README.md that MySQL version >= 5.7.
Here we go...
Recorded system platform
$ uname -a Linux charlotte-laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release DISTRIB_ID=LinuxMint DISTRIB_RELEASE=17.3 DISTRIB_CODENAME=rosa DISTRIB_DESCRIPTION="Linux Mint 17.3 Rosa" (Equivalent to Ubuntu 14.04 Trusty Tahr)
Updated system and install required system packages
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install build-essential nodejs yarn mysql-server mysql-client libmysqlclient-dev cmake git
$ yarn --version 1.9.4
$ mysql --version mysql Ver 14.14 Distrib 5.5.61, for debian-linux-gnu (x86_64) using readline 6.3
$ cmake --version cmake version 2.8.12.2
Installed Ruby via Ruby Version Manager per http://rvm.io/
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$ \curl -sSL https://get.rvm.io | bash -s stable
$ source /etc/profile.d/rvm.sh
$ rvm --version rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ rvm install ruby-2.4.4
$ rvm use 2.4 --default Using /home/ben/.rvm/gems/ruby-2.4.4
$ ruby --version ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
$ gem update
$ gem install bundler
$ bundle --version Bundler version 1.16.4
Configured database
$ sudo /etc/init.d/mysql start $ mysql -u root -p CREATE USER 'exercism_reboot'@'localhost' IDENTIFIED BY 'exercism_reboot'; CREATE DATABASE exercism_reboot_test; CREATE DATABASE exercism_reboot_development; ALTER DATABASE exercism_reboot_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER DATABASE exercism_reboot_development CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL PRIVILEGES ON exercism_reboot_test.* TO 'exercism_reboot'@'localhost'; GRANT ALL PRIVILEGES ON exercism_reboot_development.* TO 'exercism_reboot'@'localhost'; quit
Cloned website and install bundle
$ mkdir -p Repos/Exercism && cd Repos/Exercism
$ git clone https://github.com/exercism/website.git
$ cd website
$ echo "myhost" > server_identirety
$ bundle install
$ bundle exec rake exercism:setup
-- create_table("active_storage_attachments", {:options=>"ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", :force=>:cascade}) rake aborted! ActiveRecord::StatementInvalid: Mysql2::Error: Specified key was too long; max key length is 767 bytes:
Tried MySQL 5.6 (it didn't work)
$ sudo apt remove mysql-server mysql-client
$ sudo /etc/init.d/mysql start
$ mysql -u root -p show databases; +-----------------------------+ | Database | +-----------------------------+ | information_schema | | exercism_reboot_development | | exercism_reboot_test | | mysql | | performance_schema | +-----------------------------+
$ bundle exec rake db:drop Dropped database 'exercism_reboot_development' Dropped database 'exercism_reboot_test'
$ bundle exec rake db:create Created database 'exercism_reboot_development' Created database 'exercism_reboot_test'
$ bundle exec rake exercism:setup Mysql2::Error: Specified key was too long; max key length is 767 bytes:
https://github.com/gogs/gogs/issues/4894 Because of mysql 5.6 (includes prior versions) InnoDB max index length is 767 bytes, mysql 5.7.7 is up to 3072 bytes. If some varchar column's length is 255, when the character format is utf-8 needs 2553=765 bytes for index length, It's OK. But, an utf8mb needs 2554=1020 bytes for index length.
Solutions:
- UPGRADE the mysql to 5.7.7(Mariadb 10.2.2)
- Change the utf8mb column length to 191 (191*4=764)
- Change the utf8mb to utf8
- Set innodb_file_format=Barracuda, innodb_large_prefix=on and create table using ROW_FORMAT=DYNAMIC or COMPRESSED (default for 5.7.7)
btw, in MySQL, never use âutf8â. Use âutf8mb4â. https://medium.com/@adamhooper/in-mysql-never-use-utf8-use-utf8mb4-11761243e434
$ sudo apt remove mysql-server-5.6 mysql-client-5.6
Getting there with MySQL 5.7
MySQL 5.7 not available in the default packages.
http://sharadchhetri.com/2016/02/08/how-to-install-mysql-server-5-7-on-ubuntu-14-04-lts/ $ sudo wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.6.0-1_all.deb The detected system (linuxmint rosa) is not supported by MySQL. If you believe the platform is compatible with one of the supported systems, one of the corresponding repositories may be selected.
- Selected "trusty" per...https://en.wikipedia.org/wiki/Linux_Mint_version_history
$ sudo apt-get update GPG error: http://repo.mysql.com trusty InRelease: The following signatures were invalid: KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 https://bugs.mysql.com/bug.php?id=85029
$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
$ sudo apt-get update
$ sudo apt-get install mysql-server-5.7 Package mysql-server-5.7 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: mysql-community-server:i386 mysql-common:i386 mysql-community-server mysql-common E: Package 'mysql-server-5.7' has no installation candidate
https://askubuntu.com/questions/773287/how-to-repair-corrupt-package-installation-mysql/773441 $ sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
$ reboot
$ sudo apt-get install mysql-server-5.7 Package mysql-server-5.7 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: mysql-community-server:i386 mysql-common:i386 mysql-community-server mysql-common E: Package 'mysql-server-5.7' has no installation candidate
$ apt-cache madison mysql-server mysql-server | 5.7.23-1ubuntu14.04 | http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 amd64 Packages mysql-server | 5.5.61-0ubuntu0.14.04.1 | http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages mysql-server | 5.5.61-0ubuntu0.14.04.1 | http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages mysql-server | 5.5.35+dfsg-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages mysql-community | 5.7.23-1ubuntu14.04 | http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 Sources
So I guess "community" will do... $ sudo apt-get install mysql-community E: Unable to locate package mysql-community
Lets just hope the generic one insalls latest...
$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libmecab2 mysql-client mysql-common mysql-community-client
mysql-community-server
The following NEW packages will be installed:
libmecab2 mysql-client mysql-common mysql-community-client
mysql-community-server mysql-server
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.9 MB of archives.
After this operation, 238 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-common amd64 5.7.23-1ubuntu14.04 [15.2 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/universe libmecab2 amd64 0.996-1.1 [244 kB]
Get:3 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-community-client amd64 5.7.23-1ubuntu14.04 [7112 kB]
Get:4 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-client amd64 5.7.23-1ubuntu14.04 [12.4 kB]
Get:5 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-community-server amd64 5.7.23-1ubuntu14.04 [24.5 MB]
Get:6 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-server amd64 5.7.23-1ubuntu14.04 [12.4 kB]
Fetched 31.9 MB in 27s (1151 kB/s)
$ mysql --version mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper
NOW BACK TO OUR REGULARLY SCHEDULED PROGRAM...
$ cd website
$ bundle exec rake exercism:setup
bundler: command not found: rake
Install missing gem executables with bundle install
$ gem install bundler ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /var/lib/gems/1.9.1 directory.
$ rvm use 2.4 --default
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.
$ /bin/bash --login
$ gem install bundler
$ bundle exec rake exercism:setup rake aborted! LoadError: libmysqlclient.so.18: cannot open shared object file: No such file or directory - /home/ben/.rvm/gems/ruby-2.4.4/gems/mysql2-0.5.1/lib/mysql2/mysql2.so
$ sudo apt-get install libmysqlclient20 libmysqlclient-dev
$ bundle install
$ bundle exec rake exercism:setup rake aborted! Redis::CannotConnectError: Error connecting to Redis
$ sudo apt-get install redis-server
$ bundle exec rake db:drop
Dropped database 'exercism_reboot_development'
Dropped database 'exercism_reboot_test'
$ bundle exec rake db:create Created database 'exercism_reboot_development' Created database 'exercism_reboot_test'
$ bundle exec rake exercism:setup Seeding https://github.com/exercism/ballerina Seeding https://github.com/exercism/bash etc ===== Fetching ballerina ===== ===== Syncing ballerina ===== Syncing Maintainers ===== Fetching bash ===== ===== Syncing bash ===== Syncing Maintainers etc
And...... drum roll please....
$ bundle exec rails server Now in web browser http://lvh.me:3000 is full of tracks and exercises. Yay!
lol. Well done! :)
A PR to the readme about the mysql version would be appreciated :)