Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jahjedtieson committed Apr 17, 2021
2 parents 4288ddd + d050a52 commit a3c22a6
Show file tree
Hide file tree
Showing 343 changed files with 23,460 additions and 11,585 deletions.
13 changes: 9 additions & 4 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ EDAN_SERVER=
EDAN_APPID=
OCFL_STORAGE_ROOT=
OCFL_STAGING_ROOT=
COOK_SERVER_URL=
AUTH_TYPE=
LDAP_SERVER=
LDAP_PASSWORD=
LDAP_CN=
LDAP_OU=
LDAP_DC=

# SOLR
PACKRAT_SOLR_PORT=
PACKRAT_SOLR_HOST=





# PROXY
PACKRAT_PROXY_PORT=
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ node_modules/
**/.webpack/
*.json
*.md
*.yml
*.yml
client/src/types/graphql.tsx
server/types/graphql.ts
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ module.exports = {
'object-shorthand': ['error', 'always'],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
'require-atomic-updates': 'off',
// JSX RULES
'jsx-quotes': ['error', 'prefer-single'],
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup test DB
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test -e 'CREATE DATABASE IF NOT EXISTS Packrat'

- name: Setup test DB Schema
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test < server/db/sql/scripts/Packrat.SCHEMA.sql
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test --database=Packrat < server/db/sql/scripts/Packrat.SCHEMA.sql

- name: Setup test DB Proc
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test < server/db/sql/scripts/Packrat.PROC.sql
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test --database=Packrat < server/db/sql/scripts/Packrat.PROC.sql

- name: Setup test DB Data
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test < server/db/sql/scripts/Packrat.DATA.sql
run: mysql -h 127.0.0.1 -v -P 3306 -u root --password=test --database=Packrat < server/db/sql/scripts/Packrat.DATA.sql

- name: Setup node version
uses: actions/setup-node@v1
Expand All @@ -82,11 +85,12 @@ jobs:
DATABASE_URL: mysql://root:test@localhost:3306/Packrat

build:
# Only run this step on push to specified branches (PR merge counts as push too)
if: github.event_name == 'push'
# Only run this step on pull_request or push to specified branches (PR merge counts as push too)
if: ${{github.event_name == 'pull_request' || github.event_name == 'push'}}
runs-on: ubuntu-latest
needs: test
env: # Ideally this will be stored in github secrets and will be accessed via ${{ secrets.* }}
PACKRAT_PROXY_PORT: 80
PACKRAT_CLIENT_PORT: 3000
PACKRAT_SERVER_PORT: 4000
PACKRAT_DB_PORT: 3306
Expand All @@ -109,16 +113,17 @@ jobs:
run: touch .env.dev && touch .env.prod

- name: Build Dev images
run: docker-compose --env-file .env.dev -f docker-compose.dev.yml build
if: contains(github.ref, 'develop')
if: ${{!contains(github.ref, 'master')}}
run: docker-compose --env-file .env.dev -f ./conf/docker/docker-compose.dev.yml build

- name: Build Prod images
run: docker-compose --env-file .env.prod -f docker-compose.prod.yml build
if: contains(github.ref, 'master')
run: docker-compose --env-file .env.prod -f ./conf/docker/docker-compose.prod.yml build

# Prepares tag for docker images
- name: Prepare image tag
id: prepare-tag
if: ${{contains(github.ref, 'develop') || contains(github.ref, 'master')}}
run: |
if [ ${{ contains(github.ref, 'master') }} = true ]; then stage="prod"; else stage="dev"; fi
version=${{ steps.packrat-version.outputs.current-version }}
Expand All @@ -127,6 +132,7 @@ jobs:
# Tags images with "stage-env-version-commit-sha" eg. dev-1.0.0-abcd123
- name: Tag images
if: ${{contains(github.ref, 'develop') || contains(github.ref, 'master')}}
run: |
echo Tagging with ${{ steps.prepare-tag.outputs.tag }}
docker tag packrat-server:latest packrat-server:${{ steps.prepare-tag.outputs.tag }}
Expand All @@ -135,11 +141,13 @@ jobs:
# Runs commands post-build
- name: Build cleanup
if: ${{contains(github.ref, 'develop') || contains(github.ref, 'master')}}
run: |
echo Cleaning up redundant tags
docker rmi packrat-server:latest packrat-client:latest packrat-proxy:latest
docker images
# Pushes built images to container registry
- name: Push images
if: ${{contains(github.ref, 'develop') || contains(github.ref, 'master')}}
run: echo Pushing images to container registry...
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ dist
.vscode/*

### Builds ###
build
build

### Custom ###
server/var
server/tests/mock/models/**/eremotherium_laurillardi*
server/config/solr/data/packrat/data
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ node_modules/
**/.webpack/
*.json
*.md
*.yml
*.yml
client/src/types/graphql.tsx
server/types/graphql.ts
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
printWidth: 180,
tabWidth: 4,
trailingComma: 'none',
jsxBracketSameLine: true,
jsxBracketSameLine: false,
jsxSingleQuote: true,
arrowParens: 'avoid'
};
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,22 @@ yarn start:server
# Alternative docker workflow:

