diff --git a/README.md b/README.md index 55ab40678263892aee28b8ebfbcf9ee80f3eef45..26f9df7d6f642c45870975e13b37dbc351c06b04 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,10 @@ service gunicorn restart Install docker and docker-compose +Generate users and groups in deploy/config/mysql/data.sql + +Password can be generated with generate_password.py -script + Go to deploy folder. Build containers and run them with: ``` docker-compose -f docker-compose.yml up -d --build diff --git a/deploy/config/mysql/data.sql b/deploy/config/mysql/data.sql new file mode 100644 index 0000000000000000000000000000000000000000..ad593489b6dd092ac2b84c88048ad2e94711c696 --- /dev/null +++ b/deploy/config/mysql/data.sql @@ -0,0 +1,13 @@ + +/* password:password */ +INSERT INTO user VALUES(1,'admin',NULL,'pbkdf2:sha256:50000$6Cc6Mjmo$3fe413a88db1bacfc4d617f7c1547bd1ea4cbd6c5d675a58e78332201f6befc6'); + +/* password:password */ +INSERT INTO user VALUES(2,'editor',NULL,'pbkdf2:sha256:50000$Rq2WwVVi$12335e8d02fa3f25ffd11ba9f02fd1db7ca2964c5eaa13ca179a02ee3f19a656'); + +INSERT INTO research_group(id, name, tag, description) VALUES(1, 'Human Emotion Systems', 'emotion', 'Welcome to the Human Emotion Systems -laboratory`s Onni-net laboratory! The experiments that are currently underway are listed below - you can participate for as many experiments you want.'); +INSERT INTO research_group(id, name, tag, description) VALUES(2, 'Turku Eye-tracking', 'eyelabs', 'Welcome to the Turku Eyelabs -laboratory`s Onni-net laboratory! The experiments that are currently underway are listed below - you can participate for as many experiments you want.'); + +INSERT INTO user_in_group VALUES (1,1, 'admin'); +INSERT INTO user_in_group VALUES (2,1, 'editor'); + diff --git a/deploy/config/mysql/schema.sql b/deploy/config/mysql/schema.sql index c12823cb96e14983b9f50014ab8180e3d2b134e9..ef8429b1b6f83d0f27d35ed0c3720ed91d1aa978 100644 --- a/deploy/config/mysql/schema.sql +++ b/deploy/config/mysql/schema.sql @@ -197,10 +197,7 @@ ALTER TABLE experiment ADD COLUMN (embody_enabled BOOLEAN DEFAULT 0); /* Set current answer type (embody/slider/etc..) so returning users are routed to correct question */ ALTER TABLE answer_set ADD COLUMN (answer_type VARCHAR(120)); -INSERT INTO user VALUES(1,'admin',NULL,'pbkdf2:sha256:50000$6Cc6Mjmo$3fe413a88db1bacfc4d617f7c1547bd1ea4cbd6c5d675a58e78332201f6befc6'); - -/* eyelabs */ -INSERT INTO user VALUES(2,'eyelabs',NULL,'pbkdf2:sha256:50000$sdBu3Rjm$7ab97c6d2686460b85a2a20517b7012c15ffb341ba3fef5b0f17ed8354fc38d9'); +ALTER TABLE experiment ADD COLUMN (group_id INTEGER), ADD FOREIGN KEY(group_id) REFERENCES research_group(id); CREATE TABLE research_group ( @@ -211,9 +208,6 @@ CREATE TABLE research_group ( PRIMARY KEY (id) ); -INSERT INTO research_group(id, name, tag, description) VALUES(1, 'Human Emotion Systems', 'emotion', 'Welcome to the Human Emotion Systems -laboratory`s Onni-net laboratory! The experiments that are currently underway are listed below - you can participate for as many experiments you want.'); -INSERT INTO research_group(id, name, tag, description) VALUES(2, 'Turku Eye-tracking', 'eyelabs', 'Welcome to the Turku Eyelabs -laboratory`s Onni-net laboratory! The experiments that are currently underway are listed below - you can participate for as many experiments you want.'); - CREATE TABLE user_in_group ( idgroup INTEGER, iduser INTEGER, @@ -222,8 +216,3 @@ CREATE TABLE user_in_group ( FOREIGN KEY(iduser) REFERENCES user (id) ); -INSERT INTO user_in_group VALUES (1,1, 'admin'); -INSERT INTO user_in_group VALUES (2,1, 'admin'); - -ALTER TABLE experiment ADD COLUMN (group_id INTEGER), ADD FOREIGN KEY(group_id) REFERENCES research_group(id); - diff --git a/generate_password.py b/generate_password.py new file mode 100644 index 0000000000000000000000000000000000000000..cb63eea85aa404a443a4b4d286b94a73444f35d3 --- /dev/null +++ b/generate_password.py @@ -0,0 +1,10 @@ +from werkzeug.security import generate_password_hash, check_password_hash + +hash1 = 'pbkdf2:sha256:50000$6Cc6Mjmo$3fe413a88db1bacfc4d617f7c1547bd1ea4cbd6c5d675a58e78332201f6befc6' + +hash2 = 'pbkdf2:sha256:50000$vQutOphQ$9f80b3ef2b5bc2f971a40febf0d964326386e12d1b90e0f6f5d1a235f6e8093d' + +print(check_password_hash(hash1, 'password')) +print(check_password_hash(hash2, 'password')) + +print(generate_password_hash('password'))