Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create docker environment #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ APP_SECRET=2a45d2e71fe1aa844fad8744ff9846a6
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
DATABASE_URL=mysql://gameher:gameherpwd@gh-mysql:3306/gameher
###< doctrine/doctrine-bundle ###

###> oauth2/discord ###
Expand Down
53 changes: 27 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

###> custom ignores ###
.idea
public/uploads/*
###< custom ignores ###

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

###> custom ignores ###
.idea
public/uploads/*
docker/logs/*
###< custom ignores ###
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Git server
install: ## Install dockers
docker-compose up -d
${MAKE} install-composer-deps
${MAKE} setup-db
${MAKE} setup-ssl
#${MAKE} setup-npm ## commented because very slow
${MAKE} end-message


install-composer-deps: ## Install composer dependencies
docker exec -i gh-web sh -c "composer clear-cache && composer install"
docker exec -i gh-web sh -c "cp .env .env.local"

setup-db: ## Imports database structure and content to mysql
docker exec -i gh-web sh -c "php bin/console do:da:dr --if-exists --force"
docker exec -i gh-web sh -c "php bin/console do:da:cr"
docker exec -i gh-web sh -c "/usr/bin/php bin/console do:mi:mi -n"

setup-ssl: ##Create openssl keys
docker exec -i gh-web sh -c "openssl genrsa -passout pass:test -out var/jwt/private.pem -aes256 4096"
docker exec -i gh-web sh -c "openssl rsa -passin pass:test -pubout -in var/jwt/private.pem -out var/jwt/public.pem"

setup-npm: #install npm dependencies
docker exec -i gh-web sh -c "npm install"

assets:
docker exec -i gh-web sh -c "npm run dev"

up:
docker-compose up -d --build

stop:
docker-compose stop

tty:
docker exec -ti gh-web bash

db:
docker exec -ti gh-mysql sh -c "mysql -u gameher -pgameherpwd gameher"

end-message: #
@echo "-------------------------------------------------------------"
@echo "| |"
@echo "| DOCKER SETUP ENDED SUCCESSFULLY |"
@echo "| |"
@echo "-------------------------------------------------------------"
@echo ""
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,27 @@ You can then launch the webpack server with a watcher by running `npm run watch`

Then head over to http://localhost:3000 (with Symfony CLI) or to your webserver to start working

You can run the application with Docker:
Clone the repo and run `make install`
This will setup the docker images, install the dependencies and run the migrations
You can then run `npm install` and `npm run dev` at the root of the repository in order to install and compile assets.
You might need to setup your hosts to redirect `gameher.dev` to localhost

After this first installation, you can boot up the docker containers by simply running `make up`
Log into the different containers by running `make tty` for the symfony container and `make db` for the mysql container
Recompile the front assets with `make assets`
Stop the containers with `make stop`


### Configuring Discord

The app uses Discord's OAuth server to handle user. In order to login and access the admin panel, you need to configure a Discord app.

Head over to [Discord's Developer Portal](https://discordapp.com/developers/applications) and create a **New Application** and fill its name
On the *General Information* tab, you can retrieve the client ID and client Secret that you need to add to your `.env` file
On the *OAuth2* tab, click on **Add Redirect** and enter the app's redirect url. The format will be:
`http://YOUR_APP_URL/connect/discord/check
`
`http://YOUR_APP_URL/connect/discord/check`

In the scopes section, select `identify`, `email` and `connections`

Finally, **Save Changes** ! You can now log into the app
Expand All @@ -64,9 +76,9 @@ Then you need to go in your repository `$ cd GameHer` you will also need to set
`$ git remote add upstream git@github.com:Noelierx/GameHer.git`


And you good to work ! Now you just have to create new branches like that :
And you good to work ! Now you just have to create new branches like that :
`$ git checkout -b <add-your-new-branch-name>` Do your stuff and then commit with this command line : `git commit -m "Stuff you have done"`


Then, you will have to do a pull request by typing `$ git push origin <add-your-branch-name>`
And go back to github to click on the button 'Compare and Pull Request'.
And go back to github to click on the button 'Compare and Pull Request'.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"ext-ctype": "*",
"ext-iconv": "*",
"ext-intl": "*",
"composer-runtime-api": "^2.0",
"doctrine/doctrine-bundle": "^1.11",
"doctrine/doctrine-migrations-bundle": "^2.0",
"doctrine/orm": "^2.6",
Expand Down