github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/doc/deploy-prod.md (about) 1 # Deployment Notes for Production Environments 2 3 These are some notes related to the running and maintenance of a QuickFeed server. 4 To set up a production server follow these [instructions](./deploy.md). 5 6 ## Accessing the Server Machine 7 8 To get access to the production server at UiS for maintenance, please send your `.ssh/id_ed25519.pub` public key to meling. 9 Once your public key has been added to the `authorized_keys` file on the server machine, you can access the machine more easily if you add these entries to your `.ssh/config` file. 10 Make sure to replace `meling` with your user name. 11 12 ```text 13 Host uis 14 User meling 15 HostName ssh1.ux.uis.no 16 17 Host qf qf2 18 HostName %h.ux.uis.no 19 User quickfeed 20 ProxyJump uis 21 ``` 22 23 With this configuration, you can reach the `qf2` test machine with: 24 25 ```sh 26 % ssh qf2 27 ``` 28 29 ## Maintaining the QuickFeed Server 30 31 To upgrade the server with new code from the master branch, use the script: 32 33 ```sh 34 % ./doc/misc/update.sh 35 ``` 36 37 This will fetch code from GitHub, recompile the server, stop the server, backup the database, and restart the server. 38 39 To stop the server: 40 41 ```sh 42 % killall quickfeed 43 ``` 44 45 To update the server manually: 46 47 ```sh 48 % git fetch 49 % git status 50 ``` 51 52 Ensure that there are no local changes and the branch can be fast-forwarded. 53 Otherwise, resolve local changes, preferably as new commits or pull requests to the main repository. 54 Then run these commands to recompile the server and frontend: 55 56 ```sh 57 % git pull 58 % make install 59 % make ui 60 ``` 61 62 To start the server, follow the [instructions herein](./deploy.md). 63 64 ## Server Logs 65 66 We use `logrotate` to maintain server logs. 67 Configuration file is `/etc/logrotate.d/quickfeed`. 68 Example configuration is: 69 70 ```text 71 /home/quickfeed/quickfeed/qf.log { 72 size 5M 73 copytruncate 74 dateext 75 rotate 2 76 compress 77 maxage 14 78 } 79 ``` 80 81 This configuration will rotate the `qf.log` file when its size reaches 5 MB, and start to log to a new file. 82 The rotated file will be renamed with the current date. 83 Logrotate will keep the two latest log files in compressed form and will delete them two weeks after the rotation. 84 85 For additional information, see the [logrotate manual](https://www.digitalocean.com/community/tutorials/how-to-manage-logfiles-with-logrotate-on-ubuntu-16-04). 86 87 ## Cron Jobs 88 89 TODO(meling) We have not prepared any cron jobs. 90 91 Cron is a Linux utility to schedule running of scripts or commands automatically at a specified time. 92 93 [Minimal Cron tutorial](https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/). 94 95 To add, edit or remove a cron job in the user specific cron table, run `crontab -e`. 96 97 **Important:** Cron will send the job outputs an email to every email address provided for the user. 98 To disable emails, discard job output by adding `>/dev/null 2>&1` at the end of the job description.