Open XiaoleZ opened 3 years ago
hi @XiaoleZ As discussed, I've created a dockerhub organization https://hub.docker.com/orgs/ualbertasmr and added you as an owner. I've linked the ualberta-smr organization account to it. Can you see if you are able to push the container there now instead of using your personal account? Let me know if there are any issues!
@snadi Thank you. I will put the images in the org docker hub
Why are we changing output_path to ../home/scripts/
?
I get this error when creating the metrics
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/main/scripts/__main__.py", line 4, in <module>
app.run()
File "/main/scripts/app.py", line 26, in run
addlibraries()
File "/main/scripts/addlibraries.py", line 27, in addlibraries
if not domain.exists():
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 809, in exists
return self.query.has_results(using=self.db)
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/query.py", line 535, in has_results
return compiler.has_results()
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1126, in has_results
return bool(self.execute_sql(SINGLE))
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 259, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'libcomp.Domain' doesn't exist")
I think that the domain tables haven't been created yet. So does this mean that the steps need to be done in reverse? That you need to run the migrate for the website first?
Update the PR: Tested for 2 library and display the charts successfully.
Why are we changing output_path to
../home/scripts/
?
Because the charts is in ../home/scripts/ (not in the metricscript or web container). The views.py read the charts from ../home/scripts/ . So the charts can be display on the web.'
I move this change in the code. output_path = ../home/scripts/
is for the docker. If we want to run locally we need to change to the file we store the charts
What it does?
Create Dockerfile for LibraryMetricScripts and Pull librarycomparisonswebsite images from Docker Hub
Why it is import?
It makes the database setup more easier and it allows the user to run librarycomparisonswebsite locally
How to test it?
Follow the updated Readme.md file.
Docker Local Development Setup
This is a simple way to get a local librarycomparison web development server set up.
You'll need to have Docker and Docker Compose installed.
You first need to set up some of the configuration parameters in the file
Config.json
:TOKEN
to your own GitHub generated token. (How to create Github TOKEN)SO_TOKEN
to your stack exchange key. (How to create StackOverflow TOKEN)You can update the
MAXSIZE
to 100 inConfig.json
for testing purpose.Creating the image
1. Builds/Rebuilds the image (not start the containers) in the docker-compose.yml file:
2. Starts the containers
Starts the containers && Start the server
Run metric script:
createmetrics
: Create the Metrics(Optional) Open librarycomparisons website command shell:
start
: Starts the Django server. The librarycomparison web will run in the8000
port by default.migrate
: Runs Django migrationsmake
: Runs Django makemigrationscreatesuperuser
: Runs Django createsuperuserTo access the website, use http://127.0.0.1:8000/comparelibraries/
3. Stops containers and removes containers, networks, volumes, and images created by up
Remove volume:
docker-compose down -v
. Warning: this will permanently delete the contents in the db_data volume, wiping out any previous database you had there4. Setup Metric Table if you create the docker volumn for the first time
Accessing docker container mysql databases
docker exec -it librarymetricscripts_db_1 mysql -uroot -p"mypwd"
show databases;