Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Feb 1, 2023
0 parents commit fc6e078
Show file tree
Hide file tree
Showing 144 changed files with 22,052 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.gitignore
LICENSE
README.md
deploy/db
tests

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy/db/data.sql.gz filter=lfs diff=lfs merge=lfs -text
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug Report
about: Use this to report a new bug

---

### Expected Behavior
<!--- Tell us what should happen -->

### Current Behavior
<!--- Tell us what happens instead of the expected behavior -->

### Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->

### Steps to Reproduce
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

### Context (Environment)
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

<!--- Provide a general summary of the issue in the Title above -->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature Request
about: Suggest an idea for this project

---

### Description
<!-- What use case are you trying to solve with this feature -->

### Proposed solution
<!-- A clear and concise description of what you want to happen -->

### Definition of Done
<!-- How to know this is implemeted. Preferably one short sentence -->
47 changes: 47 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- Describe the pull request as the first paragraph of this PR. -->
<!-- Make sure that you have read the "Contributing" guidelines. -->

### What it is about:
- [ ] Bug fix
- [ ] Functional change
- [ ] New feature
- [ ] Code cleanup
- [ ] Build system change
- [ ] Documentation change
- [ ] Language translation
<!-- Replace [ ] with [x] to select options. -->
<!-- Add/Remove items to the list, if necessary. -->

### Pull request long description:
<!-- Describe your pull request in detail. -->

### Changes made:
<!-- Enumerate the changes with 1), 2), 3) etc. -->
<!-- Ensure the test cases are updated if needed. -->

### Related issues:
<!-- Reference issues with #<issue-num>. -->
<!-- Write "Fixes #<issue-num>" to notify Github that this PR fixes an issue. -->

### Additional information:
<!-- Include sample dive log or other relevant information to allow testing the change where feasible. -->

### Release note:
<!-- Describe if this change needs a release note present in CHANGELOG.md. -->
<!-- Also, please make sure to add the release note on top of the file CHANGELOG.md. -->

### Documentation change:
<!--
* If this PR makes changes to user functionality, then the documentation has to be updated too.
* Briefly outline here what has changed in terms of the user experience (UX).
-->

<!--
##################
## FINAL NOTE ##
##################
If you are a collaborator,
please add labels and assign other collaborators for a review.
Delete the commented lines, such as this one, if you want, they are not included in the PR output.
-->
58 changes: 58 additions & 0 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Testsuite"

on:
pull_request:
branches:
- master
push:
branches:
- 'tests'
- 'tests/*'

jobs:
testsuite:
strategy:
max-parallel: 4
matrix:
# os: [ubuntu-latest, macOS-latest]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}

name: Beacon (v2.x) API tests

steps:
- name: Install required tools
run: |
git clone https://github.com/bats-core/bats-core.git
pushd bats-core
git checkout v1.1.0
sudo ./install.sh /usr/local
popd
rm -rf bats-core
sudo apt-get install curl jq git-lfs
sudo -- bash -c -e "echo '127.0.0.1 idp beacon beacon-permissions' >> /etc/hosts"
- uses: actions/checkout@master
- name: (re)Build docker images
run: |
pushd deploy
docker-compose build beacon
popd
- name: Bootstrap a Beacon
run: |
pushd deploy
docker-compose up -d db
sleep 30
docker-compose up -d
docker-compose ps
sleep 60
popd
- name: Running testsuite
run: bats tests
- name: Cleanup
run: |
pushd deploy
docker-compose down -v
popd
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
*~
.#*
.DS_Store
tmp/
.bak


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
#.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# Grunt
/ui/grunt

# Tests tmp
/tests/tmp/

# IntelliJ
.idea/

# VS Code
.vscode/

# Custom
deploy/request.json
typings/
deploy/ontologies/*.obo
deploy/ontologies/*.owl*
.antlr/
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
##########################
## Build env
##########################
FROM python:3.10-buster AS BUILD

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
#RUN apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ca-certificates pkg-config make \
libssl-dev libffi-dev libpq-dev

# python packages
RUN pip install --upgrade pip
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt

##########################
## Final image
##########################
FROM python:3.10-buster

LABEL maintainer "CRG System Developers"
LABEL org.label-schema.schema-version="2.0"
LABEL org.label-schema.vcs-url="https://github.com/EGA-archive/beacon-2.x/"

# Too much ?
COPY --from=BUILD /usr/local/bin /usr/local/bin
COPY --from=BUILD /usr/local/lib /usr/local/lib

RUN apt-get update && \
# apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
nginx \
&& \
rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && \
apt-get purge -y --auto-remove

COPY deploy/nginx.conf /beacon/nginx.conf
COPY deploy/supervisord.conf /beacon/supervisord.conf
COPY deploy/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY beacon /beacon/beacon
COPY ui /beacon/ui

RUN groupadd beacon && \
useradd -M -g beacon beacon && \
# mkdir /beacon && \
mkdir /var/run/beacon && \
chown -R beacon:beacon /beacon && \
# chmod 400 /beacon/beacon/conf.py && \
chown -R beacon:beacon /var/log/nginx && \
chown -R beacon:beacon /var/lib/nginx && \
chown -R beacon:beacon /etc/nginx && \
chown -R beacon:beacon /var/run/beacon && \
mkdir -p /var/log/supervisord && \
chown -R beacon:beacon /var/log/supervisord && \
chmod +x /usr/local/bin/entrypoint.sh

WORKDIR /beacon
USER beacon
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
Loading

0 comments on commit fc6e078

Please sign in to comment.