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

Support alpine linux #50

Open
thenewguy opened this issue Apr 3, 2020 · 15 comments · May be fixed by #136
Open

Support alpine linux #50

thenewguy opened this issue Apr 3, 2020 · 15 comments · May be fixed by #136

Comments

@thenewguy
Copy link

Add installation support for Alpine linux. This would be very helpful when docker containers need to be used in a CI environment.

@thenewguy
Copy link
Author

thenewguy commented Apr 4, 2020

Below is an Alpine based docker image that will build and install the efs-utils via the deb builder. All good there. I have been using it for testing so it would need to be modified for your needs to do something suitable. It probably has some requirements that are not needed, but it is for a beanstalk deployment builder.

However, the start_watchdog function will need to be modified for Alpine support so that -o tls can be used

FROM docker:19.03-git
COPY domain.crt /usr/local/share/ca-certificates/domain.crt
RUN update-ca-certificates \
    && apk add --no-cache curl python2 python2-dev py2-pip gcc libffi-dev musl-dev openssl-dev make bash \
    && pip install awsebcli awscli \
    && python --version && pip freeze
RUN apk add --no-cache dpkg binutils nfs-utils stunnel openssl util-linux \
    && mkdir -p /tmp/efsutils \
    && cd /tmp/efsutils \
    && git clone https://github.com/aws/efs-utils . \
    && ./build-deb.sh \
    && dpkg --force-all -i ./build/amazon-efs-utils*.deb \
    && rm -Rf /tmp/efsutils
RUN sed -i '/#region = us-east-1/s/^#//' /etc/amazon/efs/efs-utils.conf && cat /etc/amazon/efs/efs-utils.conf
COPY . /eb

This image will let you mount like: mount -t efs ${EFS_FILE_SYSTEM_ID}:/ ${EFS_MOUNT_DIR}

It DOES NOT support mount -t efs -o tls ${EFS_FILE_SYSTEM_ID}:/ ${EFS_MOUNT_DIR} yet.

@lilferna
Copy link

lilferna commented Apr 7, 2020

Thanks for the feedback. We’ll have someone take a look and post a more detailed response once we better understand the issue.

@thenewguy
Copy link
Author

@lilferna the issue is that the two handled cases for init_system are not available for alpine. There are many simple ways to solve this. Will wait for your feedback

@thenewguy
Copy link
Author

@lilferna for example, adding support for something like http://supervisord.org/ would let you support any distribution that can run python. So you could punt the problem.

@rileypriddle
Copy link

+1

@thenewguy
Copy link
Author

@lilferna Any chance for an update?

@thenewguy
Copy link
Author

I will do the work for you if you will just let me know it will be merged

@Cappuccinuo
Copy link
Contributor

Hi @thenewguy ,

Sorry for the late reply. If you can submit a pull request, that will be great, we will review that once you submit one, thanks.

@thenewguy
Copy link
Author

Do you have a preference on the init system used?

@Cappuccinuo
Copy link
Contributor

Cappuccinuo commented May 18, 2020

What's the unrecognized init system of alpine linux container? I assume there should be a warning message in the log file, Could not start %s, unrecognized init system **?

If we use supervisor, the init system will be supervisord right?

@thenewguy
Copy link
Author

There isn't one. I'd have to go back and check but I think it just parsed the shell. Would you be happy with attempting to fall back to supervisor if init system fails and supervisor is detected since it is cross platform?

@Cappuccinuo
Copy link
Contributor

If 1. init system is not systemd or init, 2. supervisor is detected, 3. watchdog is not already started, then I think we can use supervisor to start the watchdog.

@thenewguy
Copy link
Author

This is backlogged for me. Unfortunately a different direction was taken while waiting on approval of this issue. If anyone else is available to tackle the problem feel free

@tomalok
Copy link

tomalok commented Apr 18, 2021

I'm running Alpine Linux as the OS for my EC2 instances. Here's the current patch I'm applying in order to get mount.efs to work...

diff -urP a/src/mount_efs/__init__.py b/src/mount_efs/__init__.py
--- a/src/mount_efs/__init__.py	2021-04-18 16:12:17.000000000 -0700
+++ b/src/mount_efs/__init__.py	2021-04-18 18:53:34.000000000 -0700
@@ -224,6 +224,7 @@
 WATCHDOG_SERVICE_PLIST_PATH = '/Library/LaunchAgents/amazon-efs-mount-watchdog.plist'
 SYSTEM_RELEASE_PATH = '/etc/system-release'
 OS_RELEASE_PATH = '/etc/os-release'
+ALPINE_RELEASE_NAME = 'Alpine Linux'
 RHEL8_RELEASE_NAME = 'Red Hat Enterprise Linux release 8'
 CENTOS8_RELEASE_NAME = 'CentOS Linux release 8'
 FEDORA_RELEASE_NAME = 'Fedora release'
@@ -232,7 +233,7 @@
 MACOS_BIG_SUR_RELEASE = 'macOS-11'

 SKIP_NO_LIBWRAP_RELEASES = [RHEL8_RELEASE_NAME, CENTOS8_RELEASE_NAME, FEDORA_RELEASE_NAME, OPEN_SUSE_LEAP_RELEASE_NAME,
-                            SUSE_RELEASE_NAME, MACOS_BIG_SUR_RELEASE]
+                            SUSE_RELEASE_NAME, MACOS_BIG_SUR_RELEASE, ALPINE_RELEASE_NAME]

 # Multiplier for max read ahead buffer size
 # Set default as 15 aligning with prior linux kernel 5.4
@@ -920,6 +921,10 @@
                 init_system = f.read().strip()
         except IOError:
             logging.warning('Unable to read %s', comm_file)
+
+        if init_system == 'init':
+            if os.path.isfile('/sbin/openrc'):
+                init_system = 'openrc-init'
     else:
         init_system = 'launchd'

@@ -956,6 +961,16 @@
             with open(os.devnull, 'w') as devnull:
                 subprocess.Popen(['/sbin/start', WATCHDOG_SERVICE], stdout=devnull, stderr=devnull, close_fds=True)
         elif 'start' in str(status):
+            logging.debug('%s is already running', WATCHDOG_SERVICE)
+
+    elif init_system == 'openrc-init':
+        proc = subprocess.Popen(
+                ['/sbin/service', WATCHDOG_SERVICE, 'status'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
+        status, _ = proc.communicate()
+        if 'stopped' in str(status):
+            with open(os.devnull, 'w') as devnull:
+                subprocess.Popen(['/sbin/service', WATCHDOG_SERVICE, 'start'], stdout=devnull, stderr=devnull, close_fds=True)
+        elif 'started' in str(status):
             logging.debug('%s is already running', WATCHDOG_SERVICE)

     elif init_system == 'systemd':

FWIW, tls option is also working for me.

@thenewguy
Copy link
Author

I am not using this on alpine anymore but still got a notice. If you have a working solution you should submit it as a PR!

tomalok added a commit to tomalok/efs-utils that referenced this issue May 15, 2021
tomalok added a commit to tomalok/efs-utils that referenced this issue Jul 24, 2021
tomalok added a commit to tomalok/efs-utils that referenced this issue Dec 24, 2021
tomalok added a commit to tomalok/efs-utils that referenced this issue Jan 31, 2022
tomalok added a commit to tomalok/efs-utils that referenced this issue Jun 5, 2022
@tomalok tomalok linked a pull request Jun 5, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants