You need to apply through this link. You will need your passport, an e-mail and a credit/debit card to pay the $7 fee.
You will need to fill an online form that should not take more than 5 minutes. You will have to answer basic questions about yourself (name, address, profession, criminal history if any, …), about your intended stay in Canada (when and where are you going in Canada) and your passport information (number, date of expiration, …).
You should be careful when entering your passport number as you can be refused boarding if there’s a mismatch.