Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eclipse-che-sidecar-s3fs
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Administrator
eclipse-che-sidecar-s3fs
Commits
72248270
Commit
72248270
authored
2 years ago
by
MAAP System
Browse files
Options
Downloads
Patches
Plain Diff
Auto remount sf3s on failure
parent
1df6df2b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#414
passed with stage
in 1 second
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+5
-0
5 additions, 0 deletions
Dockerfile
cron_script.sh
+28
-0
28 additions, 0 deletions
cron_script.sh
crontab.txt
+1
-0
1 addition, 0 deletions
crontab.txt
entrypoint.sh
+12
-5
12 additions, 5 deletions
entrypoint.sh
with
46 additions
and
5 deletions
Dockerfile
+
5
−
0
View file @
72248270
...
...
@@ -47,6 +47,11 @@ WORKDIR /projects
COPY
*.sh /usr/local/bin/
ADD
crontab.txt /crontab.txt
ADD
cron_script.sh /cron_script.sh
RUN
chmod
755 /cron_script.sh
RUN
/usr/bin/crontab /crontab.txt
# The default is to perform all system-level mounting as part of the entrypoint
# to then have a command that will keep listing the files under the main share.
# Listing the files will keep the share active and avoid that the remote server
...
...
This diff is collapsed.
Click to expand it.
cron_script.sh
0 → 100755
+
28
−
0
View file @
72248270
#!/bin/sh
urlencode
()
{
python -
<<
END
from urllib.parse import quote
import os
api_host = os.environ.get('CHE_API_EXTERNAL')
# double-encode url
print(quote(quote(api_host, safe=""), safe=""))
END
}
CHE_API_URL_ENCODED
=
$(
urlencode
)
# TODO: Update the API url after deployment!
MAAP_ENV
=
$(
curl
-s
https://api.ops.maap-project.org/api/environment/bucketPrefix/
${
CHE_API_URL_ENCODED
}
|
tr
-d
'"'
)
check_dir
()
{
if
[
!
-d
$1
]
;
then
echo
"
$1
does not exist. Unmounting..."
fusermount
-u
$1
echo
"Remounting
$1
..."
s3fs maap-
$MAAP_ENV
-workspace
:
$2
$1
-o
use_cache
=
/scratch
$2
-o
imdsv1only
-o
iam_role
=
auto
fi
}
check_dir /my-private-bucket /
$CHE_WORKSPACE_NAMESPACE
check_dir /shared-buckets /shared
check_dir /my-public-bucket /shared/
$CHE_WORKSPACE_NAMESPACE
This diff is collapsed.
Click to expand it.
crontab.txt
0 → 100644
+
1
−
0
View file @
72248270
* * * * * /cron_script.sh >> /var/log/cron_script.log
\ No newline at end of file
This diff is collapsed.
Click to expand it.
entrypoint.sh
+
12
−
5
View file @
72248270
...
...
@@ -22,11 +22,18 @@ mkdir -p /s3root/shared/$CHE_WORKSPACE_NAMESPACE
umount /s3root
rm
-rf
/s3root
# Create temp directory
mkdir
/scratch
&&
mkdir
/scratch/
$CHE_WORKSPACE_NAMESPACE
mount_dir
()
{
# Create temp directory
mkdir
/scratch
&&
mkdir
/scratch
$2
echo
"Mounting
$1
..."
s3fs maap-
$MAAP_ENV
-workspace
:
$2
$1
-o
use_cache
=
/scratch
$2
-o
imdsv1only
-o
iam_role
=
auto
}
mount_dir /my-private-bucket /
$CHE_WORKSPACE_NAMESPACE
mount_dir /shared-buckets /shared
mount_dir /my-public-bucket /shared/
$CHE_WORKSPACE_NAMESPACE
s3fs maap-
$MAAP_ENV
-workspace
:/
$CHE_WORKSPACE_NAMESPACE
/my-private-bucket
-o
use_cache
=
/scratch/
$CHE_WORKSPACE_NAMESPACE
-o
imdsv1only
-o
iam_role
=
auto
s3fs maap-
$MAAP_ENV
-workspace
:/shared /shared-buckets
-o
ro
-o
use_cache
=
/scratch/
$CHE_WORKSPACE_NAMESPACE
-o
imdsv1only
-o
iam_role
=
auto
s3fs maap-
$MAAP_ENV
-workspace
:/shared/
$CHE_WORKSPACE_NAMESPACE
/my-public-bucket
-o
use_cache
=
/scratch/
$CHE_WORKSPACE_NAMESPACE
-o
imdsv1only
-o
iam_role
=
auto
# start cron
/usr/sbin/crond
-f
-l
8
tail
-f
/dev/null
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment