Skip to content

Conversation

@mgage
Copy link
Member

@mgage mgage commented Jun 16, 2021

if admin course is added then its tables are also updated and user: admin with password: admin are added to the admin course.

mgage added 8 commits June 15, 2021 23:00
-e 's/database_password ='passwordRW'/database_password =$ENV{"WEBWORK_DB_PASSWORD"}/' \

because 'passwordRW' is what occurs in site.conf.dist (as it should).
literally specifying passwords in the configuration files allowing interpolation
wrecks havoc if the password has special characters such as @ and %

also changed README from 2.15 to 2.16
…assword)

also added matching on  for consistency with other matches
…inal file had no $ on this line)

-- this still doesn't work for me for changing passwordRW and I can't see why.
…r more specific matches. To test this do rm conf/site.conf, then do docker-compose up and see if site.conf gets set up properly reading variables from ENV. Try running the admin course, but I think you will run into problems because the admin course tables haven't been upgraded. YMMV.
…: admin with password: admin to the course admin
@taniwallach
Copy link
Member

I have never needed to do anything to have the admin user created. It seems to be handled by the load from the class list file in

$WEBWORK_ROOT/bin/addcourse admin --db-layout=sql_single --users=$WEBWORK_ROOT/courses.dist/adminClasslist.lst --professors=admin

My guess is that you may have manually needed to fix the DB if the DB connection was not working when the course was created.

@mgage
Copy link
Member Author

mgage commented Jun 17, 2021

I'll try it again to double check and report back before this is checked in. I don't think it was because of a bad connection to the database.

@mgage
Copy link
Member Author

mgage commented Jun 23, 2021

@taniwallach I think you are right, if the addcourse admin script runs completely the admin user and its credentials are also installed.

Copy link
Member

@taniwallach taniwallach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted, I think the extra lines to make a second attempt to fix the admin course tables and to add the admin user are not needed.

-e 's/database_username ="webworkWrite"/database_username =$ENV{"WEBWORK_DB_USER"}/' \
-e 's/database_password ="passwordRW"/database_password =$ENV{"WEBWORK_DB_PASSWORD"}/' \
-e 's/^\$database_username ="webworkWrite"/$database_username =$ENV{"WEBWORK_DB_USER"}/' \
-e 's/^\$database_password ='\''passwordRW'\''/$database_password =$ENV{"WEBWORK_DB_PASSWORD"}/' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is a mission critical correction, as the line in site.conf.dist was changed to use single quotes.
The change on these 2 lines to match from the start of the line so it should only modify the active definition lines and not other lines is also good.

$WEBWORK_ROOT/bin/addcourse admin --db-layout=sql_single --users=$WEBWORK_ROOT/courses.dist/adminClasslist.lst --professors=admin
chown www-data:www-data -R $APP_ROOT/courses
echo "Admin course is created."
$WEBWORK_ROOT/bin/upgrade_admin_db.pl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have yet to be able to trigger a case where these extra lines are needed.
If I delete the course directory, but left the database tables alone - the course seems to work after being recreated by the prior call to bin/addcourse.
My impression is that these lines can be deleted (or commented out, if @mgage want's to retain them in case some special circumstances do make them necessary).

@mgage
Copy link
Member Author

mgage commented Jul 7, 2021

this has been addressed in patch5

@mgage mgage closed this Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants