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

Docker Image Change #1207

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
16aa5b4
Add new AL2 based image and gunicorn
jawadqur Sep 4, 2024
84e63b9
Update poetry
jawadqur Sep 4, 2024
9883f05
updating the command
EliseCastle23 Sep 6, 2024
a243631
Merge branch 'master' into feat/al2
EliseCastle23 Oct 16, 2024
0238816
updating poetry lock
EliseCastle23 Oct 16, 2024
016636e
fixing link
EliseCastle23 Oct 17, 2024
0fe5859
fixing deadlinks
EliseCastle23 Oct 17, 2024
6708a84
fixing case
EliseCastle23 Oct 18, 2024
c514982
Merge branch 'master' into feat/al2
EliseCastle23 Oct 18, 2024
9fc2412
Merge branch 'master' into feat/al2
Avantol13 Nov 1, 2024
2031c74
feat(docker): update to use new base image
Avantol13 Nov 1, 2024
cc0e908
feat(mcrypt): add wip work to have 2 images
Avantol13 Nov 8, 2024
351d6e5
Merge branch 'master' into feat/al2
Avantol13 Nov 8, 2024
c82765b
WIP
nss10 Nov 22, 2024
a179a04
Update ci.yaml
nss10 Nov 22, 2024
2502803
Changing the basic dockerfile
nss10 Nov 22, 2024
43a98f4
Merge branch 'master' into chore/ccrypt_usersync
BinamB Nov 22, 2024
f198e66
update for arm
BinamB Nov 22, 2024
f8b848b
Fix downloads
BinamB Nov 22, 2024
fab15db
add y
BinamB Nov 22, 2024
5937738
fix docker
BinamB Nov 22, 2024
2bb0b1e
single image
BinamB Dec 13, 2024
31e50ae
fix image
BinamB Dec 13, 2024
8e664c0
add poetry run to gunicorn
BinamB Dec 15, 2024
d448672
update poetry lock
BinamB Dec 15, 2024
63217d7
update dockerfile
BinamB Dec 15, 2024
108360f
make sub into string
BinamB Dec 18, 2024
536e11b
fix token
BinamB Dec 20, 2024
57f1233
Merge branch 'master' into chore/ccrypt_usersync
BinamB Dec 21, 2024
9b8bd74
testing import
BinamB Dec 24, 2024
7d96128
fix get config
BinamB Jan 3, 2025
162c58b
set default
BinamB Jan 3, 2025
3df68fc
remove try block
BinamB Jan 3, 2025
aab5a84
Add tar
jawadqur Jan 7, 2025
7286c02
Remove mcrypt docker image
BinamB Jan 8, 2025
29bf703
Update ccrypt for arm
BinamB Jan 8, 2025
57b1b2b
Merge branch 'master' into chore/ccrypt_usersync
nss10 Jan 27, 2025
be49983
Add `xz` alongside `tar` in Dockerfile
nss10 Jan 28, 2025
78da528
Update integration tests cloud auto branch
nss10 Jan 29, 2025
f9e96d5
Change cloud auto branch
nss10 Jan 29, 2025
b7fae52
Fix Indentation on the `uses` tab
nss10 Jan 29, 2025
3e60965
Merge branch 'master' into chore/ccrypt_usersync
nss10 Jan 29, 2025
4e9e6be
Updating integration tests path. Also cleaning up Dockerfile
nss10 Jan 29, 2025
9e0d31e
Remove CUSTOM_TEST_BRANCH
nss10 Jan 29, 2025
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
17 changes: 2 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,12 @@ jobs:
BuildImageAndPush:
name: Build Image and Push
needs: Security
with:
BUILD_PLATFORMS: "linux/amd64"
# https://github.com/uc-cdis/.github/blob/master/.github/workflows/image_build_push.yaml
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@master
secrets:
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_ROBOT_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}

# I did not test that this works
BuildMcryptImageAndPush:
name: Build Image and Push
needs: Security
# https://github.com/uc-cdis/.github/blob/master/.github/workflows/image_build_push.yaml
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@master
secrets:
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_ROBOT_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
with:
OVERRIDE_TAG_NAME: "mcrypt_$(echo ${GITHUB_REF#refs/*/} | tr / _)"
DOCKERFILE_LOCATION: "./DockerfileMcrypt"
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,5 @@
}
]
},
"generated_at": "2023-10-20T20:37:17Z"
"generated_at": "2024-11-04T09:20:13Z"
}
25 changes: 24 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,29 @@ RUN chown -R gen3:gen3 /${appname}
# ------ Builder stage ------
FROM base AS builder

# Install ccrypt to decrypt dbgap telmetry files
RUN if [ "$TARGETARCH" = "amd64" ]; then \
echo "Upgrading dnf"; \
dnf upgrade -y && \
echo "Installing Packages"; \
dnf install -y \
libxcrypt-compat-4.4.33 \
libpq-15.0 && \
echo "Installing RPM"; \
rpm -i https://ccrypt.sourceforge.net/download/1.11/ccrypt_1.11-1_amd64.deb; \
fi

