diff --git a/README.md b/README.md index 570c12a..01bda81 100644 --- a/README.md +++ b/README.md @@ -12,27 +12,27 @@ Wiaas implementation based on wordpress [woocommerce](https://woocommerce.com/) ## Local Docker setup - 1) Copy environment.env file and rename it to .env +1) Copy environment.env file and rename it to .env + + cp environment.env .env + +2) Edit .env file and add needed information + + * `MYSQL_ROOT_PASSWORD` - MySQL database root password for MySQL docker image + * `MYSQL_DATABASE` - Wordpress database name + * `MYSQL_USER` - Wordpress database user + * `MYSQL_PASSWORD` - Wordpress database password + * `MYSQL_HOST` - Wordpress database host (will be `db` for docker) + * `WP_ENV` - Set to environment (`local`, `development`, `production`) + * `API_URL` - Full URL to WordPress home (http://localhost:8081 if you are testing locally) + * `WP_AUTH_KEY`, `WP_SECURE_AUTH_KEY`, `WP_LOGGED_IN_KEY`, `WP_NONCE_KEY`, `WP_AUTH_SALT`, `WP_SECURE_AUTH_SALT`, `WP_LOGGED_IN_SALT`, `WP_NONCE_SALT`, `WP_JWT_AUTH_SECRET_KEY` + +3) Execute in the root of the project : - cp environment.env .env - - 2) Edit .env file and add needed information + sudo docker-compose build + sudo docker-compose up - * `MYSQL_ROOT_PASSWORD` - MySQL database root password for MySQL docker image - * `MYSQL_DATABASE` - Wordpress database name - * `MYSQL_USER` - Wordpress database user - * `MYSQL_PASSWORD` - Wordpress database password - * `MYSQL_HOST` - Wordpress database host (will be `db` for docker) - * `WP_ENV` - Set to environment (`local`, `development`, `production`) - * `API_URL` - Full URL to WordPress home (http://localhost:8081 if you are testing locally) - * `WP_AUTH_KEY`, `WP_SECURE_AUTH_KEY`, `WP_LOGGED_IN_KEY`, `WP_NONCE_KEY`, `WP_AUTH_SALT`, `WP_SECURE_AUTH_SALT`, `WP_LOGGED_IN_SALT`, `WP_NONCE_SALT`, `WP_JWT_AUTH_SECRET_KEY` - - 3) Execute in the root of the project : - - sudo docker-compose build - sudo docker-compose up - - Frontend is running on http://localhost:8080 and backend on http://localhost:8081 +Frontend is running on http://localhost:8080 and backend on http://localhost:8081 @@ -41,51 +41,51 @@ Wiaas implementation based on wordpress [woocommerce](https://woocommerce.com/) ### DB setup - 1) Create MYSQL database / user +1) Create MYSQL database / user - CREATE DATABASE ${MYSQL_DATABASE}; - CREATE USER '${MYSQL_USER}'@'localhost' IDENTIFIED BY '${MYSQL_PASSWORD}'; - GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@localhost; + CREATE DATABASE ${MYSQL_DATABASE}; + CREATE USER '${MYSQL_USER}'@'localhost' IDENTIFIED BY '${MYSQL_PASSWORD}'; + GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@localhost; - 2) Seed database with `new-wiaas/database/clean-dump.sql` +2) Seed database with `new-wiaas/database/clean-dump.sql` ### Backend setup - 1) Environment variables +1) Environment variables - For handling environment variables during local development we use `dotenv` library which will load all variables from `local.env` file - if such file is present. These variables will then be accessible inside wordpress. +For handling environment variables during local development we use `dotenv` library which will load all variables from `local.env` file +if such file is present. These variables will then be accessible inside wordpress. - cp environment.env local.env - - Update `local.env` with your local environment variables. - - 2) Apache + cp environment.env local.env - Point your apache server to `new-wiaas/backend` by updating apache default host files to point to it. - (do not copy folder content to `/var/www/html`, since then dotenv will not be able to load `local.env` file since it is placed one folder above.) +Update `local.env` with your local environment variables. - 3) Wordpress +2) Apache - Run setup commands to install wordpress and required plugins with composer: +Point your apache server to `new-wiaas/backend` by updating apache default host files to point to it. +(do not copy folder content to `/var/www/html`, since then dotenv will not be able to load `local.env` file since it is placed one folder above.) - cd backend - composer install - composer update-db +3) Wordpress + +Run setup commands to install wordpress and required plugins with composer: + + cd backend + composer install + composer update-db ### Frondend setup - 1) Install dependencies +1) Install dependencies + + cd frontend + npm install + +2) Start local server - cd frontend - npm install - - 2) Start local server - - cd frontend - npm start + cd frontend + npm start ## Contribution @@ -94,7 +94,7 @@ Wiaas implementation based on wordpress [woocommerce](https://woocommerce.com/) - Project structure - Project structure is inspired with [Roots Bedrock structure](https://roots.io/bedrock/). +Project structure is inspired with [Roots Bedrock structure](https://roots.io/bedrock/). ├── composer.json # → Manage versions of WordPress, plugins & dependencies