This guide will list the steps required to configure and re-setup SSID in the remote server before a new semester. This guide will be separated into the below sections:
- Archiving and clearing past code files (uploaded by users) and modules from SSID
- Resetting the database and application
- Pulling any new code changes and deploying those changes
-
Open a terminal and login to the server with SSH. Enter the password given when required.
ssh sadm@ssid-i.comp.nus.edu.sg
-
Navigate to the directory where the application's code is stored.
cd /var/www/SSID/code
-
All the code files uploaded by users are stored under the respective dedicated assignment number under the
upload
folder. In order to extract the files, firstly, create a new terminal and do not login to the server with SSH. Instead simply enter the below command:scp -r sadm@ssid-i.comp.nus.edu.sg:/var/www/ssid/code/upload/[ASSIGNMENT_NO]/ [DESTINATION_FOLDER]
- replace [ASSIGNMENT_NO] with the assignment number and [DESTINATION_FOLDER] with your destination folder.
-
When prompted, enter the password and after the process is completed, you would be able to see the extracted files in the destination folder.
-
Repeat steps 1 & 2 above to archive any data that need to be stored.
-
Once the archiving has been completed, if you wish to clear the entire database, you can proceed to the below section. Else, if only certain modules and/or uploaded code files are to be deleted, you can manually delete them in the database or in the SSID app interface.
-
Ensure you have no connections to db (rails server, sql client..). Else, the db won't drop.
-
Run the below command to recreate database and the seeds:
rake db:drop db:create db:migrate db:seed: loads from migrations
-
Run the below command to see the current state of the database:
rake db:schema:dump
-
Go to your application's code directory on the server, then use Git to pull the latest code:
cd /var/www/ssid/code git pull
-
If the application's gem dependencies have changed, install any updated gem dependencies.
bundle install --deployment --without development test
-
Compile Rails assets and run database migrations.
bundle exec rake assets:precompile db:migrate RAILS_ENV=production
-
Finally, restart application (so that the updates take effect).
passenger-config restart-app $(pwd)