RUN if [ "$TARGETARCH" = "arm64" ]; then \
echo "Upgrading dnf"; \
dnf upgrade -y && \
echo "Installing Packages"; \
dnf install -y \
libxcrypt-compat-4.4.33 \
libpq-15.0 && \
echo "Installing RPM"; \
rpm -i https://ccrypt.sourceforge.net/download/1.11/ccrypt-1.11-1.x86_64.rpm; \
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed we are using an x86 binary for ARM. Will this be emulated for ARM during use? Has any testing been done to confirm its functionality?

fi

# Install just the deps without the code as it's own step to avoid redoing this on code changes
COPY poetry.lock pyproject.toml /${appname}/
RUN poetry lock -vv --no-update \
Expand Down Expand Up @@ -48,4 +71,4 @@ FROM base

COPY --chown=gen3:gen3 --from=builder /$appname /$appname

CMD ["poetry", "run", "gunicorn", "-c", "deployment/wsgi/gunicorn.conf.py"]
CMD ["/bin/bash", "-c", "/fence/dockerrun.bash"]
2 changes: 1 addition & 1 deletion dockerrun.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ if [ -f /fence/jwt-keys.tar ]; then
fi

nginx
gunicorn -c /fence/deployment/wsgi/gunicorn.conf.py
poetry run gunicorn -c "/fence/deployment/wsgi/gunicorn.conf.py"
49 changes: 19 additions & 30 deletions fence/sync/sync_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,20 @@ def _read_file(filepath, encrypted=True, key=None, logger=None):
Generator[file-like class]: file like object for the file
"""
if encrypted:
has_crypt = sp.call(["which", "mcrypt"])
has_crypt = sp.call(["which", "ccdecrypt"])
if has_crypt != 0:
if logger:
logger.error("Need to install mcrypt to decrypt files from dbgap")
# TODO (rudyardrichter, 2019-01-08): raise error and move exit out to script
exit(1)
p = sp.Popen(
[
"mcrypt",
"-a",
"enigma",
"-o",
"scrypt",
"-m",
"stream",
"--bare",
"--key",
"ccdecrypt",
"-u",
"-K",
key,
"--force",
],
stdin=open(filepath, "r"),
stdout=sp.PIPE,
stderr=open(os.devnull, "w"),
universal_newlines=True,
filepath,
]
)
try:
yield StringIO(p.communicate()[0])
Expand Down Expand Up @@ -659,9 +649,13 @@ def _parse_csv(self, file_dict, sess, dbgap_config={}, encrypted=True):
tags["pi"] = row["downloader for names"]

user_info[username] = {
"email": row.get("email") or user_info[username].get('email') or "",
"email": row.get("email")
or user_info[username].get("email")
or "",
"display_name": display_name,
"phone_number": row.get("phone") or user_info[username].get('phone_number') or "",
"phone_number": row.get("phone")
or user_info[username].get("phone_number")
or "",
"tags": tags,
}

Expand Down Expand Up @@ -967,10 +961,10 @@ def sync_to_storage_backend(self, user_project, user_info, sess, expires):
google_group_user_mapping = {}
get_or_create_proxy_group_id(
expires=expires,
user_id=user_info['user_id'],
username=user_info['username'],
user_id=user_info["user_id"],
username=user_info["username"],
session=sess,
storage_manager=self.storage_manager
storage_manager=self.storage_manager,
)

# TODO: eventually it'd be nice to remove this step but it's required
Expand All @@ -987,14 +981,11 @@ def sync_to_storage_backend(self, user_project, user_info, sess, expires):
for project, _ in projects.items():
syncing_user_project_list.add((username.lower(), project))


to_add = set(syncing_user_project_list)

# when updating users we want to maintain case sensitivity in the username so
# pass the original, non-lowered user_info dict
self._upsert_userinfo(sess, {
user_info['username'].lower(): user_info
})
self._upsert_userinfo(sess, {user_info["username"].lower(): user_info})

self._grant_from_storage(
to_add,
Expand Down Expand Up @@ -2485,8 +2476,8 @@ def sync_single_user_visas(self, user, ga4gh_visas, sess=None, expires=None):
projects = {**projects, **project}
parsed_visas.append(visa)

info['user_id'] = user.id
info['username'] = user.username
info["user_id"] = user.id
info["username"] = user.username
user_projects[user.username] = projects

user_projects = self.parse_projects(user_projects)
Expand All @@ -2511,9 +2502,7 @@ def sync_single_user_visas(self, user, ga4gh_visas, sess=None, expires=None):

if user_projects:
self.logger.info("Sync to storage backend [sync_single_user_visas]")
self.sync_to_storage_backend(
user_projects, info, sess, expires=expires
)
self.sync_to_storage_backend(user_projects, info, sess, expires=expires)
else:
self.logger.info("No users for syncing")

Expand Down
Loading
Loading