- ruby v 2.7.1 +
- rails 6.0.3 +
- postgresql database
- yarn
- AWS S3 - file storage ** in production **
- Amazon SES - sending emails ** in production **
- google analytics code ** in production **
- google recaptcha API for signing up ** in development & production **
- google oauth API ** in development and production **
- github oauth API ** in development and production **
- facebook oauth API
- stripe API ** in development and production **
rvm install ruby-2.7.1
rvm --default use 2.7.1
rvm uninstall 2.6.3
gem install rails -v 6.0.3
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install postgresql libpq-dev redis-server redis-tools yarn
sudo su postgres
createuser --interactive
ubuntu
y
exit
- Create app
git clone https://github.com/rormvp/corsego
cd corsego
bundle
yarn
sudo apt-get install graphviz
sudo apt install imagemagick
- IMPORTANT Set up your secret credentials, otherwise you will not be able to run the app:
Go to config folder and delete the file credentials.yml.enc
EDITOR=vim rails credentials:edit
and inside the file:
awss3:
access_key_id: YOUR_CODE_FOR_S3_STORAGE
secret_access_key: YOUR_CODE_FOR_S3_STORAGE
google_analytics: YOUR_CODE_FOR_GOOGLE_ANALYTICS
recaptcha:
site_key: YOUR_CODE_FOR_RECAPTCHA
secret_key: YOUR_CODE_FOR_RECAPTCHA
google_oauth2:
client_id: YOUR_CODE_FOR_OAUTH
client_secret: YOUR_CODE_FOR_OAUTH
development:
github:
client: YOUR_CODE_FOR_OAUTH
secret: YOUR_CODE_FOR_OAUTH
stripe:
publishable: YOUR_STRIPE_PUBLISHABLE
secret: YOUR_STRIPE_SECRET
production:
github:
client: YOUR_CODE_FOR_OAUTH
secret: YOUR_CODE_FOR_OAUTH
stripe:
publishable: YOUR_STRIPE_PUBLISHABLE
secret: YOUR_STRIPE_SECRET
facebook:
client: YOUR_CODE_FOR_OAUTH
secret: YOUR_CODE_FOR_OAUTH
smtp:
address: email-smtp.eu-central-1.amazonaws.com
user_name: SMTP_CREDENTIALS_USER_NAME
password: SMTP_CREDENTIALS_PASSWORD
- i = to make the file editable
- :set paste = to disable autoindentation when pasting
- Ctrl + V = to paste
- ESC + : + w + q + Enter = save changes in the file
- Run the migrations
rails db:create
rails db:migrate
- Configure your development environment in config/environments/development.rb
- Start the server
rails s
heroku create
heroku rename *your-app-name*
heroku git:remote -a *your-app-name*
git push heroku master
heroku run rake db:migrate
heroku config:set RAILS_MASTER_KEY=`cat config/master.key`
If you have troubles running the app or any questions don't hesitate to contact me at yashm@outlook.com 🧐
Manually creating an enrollment:
PublicActivity.enabled = false
Enrollment.create(user: User.find(544), course: Course.find(56), price: 0)
rathankumar@outlook.com
add stripe ids to all exiting products
Course.all.each do |course|
product = Stripe::Product.create(name: course.title)
price = Stripe::Price.create(product: product, currency: "usd", unit_amount: course.price.to_i * 100)
course.update(stripe_product_id: product.id, stripe_price_id: price.id)
end