diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ccf5896 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +.github/ +docs/ +.DS_Store +.gitignore +.project +.pydevproject +CHANGELOG.md +CODE_OF_CONDUCT.md +CONTRIBUTING.md +docker-compose.test.yml +LICENSE +Makefile +PULL_REQUEST_TEMPLATE.md +README.md +requirements.txt diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ba90557 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# Default code owner + +* @Senzing/senzing-engineering diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..d3a80d7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +**Smartphone (please complete the following information):** + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/documentation_request.md b/.github/ISSUE_TEMPLATE/documentation_request.md new file mode 100644 index 0000000..c18a3fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_request.md @@ -0,0 +1,26 @@ +--- +name: Documentation request +about: Identify an area for improvement in documentation + +--- + +**What is the URL of the documentation?** + +- **Example:** https://github.com/Senzing/template-docker#external-database + - *Note:* This URL includes the web page and the section of the documentation. + +**What can be improved?** + +A clear and concise description of what can be improved. +Examples: + +- "I don't understand where the ${XYZ} variable is set." +- "There seems to be a step missing between 'X' and 'Z'. I don't know how to get to 'Z'." +- "When I run `command sub-command ...` I get the following error:" +- "I don't know what is meant by 'gerble barb gazoink` in the instructions". + +**Additional context** + +Add any other context or screenshots to help describe the documentation improvement. +If you think the documentation improvement is operating system specific, +please indicate which operating system is being used. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..066b2d9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/senzing-corporate-contributor-license-agreement.pdf b/.github/senzing-corporate-contributor-license-agreement.pdf new file mode 100644 index 0000000..dac5edb Binary files /dev/null and b/.github/senzing-corporate-contributor-license-agreement.pdf differ diff --git a/.github/senzing-individual-contributor-license-agreement.pdf b/.github/senzing-individual-contributor-license-agreement.pdf new file mode 100644 index 0000000..12ea6bd Binary files /dev/null and b/.github/senzing-individual-contributor-license-agreement.pdf differ diff --git a/.github/workflows/add-to-project-t-ast.yaml b/.github/workflows/add-to-project-t-ast.yaml new file mode 100644 index 0000000..7bb8948 --- /dev/null +++ b/.github/workflows/add-to-project-t-ast.yaml @@ -0,0 +1,22 @@ +# Based on +# - https://github.com/srggrs/assign-one-project-github-action + +name: Auto Assign issue to project + +on: + issues: + types: + - reopened + - opened +env: + GITHUB_TOKEN: ${{ secrets.SENZING_GITHUB_ACCESS_TOKEN }} + +jobs: + assign_one_project: + runs-on: ubuntu-latest + steps: + - name: Assign issues to project + uses: Senzing/github-action-add-issue-to-project@main + with: + project: 'https://github.com/orgs/Senzing/projects/6' + column_name: 'Backlog' diff --git a/.github/workflows/add-triage-label.yaml b/.github/workflows/add-triage-label.yaml new file mode 100644 index 0000000..7512f32 --- /dev/null +++ b/.github/workflows/add-triage-label.yaml @@ -0,0 +1,23 @@ +# Based on +# - https://docs.github.com/en/actions/guides/adding-labels-to-issues +# - https://github.com/andymckay/labeler + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Simple Issue Labeler +on: + issues: + types: + - reopened + - opened +jobs: + automate-issues-labels: + runs-on: ubuntu-latest + steps: + - name: initial labeling + uses: andymckay/labeler@1.0.3 + with: + add-labels: "triage" diff --git a/.github/workflows/identify-customer.yaml b/.github/workflows/identify-customer.yaml new file mode 100644 index 0000000..2a624f7 --- /dev/null +++ b/.github/workflows/identify-customer.yaml @@ -0,0 +1,35 @@ +name: identify_customer + +on: + issues: + types: + - opened +env: + GITHUB_TOKEN: ${{ secrets.ORG_MEMBERSHIP_TOKEN }} + MEMBER_LIST: ${{ secrets.SENZING_MEMBERS }} + CREATOR: ${{ github.actor }} + TITLE: ${{ github.event.issue.title }} + NUMBER: ${{ github.event.issue.number }} + TOKEN: ${{ secrets.SENZING_SLACK_BEARER_TOKEN }} + REPO_URL: ${{ github.repository }} + SLACK_HASHES: ${{ secrets.SENZING_GITHUB_SLACK_MAP }} + +jobs: + check-membership: + runs-on: ubuntu-latest + steps: + - name: run script + env: + BOOL: ${{ contains( env.MEMBER_LIST, env.CREATOR ) }} + if: ${{ env.BOOL == 'false' }} + uses: Senzing/github-action-identify-customer@main + automate-issues-labels: + runs-on: ubuntu-latest + steps: + - name: initial labeling + env: + BOOL: ${{ contains( env.MEMBER_LIST, env.CREATOR ) }} + if: ${{ env.BOOL == 'false' }} + uses: andymckay/labeler@1.0.3 + with: + add-labels: "customer-submission" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/.project b/.project new file mode 100644 index 0000000..01c2cda --- /dev/null +++ b/.project @@ -0,0 +1,4 @@ + + + entity-search-web-app-console + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..93b6169 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +[markdownlint](https://dlaa.me/markdownlint/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +- Thing 5 +- Thing 4 + +## [1.0.1] - yyyy-mm-dd + +### Added to 1.0.1 + +- Thing 3 + +### Fixed in 1.0.1 + +- Thing 2 + +## [1.0.0] - yyyy-mm-dd + +### Added to 1.0.0 + +- Thing 2 +- Thing 1 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f6f9f91 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@senzing.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..db50261 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,124 @@ +# Contributing + +Welcome to the project! + +We encourage contribution in a manner consistent with the [Code of Conduct](CODE_OF_CONDUCT.md). +The following will guide you through the process. + +There are a number of ways you can contribute: + +1. [Asking questions](#questions) +1. [Requesting features](#feature-requests) +1. [Reporting bugs](#bug-reporting) +1. [Contributing code or documentation](#contributing-code-or-documentation) + +## License Agreements + +If your contribution modifies the git repository, the following agreements must be established. + +*Note:* License agreements are only needed for adding, modifying, and deleting artifacts kept within the repository. +In simple terms, license agreements are needed before pull requests can be accepted. +A license agreement is not needed for submitting feature request, bug reporting, or other project management. + +### Individual Contributor License Agreement + +In order to contribute to this repository, an +[Individual Contributor License Agreement (ICLA)](.github/senzing-individual-contributor-license-agreement.pdf) +must be completed, submitted and accepted. + +### Corporate Contributor License Agreement + +If the contribution to this repository is on behalf of a company, a +[Corporate Contributor License Agreement (CCLA)](.github/senzing-corporate-contributor-license-agreement.pdf) +must also be completed, submitted and accepted. + +### Project License Agreement + +The license agreement for this repository is stated in the +[LICENSE](LICENSE) file. + +## Questions + +Please do not use the GitHub issue tracker to submit questions. + +TODO: Instead, use ??? + +1. ??? Slack ??? +1. ??? stackoverflow.com ??? + +## Feature Requests + +All feature requests are "GitHub issues". +To request a feature, create a +[GitHub issue](https://help.github.com/articles/creating-an-issue/) +in this repository. + +When creating an issue, there will be a choice to create a "Bug report" or a "Feature request". +Choose "Feature request". + +## Bug Reporting + +All bug reports are "GitHub issues". +Before reporting on a bug, check to see if it has +[already been reported](https://github.com/search?q=+is%3Aissue+user%3Asenzing). +To report a bug, create a +[GitHub issue](https://help.github.com/articles/creating-an-issue/) +in this repository. + +When creating an issue, there will be a choice to create a "Bug report" or a "Feature request". +Choose "Bug report". + +## Contributing code or documentation + +To contribute code or documentation to the repository, you must have +[License Agreements](#license-agreements) in place. +This needs to be complete before a [Pull Request](#pull-requests) can be accepted. + +### Setting up a development environment + +#### Set Environment variables + +These variables may be modified, but do not need to be modified. +The variables are used throughout the installation procedure. + +```console +export GIT_ACCOUNT=senzing +export GIT_REPOSITORY=template-docker +``` + +Synthesize environment variables. + +```console +export GIT_ACCOUNT_DIR=~/${GIT_ACCOUNT}.git +export GIT_REPOSITORY_DIR="${GIT_ACCOUNT_DIR}/${GIT_REPOSITORY}" +export GIT_REPOSITORY_URL="git@github.com:${GIT_ACCOUNT}/${GIT_REPOSITORY}.git" +``` + +#### Clone repository + +Get repository. + +```console +mkdir --parents ${GIT_ACCOUNT_DIR} +cd ${GIT_ACCOUNT_DIR} +git clone ${GIT_REPOSITORY_URL} +cd ${GIT_REPOSITORY_DIR} +``` + +### Coding conventions + +TODO: + +### Testing + +TODO: + +### Pull Requests + +Code in the master branch is modified via GitHub pull request. +Follow GitHub's +[Creating a pull request from a branch](https://help.github.com/articles/creating-a-pull-request/) +or +[Creating a pull request from a fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) instructions. + +Accepting pull requests will be at the discretion of Senzing, Inc. and the repository owner(s). diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..10be716 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +ARG BASE_IMAGE=senzing/senzing-base:1.6.4 +FROM ${BASE_IMAGE} + +ENV REFRESHED_AT=2022-01-06 + +LABEL Name="senzing/entity-search-web-app-console" \ + Maintainer="support@senzing.com" \ + Version="0.0.0" + +HEALTHCHECK CMD ["/app/healthcheck.sh"] + +# Run as "root" for system installation. + +USER root + +# Install packages via PIP. + +COPY requirements.txt ./ +RUN pip3 install --upgrade pip \ + && pip3 install -r requirements.txt \ + && rm requirements.txt + +# Install packages via apt. + +# Copy files from repository. + +COPY ./rootfs / + +# Make non-root container. + +USER 1001 + +# Runtime execution. + +WORKDIR /app +CMD ["/app/sleep-infinity.sh"] diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..f2c2447 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +# Git variables + +GIT_REPOSITORY_NAME := $(shell basename `git rev-parse --show-toplevel`) +GIT_VERSION := $(shell git describe --always --tags --long --dirty | sed -e 's/\-0//' -e 's/\-g.......//') + +# Docker variables + +DOCKER_IMAGE_TAG ?= $(GIT_REPOSITORY_NAME):$(GIT_VERSION) +DOCKER_IMAGE_NAME := senzing/template + +# ----------------------------------------------------------------------------- +# The first "make" target runs as default. +# ----------------------------------------------------------------------------- + +.PHONY: default +default: help + +# ----------------------------------------------------------------------------- +# Docker-based builds +# ----------------------------------------------------------------------------- + +.PHONY: docker-build +docker-build: + docker build \ + --tag $(DOCKER_IMAGE_NAME) \ + --tag $(DOCKER_IMAGE_NAME):$(GIT_VERSION) \ + . + +# ----------------------------------------------------------------------------- +# Clean up targets +# ----------------------------------------------------------------------------- + +.PHONY: docker-rmi-for-build +docker-rmi-for-build: + -docker rmi --force \ + $(DOCKER_IMAGE_NAME):$(GIT_VERSION) \ + $(DOCKER_IMAGE_NAME) + +.PHONY: clean +clean: docker-rmi-for-build + +# ----------------------------------------------------------------------------- +# Help +# ----------------------------------------------------------------------------- + +.PHONY: help +help: + @echo "List of make targets:" + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..0b11a2f --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +# Pull request questions + +## Which issue does this address + +Issue number: #nnn + +## Why was change needed + +??? + +## What does change improve + +??? diff --git a/docker-compose.test.yml b/docker-compose.test.yml new file mode 100644 index 0000000..1200075 --- /dev/null +++ b/docker-compose.test.yml @@ -0,0 +1,6 @@ +version: '3' +services: + sut: + build: . + entrypoint: [""] + command: ["/app/container-test.sh"] diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..099798e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,5 @@ +# template-docker + +Placeholder for [GitHub pages](https://pages.github.com/). + +See [https://senzing.github.io/template-docker](https://senzing.github.io/template-docker). \ No newline at end of file diff --git a/docs/best-practices.md b/docs/best-practices.md new file mode 100644 index 0000000..bea3c23 --- /dev/null +++ b/docs/best-practices.md @@ -0,0 +1,49 @@ +# Best practices + +## README.md + +1. Use [Markdown lint](https://dlaa.me/markdownlint/) to adhere to + [Markdown rules](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md). + +## Dockerfile + +1. Use best practices: + 1. Docker's [Best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/). + 1. Project Atomic's [Container Best practices](http://docs.projectatomic.io/container-best-practices). +1. Use "lint" when applicable. + 1. Online linter: [FROM: latest](https://www.fromlatest.io) + 1. GitHub [projectatomic/dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) using Docker + + ```console + sudo docker run -it \ + --rm \ + --privileged \ + --volume $PWD:/root/ \ + projectatomic/dockerfile-lint \ + dockerfile_lint -f Dockerfile + ``` + + 1. **Note:** Linters may erroneously report "ARG before FROM" which is supported as of + Enterprise Edition [17.06.01](https://docs.docker.com/engine/release-notes/#17061-ee-1) and + Community Edition [17.05.0](https://docs.docker.com/engine/release-notes/#17050-ce). + +## Makefile + +1. Modifications: + 1. Change following value to appropriate Docker tag. + + ```make + DOCKER_IMAGE_NAME := senzing/template + ``` + +1. Use `make docker-build-base` occasionally to populate the docker image cache with layers that change infrequently. +1. Once a "base" has been created, use `make docker-build` to build during development and make final builds. + +## CONTRIBUTING.md + +1. Modifications: + 1. Change following value to appropriate Git repository name. + + ```markdown + export GIT_REPOSITORY=template-docker + ``` diff --git a/docs/errors.md b/docs/errors.md new file mode 100644 index 0000000..05c6801 --- /dev/null +++ b/docs/errors.md @@ -0,0 +1 @@ +## Errors \ No newline at end of file diff --git a/rootfs/app/container-test.sh b/rootfs/app/container-test.sh new file mode 100755 index 0000000..9f72897 --- /dev/null +++ b/rootfs/app/container-test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Return codes. + +OK=0 +NOT_OK=1 + +# Tests. + +echo "Doing testing." + +exit ${OK} diff --git a/rootfs/app/healthcheck.sh b/rootfs/app/healthcheck.sh new file mode 100755 index 0000000..898a02b --- /dev/null +++ b/rootfs/app/healthcheck.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Return codes. + +OK=0 +NOT_OK=1 + +# Tests. + +echo "Doing healthtest." + +exit ${OK} diff --git a/rootfs/app/sleep-infinity.sh b/rootfs/app/sleep-infinity.sh new file mode 100755 index 0000000..296d91b --- /dev/null +++ b/rootfs/app/sleep-infinity.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Signal trapping. + +handle_term() +{ + echo "signal received, sleep-infinity exiting." + exit 0 +} + +trap 'handle_term' TERM + +# ============================================================================= +# Main +# ============================================================================= + +echo "/app/sleep-infinitely.sh is sleeping infinitely." + +# Sleep in a manner that allows "docker stop ..." to shutdown gracefully. + +sleep infinity & +wait