```
# If step 2. wasn't working, follow this alternative instead.
# Creates Devbox for packrat
yarn devbox:up
# Creates DB for devbox
yarn devbox:db
# Create and Connects db and devbox to the same network
# Creates SOLR for devbox
yarn devbox:solr
# Create and Connects devbox-db, devbox-solr, and devbox to the same network
yarn devbox:network
# Drops you into shell inside the image
yarn devbox:start
```

*Note: if you get permission denied during the execution make sure to give it permission using:*
```
chmod 777 ./scripts/devbox/*.sh
chmod 777 ./conf/scripts/devbox/*.sh
```

# Deployment instructions:
Expand All @@ -89,7 +92,7 @@ git checkout master

4. Deploy using the `deploy.sh` script
```
./scripts/deploy.sh prod
./conf/scripts/deploy.sh prod
```
If you get `permission denied for docker` then use
```
Expand All @@ -100,23 +103,23 @@ If you get `Error while loading shared libraries: libz.so.1` for `docker-compose
sudo mount /tmp -o remount,exec
```

5. Wait for the images to be build/updated, then use `cleanup.sh` script to cleanup any residual docker images are left (optional)
5. Wait for the images to be build/updated, then use `./conf/scripts/cleanup.sh` script to cleanup any residual docker images are left (optional)

6. Make sure nginx is active using `sudo service nginx status --no-pager`

## Start databases (Production server only):

1. Start `dev` or `prod` databases using `scripts/initdb.sh` script
1. Start `dev` or `prod` databases using `./conf/scripts/initdb.sh` script
```
MYSQL_ROOT_PASSWORD=<your_mysql_password> ./scripts/initdb.sh dev
MYSQL_ROOT_PASSWORD=<your_mysql_password> ./conf/scripts/initdb.sh dev
```
*Note: `MYSQL_ROOT_PASSWORD` be same what you mentioned in the `.env.dev` or `.env.prod` file for that particular environment. Mostly would be used for `dev` environment.*

## Update production nginx configuration (Production server only):

1. Make the changes to production nginx configuration is located at `scripts/proxy/nginx.conf`

2. Use `scripts/proxy/refresh.sh` script to restart/update nginx service
2. Use `conf/scripts/refreshProxy.sh` script to restart/update nginx service
```
./scripts/proxy/refresh.sh
./conf/scripts/refreshProxy.sh
```
11 changes: 8 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dpo-packrat/client",
"version": "0.4.0",
"version": "0.6.0",
"private": true,
"license": "Apache-2.0",
"description": "Client for Packrat",
Expand All @@ -25,6 +25,7 @@
"@apollo/client": "3.1.5",
"@date-io/date-fns": "1.3.13",
"@material-ui/core": "4.11.0",
"@material-ui/data-grid": "4.0.0-alpha.20",
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "4.0.0-alpha.56",
"@material-ui/pickers": "3.2.10",
Expand Down Expand Up @@ -69,6 +70,10 @@
"yup": "0.29.3",
"zustand": "3.1.3"
},
"devDependencies": {
"jest": "24.9.0",
"ts-jest": "24.3.0"
},
"scripts": {
"start": "react-app-rewired start",
"start:prod": "react-app-rewired start",
Expand All @@ -92,7 +97,7 @@
]
},
"volta": {
"node": "12.18.4",
"yarn": "1.22.4"
"node": "14.16.0",
"yarn": "1.22.10"
}
}
11 changes: 6 additions & 5 deletions client/src/components/controls/DateInputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const useStyles = makeStyles(({ palette, typography, breakpoints }) => ({
width: '50%',
background: palette.background.paper,
border: (updated: boolean) => `1px solid ${fade(updated ? palette.secondary.main : palette.primary.contrastText, 0.4)}`,
backgroundColor: (updated: boolean) => updated ? palette.secondary.light : palette.background.paper,
backgroundColor: (updated: boolean) => (updated ? palette.secondary.light : palette.background.paper),
padding: '1px 8px',
color: Colors.defaults.white,
marginTop: 0,
Expand All @@ -26,14 +26,15 @@ const useStyles = makeStyles(({ palette, typography, breakpoints }) => ({
minWidth: 160,
maxWidth: 160,
'& > div > input': {
fontSize: '0.8em',
fontSize: '0.8em'
}
}
},
marginBottom: 0
}
}));

interface DateInputFieldProps extends ViewableProps {
value: Date;
value: Date | null | string;
onChange: (date: MaterialUiPickersDate, value?: string | null | undefined) => void;
}

Expand All @@ -58,4 +59,4 @@ function DateInputField(props: DateInputFieldProps): React.ReactElement {
);
}

export default DateInputField;
export default DateInputField;
34 changes: 34 additions & 0 deletions client/src/components/controls/ReadOnlyRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable react/jsx-max-props-per-line */

/**
* ReadOnlyRow
*
* */
import React from 'react';
import { Typography, Box } from '@material-ui/core/';
import { ViewableProps } from '../../types/repository';
import FieldType from '../shared/FieldType';

interface ReadOnlyRowProps extends ViewableProps {
label: string;
value?: number | string | null;
}

function ReadOnlyRow(props: ReadOnlyRowProps): React.ReactElement {
const { label, value } = props;

const rowFieldProps = { alignItems: 'center', justifyContent: 'space-between', style: { borderRadius: 0 } };

return (
<FieldType required={false} label={label} direction='row' containerProps={rowFieldProps} width='auto'>
<Box width='fit-content' textAlign='right'>
<Typography variant='caption' style={{ fontFamily: 'Roboto, Helvetical, Arial, sans-serif', color: '#2C405A', overflowWrap: 'break-word' }}>
{value}
</Typography>
</Box>
</FieldType>
);
}

export default ReadOnlyRow;
25 changes: 12 additions & 13 deletions client/src/components/controls/SelectField.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react/jsx-max-props-per-line */

/**
* SelectField
*
Expand All @@ -16,15 +18,15 @@ const useStyles = makeStyles(({ palette, typography, breakpoints }) => ({
padding: '0px 10px',
background: palette.background.paper,
border: (updated: boolean) => `1px solid ${fade(updated ? palette.secondary.main : palette.primary.contrastText, 0.4)}`,
backgroundColor: (updated: boolean) => updated ? palette.secondary.light : palette.background.paper,
backgroundColor: (updated: boolean) => (updated ? palette.secondary.light : palette.background.paper),
borderRadius: 5,
fontFamily: typography.fontFamily,
[breakpoints.down('lg')]: {
fontSize: '0.8em',
minWidth: 180,
maxWidth: 180,
maxWidth: 180
}
},
}
}));

interface SelectFieldProps extends ViewableProps {
Expand Down Expand Up @@ -53,18 +55,15 @@ function SelectField(props: SelectFieldProps): React.ReactElement {
containerProps={rowFieldProps}
width={width || viewMode ? 'auto' : undefined}
>
<Select
value={value}
className={classes.select}
name={name}
onChange={onChange}
disabled={disabled}
disableUnderline
>
{options.map(({ idVocabulary, Term }, index) => <MenuItem key={index} value={idVocabulary}>{Term}</MenuItem>)}
<Select value={value || ''} className={classes.select} name={name} onChange={onChange} disabled={disabled} disableUnderline>
{options.map(({ idVocabulary, Term }, index) => (
<MenuItem key={index} value={idVocabulary}>
{Term}
</MenuItem>
))}
</Select>
</FieldType>
);
}

export default SelectField;
export default SelectField;
2 changes: 2 additions & 0 deletions client/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import EmptyTable from './shared/EmptyTable';
import EnvBanner from './shared/EnvBanner';
import DebounceNumberInput from './controls/DebounceNumberInput';
import CheckboxField from './controls/CheckboxField';
import ReadOnlyRow from './controls/ReadOnlyRow';

export {
Header,
Expand All @@ -44,6 +45,7 @@ export {
EnvBanner,
DebounceNumberInput,
CheckboxField,
ReadOnlyRow
};

export type { RepositoryIconProps };
Loading

0 comments on commit a3c22a6

Please sign in to comment.