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

fix folder structure #271

Open
wants to merge 1 commit into
base: develop
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ defaults: &defaults
- TERM: xterm-256color
- CC_TEST_REPORTER_ID: $CC_TEST_REPORTER_ID
working_directory: ~/andela-socials

install_yarn_packages: &install_yarn_packages
run:
name: install dependencies
command: |
yarn --cwd client/package.json install
yarn --cwd client/v1/package.json install

attach_workspace: &attach_workspace
attach_workspace:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
./tmp/cc-test-reporter format-coverage -t coverage.py -o tmp/codeclimate.backend.json coverage.xml
- persist_to_workspace:
root: tmp
paths:
paths:
- codeclimate.backend.json
- store_artifacts:
path: test-reports
Expand All @@ -77,7 +77,7 @@ jobs:
- run:
name: Verify and Check Yarn packages for vulnerabilities
command: |
yarn --cwd client/package.json check --integrity
yarn --cwd client/v1/package.json check --integrity

# If lint check is required uncomment the block of code below
# lint:
Expand All @@ -88,7 +88,7 @@ jobs:
# - run:
# name: Run lint
# command: |
# yarn --cwd client/package.json lint
# yarn --cwd client/v1/package.json lint

frontend_test:
<<: *defaults
Expand All @@ -100,12 +100,12 @@ jobs:
- run:
name: Run frontend test
command: |
yarn --cwd client/package.json test
ls ./client/
./tmp/cc-test-reporter format-coverage -t lcov -o tmp/codeclimate.frontend.json ./client/coverage/lcov.info
yarn --cwd client/v1/package.json test
ls ./client/v1/
./tmp/cc-test-reporter format-coverage -t lcov -o tmp/codeclimate.frontend.json ./client/v1/coverage/lcov.info
- persist_to_workspace:
root: tmp
paths:
paths:
- codeclimate.frontend.json

upload_coverage:
Expand Down Expand Up @@ -162,10 +162,10 @@ workflows:
# - lint
- build
- backend_test:
requires:
requires:
- build
- frontend_test:
requires:
requires:
- build
- upload_coverage:
requires:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ Or run the command below:
make server test
```

To run cypress test for the client side, navigate to the client folder
To run cypress test for the client side, navigate to the client folder and choose which version

```sh
cd client
cd client/{v1 or v2}
```

For e2e tests, ensure you have `cypress.json`, start the server and run:
Expand Down Expand Up @@ -131,7 +131,9 @@ After the build is complete, spin up the docker containers with:
make start
```

Then you can access the client application; served by webpack-dev-server at `http://localhost:9000`, and the backend application; served by the django development server at `http://localhost:8000`
Then you can access the client/v1 application; served by webpack-dev-server at `http://localhost:9000`,
or the client/v2 application; served by webpack-dev-server at `http://localhost:9000`,
and the backend application; served by the django development server at `http://localhost:8000`

To stop the application, you can pull down the containers with:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ module.exports = merge(webpackCommonConfig, {
'Access-Control-Allow-Headers':
'X-Requested-With, content-type, Content-Type, Authorization, accept, accept-encoding, authorization, dnt, origin, user-agent, x-csrftoken, x-requested-with'
},
publicPath: 'http://0.0.0.0:9000/',
port: 9000,
publicPath: 'http://0.0.0.0:3000/',
port: 3000,
compress: true,
proxy: {
'/api/v1': {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion clientV2/server.js → client/v2/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const dotenv = require('dotenv');

dotenv.config();

const PORT = process.env.PORT || 9000;
const PORT = process.env.PORT || 3000;
const app = express();

app.use(express.static(path.join(__dirname, './dist')));
Expand Down
8 changes: 8 additions & 0 deletions client/v2/start-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -e
if [ $NODE_ENV = "production" ]; then
npm start
else
npm run start:dev
fi
File renamed without changes.
21 changes: 18 additions & 3 deletions docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ services:
ports:
- "8000:8000"

client:
client_v1:
container_name: dev_andela_social_client
build:
context: ../../client
context: ../../client/v1
dockerfile: ../docker/dev/client/Dockerfile
env_file:
- ./dev.env
Expand All @@ -44,5 +44,20 @@ services:
ports:
- "9000:9000"
volumes:
- ../../client:/andela_social
- ../../client/v1:/andela_social
- a_socials_node_modules:/andela_social/node_modules

client_v2:
container_name: dev_andela_social_client_v2
build:
context: ../../client/v2
dockerfile: ../docker/dev/client/Dockerfile
env_file:
- ./dev.env
depends_on:
- server
ports:
- "3000:3000"
volumes:
- ../../client/v2:/andela_social
- a_socials_node_modules:/andela_social/node_modules
11 changes: 11 additions & 0 deletions docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ http {
server client:9000;
}

upstream front_end_v2 {
server client:3000;
}

server {
listen 80;
charset utf-8;
Expand All @@ -48,5 +52,12 @@ http {
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}

location /v2 {
proxy_pass http://front_end_v2;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
}
}
6 changes: 3 additions & 3 deletions docker/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ services:
volumes:
- static_dir:/andela_social/static
- staticfiles:/andela_social/staticfiles
client:

client: # not making a change here because I believe we will switch over when it's time
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except maybe we want to have the v2 deployed to a andela-socials-staging.andela.com/v2 route sha.

container_name: prod_andela_social_client
build:
context: ../../client
Expand All @@ -48,7 +48,7 @@ services:
- postgres_backup:/backups
ports:
- "8093:5432"

nginx:
container_name: nginx_server
build: ../nginx
Expand Down
4 changes: 2 additions & 2 deletions docker/release/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ ENV NODE_PATH /usr/local/lib/node_modules/

RUN npm install -g [email protected] [email protected]

COPY client/dist /app/dist
COPY client/server.js /app
COPY client/v1/dist /app/dist
COPY client/v1/server.js /app

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion scripts/deployFrontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ authorize_docker() {
deploy_image() {

echo ${FRONTEND_BASE_URL} ${SERVER_API_BASE_URL} ${G_SUITE_DOMAIN} ${ANDELA_API_BASE_URL} ${CLIENT_ID}
cd client && yarn install
cd client/v1 && yarn install

export NODE_ENV=production

Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function setup_server() {
}

function setup_client() {
cd client
cd client/v1

yarn -v
export status=$?
Expand Down
2 changes: 1 addition & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
set -o pipefail # if any code doesn't return 0, exit the script

function start_client() {
cd client
cd client/v1
yarn start:dev &
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/startProd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi


function start_client() {
cd client
cd client/v1
yarn start &
}

Expand Down