Install Docker & Docker-Compose
Before launch the server, you need to connect an SMTP account if you don't have one you can by example use gmail
go to the .env file and change all the value with SMTP
ADRESS_SMTPIt's the adresse email you usingPASSWORD_SMTPIt's your passwordRELAY_SMTPIt's your relay, example if you use a gmail account, it's will be smtp.gmail.com
Of course you're not obligated to use a gmail account
If your values SMTP are corrects it's possible the link still don't work because you have the connexion refused
you just need to change in your account the setting Allow applications with less security
if something with the SMTP goes wrong the server will not launch so if the server is launch or pass the test don't worry it's working
Go to the root where the
docker-compose is and do: sudo docker-compose up
sudo is needed to access to the port
In the terminal where you launch the docker-compose you should see
something like that if all work :
Rocket has launched from http://0.0.0.0:8000
Just go in the direction given on the terminal or go Here
If it's not working then try :
localhost:8000{docker ip}:8000http://0.0.0.0:8000
When the server is running to close properly,
you just need to ctrl c and run sudo docker-compose down
You can use sudo docker-compose up and have different behavior
at the beginning you should see something like that :
server_1 | You can change the mode by changing the value of LAUNCH_MODE in the .env file
server_1 | 'r' -> release
server_1 | 'a' -> all (fmt, clippy, test, release)
server_1 | 'd' -> debug
server_1 | 't' -> test
server_1 | 'ts' -> run a specific test
server_1 | 'c' -> clippy (upgrade code)
server_1 | 'f' -> fmt (syntax format)
server_1 | 'rd' -> recreate the database
server_1 | Link to the database: success
server_1 | Mode is: all verif 'a'
Everything has been explain you just need to go to the server/.env file and change the value of LAUNCH_MODE to the mode you want
'r' releaselaunch the test before to make sure everything should work: better performance in runtime,log level is critical, so only important message are displayed in the terminal'd' debuguse for full data display to the terminallog level normal't' testlaunch the test of the server'ts' specific testlaunch a specific test of the server'c' clippylaunch the clippy functionality of cargo (test if their better syntax solution)'f' fmtlaunch the fmt functionality of cargo (reformat the code with the rust convention)'rd' diesel redorecreate the database (erase all data) if you change the structure and also reset the value in thedata.json'a' alllaunch fmt, clippy, test, and server in release use this before a commit to make sure everything works fine
To see if the server passes all the tests you need to:
You can change the in the server/.env file the value of LAUNCH_MODE to t and do sudo docker-compose up
go to the root of the project and do:
sudo docker-compose up -dto launch the container in daemon modesudo docker container lsYou should see something like this
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1bea5cd8857b to_do_reminder_server "bash -c 'cargo run …" 19 minutes ago Up 6 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp to_do_reminder_server_1
- copy the id under
CONTAINER ID sudo docker container exec CONTAINERID cargo testreplaceCONTAINERIDby the id of your container- launch the test and hopefully everything will be ok
- Dont forget to do
sudo docker-compose downonce you're done
- The password is saved in the database with the encryption
PBKDF2 - token are generated by serialise and
sha256encryption plus a private cookie withbase64hash the token and as aexpire_date of 2 hoursand a cookie to set the expired_token of12 hoursafter that the server will no longer sendexpired tokenbutforbiddenstatus
You can try every status code by going to {server}/status/<code>
401only for admin403not login but action needs to404not found405try to do something only accessible for visitors417code should not happen, it's when the user of the token doesn't exist418expired token500error internal (my bad)
First the server will always have an admin account
with a default password password (you can change it) and email value same as the smtp email
The server use 3 table each one has a very specific utility
The utility of this table is the one that link the other and also let the user create an account have his own personal data
idprimary key of the table auto incrementusernamepasswordpermboolean true if an adminpictureboolean true if the user a a picture uploademailconfirm_emailif the user has confirm is email
Contains the to-do, the principal functionality
idprimary key of the table auto incrementprogressinteger in [0; 100] show the % of the to-doid_ownerforeign key from user allow the link between the tabletitledatelimite-date of the to-doprioritycontentextra description optional
Some nice functionality who will make the life of the user far better. with a preferred setting like the sorting of the to-do
idthe if is the primary keyid_ownerforeign key of usersortchange the behavior of the sorting of the list of to-dodisplaybehavior for the display in the home
GET:/Home of the websiteGET:/status/codeWith<code>a response status code allows to simulate a code to see the template to it
GET:/account/homeSend to login if not login else display user personal pageGET:/account/usersAllows to see every member of the website (if you're connected as admin get state of the database)GET:/account/registerShow a form to fill to create a new accountPOST:/account/registerHandle the form and try to create the accountGET:/account/usersShow a form to fill to loginPOST:/account/loginHandle the form and try to loginPUT:/account/logoutDisconnect the userDELETE:/account/deleteTry to delete the userDELETE:account/delete_admin/<id>for admin account delete the username putGET:/account/editShow form to change password or profile picturePOST:/account/editHandle the change passworddelete:/account/edit/remove_picture/<id>allow to remove the picturePOST:/account/set/pictureHandle the new picturePUT:/account/send_codesend a code to confirm the emailPOST:/account/confirmform to enable the emailGET:/account/code_passwordform when you forget your passwordPUT:/account/code_passwordchange the password and send the new value per emailPUT:/account/new_emailchange the email and send a confirm code to enable the email
GET:/to-do/homeshow the to-do in the ordre of creation with some actionGET:/to-do/create/<callback>display form to create a to-do the callback is useful for the go backPOST:/to-do/create/<callback>allow to create in the database the to-doDELETE:/to-do/owner/<id>delete all the to-do of the account inDELETE:/to-do/owner/done/<id>delete all the to-do done of the account inDELETE:/to-do/delete/<id>delete the to-do with theGET:/to-do/edit/<id>show the forum to edit a to-doPUT:/to-do/edit/<id>put to save the new dataPUT:/to-do/set_progress/<id>/<value>allow to just change the progress value
GET:/preference/homeshow the preference to the user and allow him to change themPUT:/preference/set/displayput a new display valuePUT:/preference/set/modeput a new sorting mode