# App Local Environment Setup

# Mac OS

Instructions are using the following tools:

For Microsoft VS Code, it is suggested to use the following extensions:

# Step 1 - Clone development environment repository from Github

  1. Clone the repository using the following command:
% git clone https://github.com/WhatsUp247/wu247docker.git
  1. Copy the folder "ios" to the location where you would like have the working site build.
    • P.S. If you are not working in the API, you can just delete that folder from build. Also in the docker-compose.yml file, delete lines 28-39 because you will not need to build the api container.
  2. Remove the following items from the root directory.
    • .git folder (hidden)
    • .gitignore file (hidden)
  3. Unzip the file called vendor in the app folder.

# Step 2 - Clone application repository from Github

  1. In terminal, navigate to the app folder
  2. Clone the repository using the following command:
% git init
% git remote add origin https://github.com/WhatsUp247/wu247app.git
% git pull origin master
  1. Download the autoload folder from this Dropbox Folder (opens new window)
  2. Add all files from config folder to the repository in the folder /app/config/autoload folder using this

# Step 3 - Application Build

  1. Build and Run the container using the following command:
% docker-compose up -d
  1. Check that the container is running by using the following command:
% docker ps

Restart the application container.

# Step 4 - Configure Database

  1. Access the database's shell using Docker extention
  2. Access MySQL with the following command
% mysql
  1. Create a user (replace brackets and content with your information)
> CREATE USER '[username]'@'%' IDENTIFIED BY '[password]';
  1. Give administrative privileges using the commands below, inserting your own [username]:
> GRANT ALL PRIVILEGES ON * . * TO '[username]'@'%';
  1. Create a database using the following command:
> CREATE DATABASE [database_name];
  1. Select database:
> USE [database_name];
  1. Import database from the zip file provided using this command:
> SOURCE /tmp/wu247-lab-backup.sql;
  1. Type the following command to check that the database has been imported and make sure you see a user table listed:
> SHOW TABLES

# Step 5 - Configure Application

In the application folder /app/config/autoload, there are two files that need to be edited, wu247model.global.php and wu247model.local.php.

# Edit Global File

In the wu247model.global.php, we need to adjust the database name and the host name for every database option label dsn. You will need to replace [database_name] with the database name from the MySQL Container and replace [mysql_container_name] with the name of the MySQL Container. Find the MySQL Container name by using the following command:

% docker ps

Line example:

'dsn' => 'mysql:dbname=[database_name];host=[mysql_container_name]',

# Edit Local File

In the wu247model.local.php, we need to update every line of usernames and passwords to match your database user.

'username' => '[username]',
'password' => '[password]',

Restart the application container.

# Step 6 - Confirm Application is Running Correctly

In your browser, view localhost and you should see the What's Up 24/7 web page.

# Windows