Mise en place de lapplication - rodinux/plannings_cinema GitHub Wiki

Avant de lancer localement l'application

Une fois que vous avez récupérer l'application, il y a quelques étapes que j'explique dans le README de l'application. Je vais détailler un peu plus précisemment.

  • IMPORTANT: Vous aurez besoin avant tout de créer ce fichier manuellement dans le dossier config (ce fichier est inclus dans le .gitignore pour dissimuler la clé secrète de l'environnement de production) :

config/secrets.yml

# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.

# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.

development:
  secret_key_base: 2ca52b6802d2b58b6c960a4533200e8c709640412aa7c85fd4d15795784a874becfcadfe6db8b7d5b131edc10b8ffeda5966b40dcd7756dd443b0198d7594168

test:
  secret_key_base: 4e6b13a56a8e4184391d054d3a67d763025c3b5e17cddb3782038e33c20b360128bca92a229824fb300d5019c203358a6d29d94953ac9b8bc596eaa4543bd53a

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

# is it visible this second time ??

Database

J'ai utiliser Postresql pour la database, mais par défault, Rails peut fonctionner sans (il utilisera une base de données sql...) Vous avez le choix, soit vous configurez des tables de données avec Postresql (à mettre en place), soit vous configurez Rails pour utiliser Mysql. Les configurations dans rails se trouvent dans config/databases.yml celui qui est place ressemble à ça :

development:
  adapter: postgresql
  encoding: unicode
  pool: 5
  timeout: 5000
  username: plannings_ecranvillage
  password: ecran2015
  database: plannings_ecranvillage_development
  host: 127.0.0.1

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

test:
  adapter: postgresql
  encoding: unicode
  pool: 5
  timeout: 5000
  username: plannings_ecranvillage
  password: ecran2015
  database: plannings_ecranvillage_test
  host: 127.0.0.1

production:
  adapter: postgresql
  encoding: unicode
  pool: 5
  timeout: 5000
  username: plannings_ecranvillage
  password: ecran2015
  database: plannings_ecranvillage_production
  host: 127.0.0.1

Si vous préférez ne pas avoir à créer de base de données, effacez la ligne gem 'pg' dans le fichier Gemfile, ajouter une ligne gem 'sqlite3' (par défaut) rails génère par défaut un fichier comme celui-ci (remplacer celui en place par ces lignes) config/databases.yml

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

Tables et executables

faire la migration des tables :

$ rake db:migrate
  • Normallement si tout c'est bien passer, ça devrait fonctionner. Essayer de lancer l'application maintenant en developpement :
$ rails s

Si tout va bien vous devriez pouvoir ensuite l'ouvrir dans votre navigateur à cette adresse

Installation:

  • To configure the application, you can clone it, run
$ git clone https://github.com/rodinux/plannings_ecranvillage.git

or fork it , as you want.

  • Go on your application and install gems :
$ cd plannings_ecranvillage
$ bundle install

Deployment instructions

  • IMPORTANT: You need also to create this file in the folder config (this file is include in .gitignore to hide the production environnement's secret key) :

config/secrets.yml

# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.

# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.

development:
  secret_key_base: 2ca52b6802d2b58b6c960a4533200e8c709640412aa7c85fd4d15795784a874becfcadfe6db8b7d5b131edc10b8ffeda5966b40dcd7756dd443b0198d7594168

test:
  secret_key_base: 4e6b13a56a8e4184391d054d3a67d763025c3b5e17cddb3782038e33c20b360128bca92a229824fb300d5019c203358a6d29d94953ac9b8bc596eaa4543bd53a

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

# is it visible this second time ??

Database

  • It is possible you want to change the database, (I personnally use postgresql), if you want to use it without postgesql and without creating first a database, it is very easy. You need to make few changes, in the file config/database.yml, replace all by :

config/database.yml

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000
  • You always need to migrate the database before running :
$ rake db:migrate
  • To sart the application locally :
$ rails s

if you got it without issues you can now try the application on this link :

That's all :)

application en développement