Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# <Port exposed> : < 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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
2 changes: 1 addition & 1 deletion elasticsearch/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
4 changes: 3 additions & 1 deletion mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/

2 changes: 2 additions & 0 deletions mysql/custom-mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mysqld]
default-authentication-plugin = mysql_native_password
70 changes: 65 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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)