Giter Site home page Giter Site logo

pr0cessa / rails_junior_code_challenge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from takl/rails_junior_code_challenge

0.0 1.0 0.0 973 KB

Basic rails app for modification in code challenges

Ruby 77.63% JavaScript 3.16% CSS 1.90% HTML 15.66% Dockerfile 0.82% Shell 0.84%

rails_junior_code_challenge's Introduction

README

This is a basic rails app with a single route leading to the /me endpoint.

Things to be done:

  • Set up a database of your choosing to be used for storing user data (username/encrypted passwords)

      CREATE TABLE `users` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `username` varchar(255) NOT NULL,
      `pswd` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`id`),
      UNIQUE KEY `email` (`username`)
      ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
    
      INSERT INTO `users` (`username`, `pswd`) VALUES ('[email protected]', MD5('pass123'));
      INSERT INTO `users` (`username`, `pswd`) VALUES ('[email protected]', MD5('shr54q!'));
    
  • The /me endpoint should be authenticated using whatever method of user authentication you are comfortable with [Done but lamely]

      Instinctively, because it's a custom route/endpoint, I would do this with authtoken... For now just made  		  a login/password box, which I know is extremely dumb, how's this usually done in Rails/default method? 
    
  • When a user makes an authenticated request to the /me endpoint, return a json payload greeting the user with their name (replace the current placeholder)

  • When a request is made with failing authentication, an appropriate error is returned

  1. Create a docker image for the sample application. sudo docker build . -t rails_junior_code_challenge sudo docker run --name rails_junior_code_challenge-mysql -e MYSQL_ROOT_PASSWORD=w3lcome9 -d mysql:5.5.62

  2. Using the server 45.79.214.242 with the login root and password mE_vzkm2x7wxs.MUPZ2_ :

    • Configure the server for SSH public key authentication.
    • Add our public key as well as the one provided below
    • Install NGINX and Docker and configure them both to automatically start at boot. sudo systemctl enable docker
    • Using the default configuration for NGINX, create a reverse proxy that points to Docker image.
    • Configure NGINX so that the default server name is laura.takl.dev
    • Setup and configure certbot for the given domain name. echo "#!/bin/bash" >> /etc/init.d/nginx-passenger.sh echo "sudo /usr/sbin/nginx" >> /etc/init.d/nginx-passenger.sh sudo update-rc.d nginx-passenger.sh defaults
    • HTTP traffic should be forwarded to HTTPS by default https://laura.takl.dev/
    • Configure cert bot so that it will auto-renew the certificate.
      echo "0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew" | sudo tee -a /etc/crontab > /dev/null

Keep in mind the best security practices when setting up the server.

Public Key:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/OnTyD2h+0gASb0uXsTQ051izuw1SVXqUlwmfW4IigZ6wOxO5KW1ROYXZ+hjeRiAGZloDLgS1GQJ+jny2wkJ5jqGP904JuVMFqLdUbAWAht9q4E22HY6gNyT5/N9Y/5N2wzV2ZUMrjQzJYZkRMtC6e3OdlFfPwA/C752S+idqlie5jgAyKwnBqIXcfpoVlQ/1qiRih0Q9QuFCZh7BIGaKcnmg/04DTcGpYUsSZxwCRyiBsnmRM3e36uQmhU/71dKoSF+gYdlpey2qOwQ/mr9WMcrSVmQnL2/1IkK/IBP9ReCQ2ln8bykWY2duIZEjxv8IpnrJIHgH/5owfWjVQIZwy2RchxFFKYiBz7MsfL6ARCVq0oSMlW6qS9tVUXu/U2YUzhQGkudwi2axekSBAb0dmOyWvOSgLRn8iJOwLZjg/g+f9p5QjAxBcry9jTqIyTfT8pWApCLIGt/+kc/Fw61ETA+pjp1BvQ/kGkXRn1tdXMGP7NzN3fizgVkrpMJZt38= [email protected]

rails_junior_code_challenge's People

Contributors

pr0cessa avatar lealexander avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.