diff --git a/docker-compose.yml b/docker-compose.yml index 3dacf2d..b39ef5a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,13 +15,30 @@ services: # MySQL dbs mysql: image: mysql:5.7.25 - command: mysqld --default-authentication-plugin=mysql_native_password + container_name: mysql_test + platform: linux/x86_64 + ports: + # : < MySQL Port running inside container> + - '3307:3306' build: ./mysql environment: MYSQL_ROOT_PASSWORD: "" MYSQL_DATABASE: openml - + + + website_new: + build: openml.org + ports: + - "5000:5000" + links: + - mysql + + depends_on: + - mysql + - elasticsearch + + # Elastic search indexes elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:6.8.2 @@ -31,23 +48,28 @@ services: - "9200:9200" - "9300:9300" - # Php frontend +# Php frontend website: build: ./website ports: - 80:80 - volumes: + volumes: - ./config:/openmlconfig - ./OpenML:/var/www/html depends_on: - mysql - elasticsearch - - gollum - + environment: + DB_HOST_OPENML: "mysql" + DB_HOST_EXPDB: "mysql" + ES_URL: 'localhost:9200' + ES_PUBLIC_URL: 'elasticsearch:9200' + BASE_URL: 'http://localhost/' + # MySQL admin UI (tool) phpmyadmin: image: phpmyadmin/phpmyadmin:latest - volumes: + volumes: - ./config:/openmlconfig ports: - 8080:80 @@ -59,15 +81,9 @@ services: # OpenML Java background workers java: image: java - volumes: + volumes: - ./config:/openmlconfig - ./OpenML:/var/www/html - + # runs openml process_dataset java background task each 10 secs command: /bin/bash -c 'while sleep 10;do api_key=`cat /openmlconfig/api_key.txt`; echo "API key:$$api_key"; java -Xmx4G -jar /var/www/html/openml_OS/third_party/OpenML/Java/evaluate.jar -config "server = http://website/;api_key = $$api_key" -f process_dataset;done' - - # OpenML Wiki, TODO: not working , CORS/cross domain issue - gollum: - build: ./gollum - ports: - - 9080:80 diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 9169c69..c30792e 100644 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -1,4 +1,4 @@ -FROM elasticsearch +FROM elasticsearch:6.8.2 LABEL maintainer="Rui Quintino,https://github.com/rquintino" COPY ./elasticsearch.yml /usr/share/elasticsearch/config/ \ No newline at end of file diff --git a/elasticsearch/elasticsearch.yml b/elasticsearch/elasticsearch.yml index 7b8be73..78c1053 100644 --- a/elasticsearch/elasticsearch.yml +++ b/elasticsearch/elasticsearch.yml @@ -8,4 +8,4 @@ http.host: 0.0.0.0 http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE -http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type, Content-Length, Authorization" \ No newline at end of file +http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization diff --git a/mysql/Dockerfile b/mysql/Dockerfile index 7a7a4f3..cbe6fe4 100644 --- a/mysql/Dockerfile +++ b/mysql/Dockerfile @@ -1,7 +1,9 @@ -FROM mysql +FROM mysql:5.7.25 LABEL maintainer="Rui Quintino,https://github.com/rquintino" # *.sql files in /docker-entrypoint-initdb.d are executed at mysql instance start, by alphabetical order ADD ./openml_expdb.sql /docker-entrypoint-initdb.d ADD ./openml.sql /docker-entrypoint-initdb.d +COPY ./custom-mysql.cnf /etc/mysql/conf.d/ + diff --git a/mysql/custom-mysql.cnf b/mysql/custom-mysql.cnf new file mode 100644 index 0000000..dd829be --- /dev/null +++ b/mysql/custom-mysql.cnf @@ -0,0 +1,2 @@ +[mysqld] +default-authentication-plugin = mysql_native_password \ No newline at end of file diff --git a/readme.md b/readme.md index 713176f..894f773 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,6 @@ # Issues/limitations - current only works on port 80 - wiki powered by gollum is not working (in the new OpenML frontend this will no longer be used). -- **Only the local admin account works for now.** There is an issue with login and it will not be possible to create and login with other accounts (Work in progress) # Requirements @@ -33,6 +32,16 @@ git clone -b docker_changes https://github.com/openml/OpenML.git ``` ![](images/2018-04-07-00-57-29.png) +#### New website configuration (Optional) +Skip this step unless you want to use the new website. + +- Clone the new website from here (also inside openml-docker-dev), as it has some code changes +``` +git clone -b docker https://github.com/PortML/openml.org.git +cd openml.org +cp server/src/client/app/TEMPLATE.env .env + +``` ### Step 2: Configure docker and OpenML @@ -71,10 +80,53 @@ Configure elastic search. ![](images/2018-04-07-01-04-02.png) -Disable email activation in *OpenML\openml_OS\ion_auth.php* +Disable email activation in *OpenML/openml_OS/config/ion_auth.php* ![](images/2018-04-07-01-07-21.png) +#### New website configuration +- Edit DATABASE_URI field in *.flaskenv* to add in the mysql password in place of PASSWORD- + (use the same password as the mysql password in docker-compose.yml) +- Note on DATABASE_URI: hostname should be 'mysql_test', the container name of database: + ``DATABASE_URI=mysql+pymysql://[username]:[password]@mysql_test:3306/openml`` +- Check openml.org/server/src/client/app/.env if the react url is correct +- In order to enable the python debug prints in docker add the following lines of code to the main 'docker-compose.yml' file inside the 'website_new' service +```` +environment: + - PYTHONUNBUFFERED=1 +```` +- Please make sure you rebuild the openml.org docker image if you make any changes to these configuration files using: + This will make sure the react image is re-built (Don't do this before the first docker-compose up): +``` +cd openml.org +docker build -t openml-docker -f Dockerfile . +``` +- [Optionally] you can use a hot-reload configuration for the new website with some constrains, see the section below how to set this up + +- Continue with remaining steps and view Step 7 for testing new website changes +- Switch back to root folder + + +``` +cd .. + +``` +If the new website rebuild doesn't work, try clearing all caches with: +``` +docker system prune -a +``` +and then, pull elastic search before doing docker-compose up. + +### [Optional hot-reload new website] +Using a hot-reload in docker requires you to set the volume of the source code to your local folder of the new website. Flask runs in development mode and will see changes you make without requireing you to rebuild the image. The only downside is that you are unable to reach the new front-end (React code) via the docker URL. You can seperatly run a node development server for the front-end to also enable hot-reload for the React front-end. + +Add the following lines of code to the main 'docker-compose.yml' file inside the 'website_new' service to enable this hot-reload function: +```` +volumes: + - ./openml.org:/app +```` + + ### Step 3: Starting docker-compose On the openml-docker-dev root folder, where *docker-compose.yml* is located run: @@ -105,7 +157,7 @@ after start wait a few seconds for services to be ready, ex: MySQL ready for con Execute in a new window/shell: ``` -docker exec -it openmldockerdev_website_1 php index.php cron init_local_env +docker exec -it openml-docker-dev-website-1 php index.php cron init_local_env ``` (take note the printed admin username and password, and wait to finish, can take 1-2mins) @@ -118,12 +170,12 @@ Change data folder owner to www-data apache user in container, allow for logs/up Execute in a new window/shell: ``` -docker exec -it openmldockerdev_website_1 chown -R www-data:www-data /var/www/html/data +docker exec -it openml-docker-dev-website-1 chown -R www-data:www-data /var/www/html/data ``` -### Step 6: Final tests +### Step 6: Final tests (Old website) Login on http://localhost with admin and saved password @@ -145,3 +197,11 @@ We have 1 sample dataset ![](images/upload2.PNG) ### Note: Files in OpenML cloned repo are mounted inside the website container, any change will reflect immediately on the site + +### Step 7 New website checks (Optional) +- Check the new website running at 127.0.0.1/5000. It should look similar to new.openml.org +- Sign up as a new user in the new website. (Note that you cannot use the admin account from the old website to login here) +- Sign in with your email and password +- You should be able to see your profile +- By default the user created above is not an admin. This is required if you want to use the dataset upload. This can be done by loggin into MyPHPAdmin and changing the 'users_groups' row of this user. Set the 'group_id' to 1 (admin group) and save. +- Check Dataset upload (required to fill in all fields)