Skip to content

JacquesDurand/p6_oc_snowtricks

Repository files navigation

Codacy analysis
Codacy Badge
SonarCloud analysis
Security Rating
Bugs
Maintainability Rating
Vulnerabilities

Parcours OpenClassrooms: Développeur d'application PHP/Symfony

Projet 6: Développez de A à Z le site communautaire SnowTricks


Description

The goal of this project was to create a communitarian website about snowboards tricks.
It had to contain:

  • A minimum of the following entities:
    • Some Users and the possibility to register/login
    • Some snowboard Tricks and their associated information
    • The possibility to leave a Comment on a trick
  • A front office with:
    • An index with all the tricks
    • A navigation menu
    • Pages for a single trick
    • The possibility to add or edit a trick if registered and connected
    • Forms to:
      • leave a comment on a trick
      • contact the Admin (myself)
      • register/login as a User

NOTA BENE :
The back end has been realised in PHP 8.0 and Symfony 5.3.8.
The front end has been realised through the use of Bootstrap CSS and a tiny bit of Jquery

Table of contents

Installation

Prerequisites

Git

To be able to locally use this project, you will need to install Git on your machine.
Follow the installation instructions here depending on your Operating system.

Docker

This project runs 3 separate applications each in their own containers:

  1. The PostgreSql DataBase
  2. The Nginx Server
  3. The PHP/Symfony application itself

Each is based upon its own Docker Image.
To have them run locally, you will need to install Docker on your machine.
Follow the installation instructions here for most OS or here for Archlinux.

Docker Compose

As defined on the documentation:

Compose is a tool for defining and running multi-container Docker applications.

Since it is our case in this project, we also chose to use compose to build the complete project.
You can see how to install it here

Clone

Move to the parent directory where you wish to clone the project.

git clone https://github.com/JacquesDurand/p6_oc_snowtricks.git

Then move into the newly cloned directory

cd p6_oc_snowtricks

Configuration

This project relies on the use of environment variables, which act as secrets. These are for instance the database connection information.
To prevent sharing my personal information, I didn't commit the .env file where they are contained.
I did commit a .env.dist where you can find the variables needed to launch this project.
Once inside oc-blog directory:

cp .env.dist .env

Then open your newly created .env with your favorite text editor and replace the different " CHANGEME" values by your own.
You might want to keep

DB_PORT= 5432

since the postgres image will run on this port.
Here is an example of .env for this project:

DB_HOST= 'db'
DB_PORT= 5432
DB_NAME= 'mydb'
DB_USERNAME= 'myUser'
DB_PASSWORD= 'myPassword'
MAIL_TO= '[email protected]'
MAILER_DSN=yourSendGridDSN

Where:

MAIL_TO

is your mail for receiving messages through the site's contact form and for sending other mails ( password resetting for instance)
Be aware though that for these forms to really send email, you have to set up an account with a mail provider such as Sendgrid

Getting Started

Launching the containers

Now that everything has been configured, let us get into it !
Still at the root of p6_oc_snowtricks, run :

docker-compose up -d

Creating the Database

Some migrations files are already created for you that will create the database structure.
Run the following to enter your app container

docker-compose exec app sh

You can then do:

php bin/console doctrine:migrations:migrate

to execute the migrations.
If you want to fill you db with production-ready data, you can also execute the following command:

php bin/console app:fixtures:load_prod

If everything went fine, you should be able to navigate to localhost and start looking around my blog.
If not, please do not hesitate to submit an issue and I'll get back to you ASAP.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published