Synbolik link to aws EFS on web server doesn't work? - django

I have static folder serving the files on uwsgi.
/user/app/static/
lrwxrwxrwx 1 root root 23 Oct 13 09:40 _out -> /usr/src/app/_mat/_out/
drwxr-xr-x 8 root root 4096 Oct 13 09:49 assets
drwxr-xr-x 8 root root 4096 Oct 13 09:40 pages
in this case, the imagefiles under assets can be appeared correctly,
however the image files under _out can not be accessed.(404 error occurs)
static/assets/test.png is ok
static/_out/test.png returns 404 error
/usr/src/app/_mat/ are on the aws EFS.
I checked the permissions.
Generally speaking, does symbolic link work under web server?

Related

Running SageMaker ProcessingJob as non root user

Files copied by SageMaker from s3 to docker inside ProcessingJob have root ownership and permissions which do not allow non owner users (non root) to write to them.
I'd like to run the docker container as non root user and be able to write to folders created by SageMaker, so the Dockerfile looks like this:
FROM base
...
USER nonroot
Exemplary permissions and ownership of folders copied from s3 to SageMaker's docker container:
2022-11-30T10:20:13.567+01:00 + ls -la /opt/ml/processing
2022-11-30T10:20:13.567+01:00 total 24
2022-11-30T10:20:13.567+01:00 drwxr-xr-x 6 root root 4096 Nov 30 09:20 .
2022-11-30T10:20:13.567+01:00 drwxr-xr-x 5 root root 4096 Nov 30 09:20 ..
2022-11-30T10:20:13.567+01:00 drwxr-xr-x 2 root root 4096 Nov 30 09:20 data
2022-11-30T10:20:13.568+01:00 drwxr-xr-x 2 root root 4096 Nov 30 09:20 output
I'd expect these folders to either has nonroot user ownership.
I've checked the documentation but no luck there. If there's any obvious way to achieve this that I missed, please let me know. Thanks!

Jetty is throwing `Unknown module' error when running with --add-to-start

I am trying to configure Jetty and facing this:
root#jans-dev:~/jetty-base# java -jar $JETTY_HOME/start.jar --add-to-start=http,deploy
ERROR : Unknown module='http'. List available with --list-modules
Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
java -jar $JETTY_HOME/start.jar --help # for more information
Background:
Jetty 9.4 installed as root on an lxc container on Ubuntu using sudo apt install jetty9
Jetty service is running and I can access default landing page
Jetty home is set to export JETTY_HOME=/usr/share/jetty
Jetty base is set to export JETTY_BASE=/root/jetty-base
I have executed below command successfully before trying to add modules.
root#jans-dev:~/jetty-base# java -jar $JETTY_HOME/start.jar --create-startd
MKDIR : ${jetty.base}/start.d
INFO : Base directory was modified
Also, when I run --list-modules, it is coming up empty:
root#jans-dev:~/jetty-base# java -jar $JETTY_HOME/start.jar --list-modules
Available Modules:
==================
tags: [-internal]
Enabled Modules:
================
root#jans-dev:~/jetty-base#
I am not sure what am I missing here. How do I make modules available to Jetty? I have also checked this reference
Sounds like your linux distro has mangled the jetty distribution.
Does your /usr/share/jetty directory contain the directories etc/, lib/, and modules/? If not, then that's not a valid ${jetty-home}.
Perhaps your linux distribution put the jetty-home somewhere else?
But that would also be invalid, as the start.jar should be in the same directory as those other directories.
Example of what a proper ${jetty.home} looks like ...
$ ls -la jetty-home-9.4.44.v20210927
total 776
drwxr-xr-x 6 joakim joakim 4096 Sep 27 18:12 ./
drwxr-xr-x 74 joakim joakim 12288 Nov 2 15:32 ../
drwxr-xr-x 2 joakim joakim 4096 Oct 7 10:07 bin/
drwxr-xr-x 4 joakim joakim 4096 Oct 14 07:17 etc/
drwxr-xr-x 14 joakim joakim 4096 Oct 7 10:07 lib/
-rw-r--r-- 1 joakim joakim 30012 Sep 27 18:12 license-eplv10-aslv20.html
drwxr-xr-x 22 joakim joakim 4096 Oct 7 10:07 modules/
-rw-r--r-- 1 joakim joakim 6262 Sep 27 18:12 notice.html
-rw-r--r-- 1 joakim joakim 163958 Sep 27 18:10 start.jar
-rw-r--r-- 1 joakim joakim 550572 Sep 27 17:44 VERSION.txt
In the past, there were Linux Distributions that tried to put the various Jetty libs (The jar files in ${jetty.home}/lib/) in their distribution setup as separate dependencies, but that's not a valid setup for a modular Servlet/Web Container like Jetty. Most distributions have realized this and have reverted to a sane setup now.
The fastest fix for you is to remove this bad Jetty package from your linux distribution and just download and use the official tarball.
https://search.maven.org/artifact/org.eclipse.jetty/jetty-home
https://www.eclipse.org/jetty/download.php

Tomcat's logs is empty after rotating - AWS EC2 - Tomcat 8

Every Tomcat's logs is empty. When I access EC2 with console on the /var/log/tomcat8 dir, every log file is empty with 0kb.
I already tried to change the logrotate.elasticbeanstalk.tomcat8.conf, but without success.
This is the entire logrotate.elasticbeanstalk.tomcat8.conf file as I already tried to change.
/var/log/tomcat8/* {
size 10M
rotate 5
missingok
compress
notifempty
dateext
dateformat %s
olddir /var/log/tomcat8/rotated
}
This is how Tomcat's log file look:
-rw-r--r-- 1 tomcat tomcat 0 Jul 18 00:01 catalina.2019-07-17.log
-rw-r--r-- 1 tomcat tomcat 0 Jul 18 17:01 catalina.2019-07-18.log
-rw-r--r-- 1 tomcat tomcat 0 Jul 19 19:01 catalina.2019-07-19.log
Look in the rotated subdirectory for .gz files with the same filename as a prefix. E.g., catalina.2019-07-17*.gz

Elastic beanstalk not copying single container logs

I'm trying to sync a folder, full of folders which have log files in, from a single docker container instance deployed on AWS elastic beanstalk. I've used the logging directive as shown here https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/single-container-docker-configuration.html but when I request the full logs none of my logs are downloaded
Dockerrun.aws.json
{
"AWSEBDockerrunVersion": "1",
"Image": {
~snip~
"Update": "true"
},
"Ports": [
{
"ContainerPort": 80
}
],
"Logging": "/var/log/applogs"
}
Container structure:
bash-4.2# ls -la /var/log/applogs/
total 8
drwxr-xr-x 2 root root 4096 Dec 5 15:35 .
drwxr-xr-x 12 root root 4096 Dec 5 15:35 ..
lrwxrwxrwx 1 root root 34 Dec 5 15:35 app -> /var/www/html/app/storage/logs
lrwxrwxrwx 1 root root 14 Dec 5 15:35 httpd -> /var/log/httpd
lrwxrwxrwx 1 root root 16 Dec 5 15:35 php-fpm -> /var/log/php-fpm
It was my impression that the logging directive would recursively include (And also follow symlinks) all log files in the directory specified, but it's not bringing anything across. Am I wrong about that or just doing something wrong here?
I solved this by symlinking the individual log files in the container, not ideal but it will have to do

Google PageSpeed Apache Error log CentOS

I installed the Google PageSpeed module to my CentOS 7.0 DA VPS.
I used this blog, by installing the PageSpeed module: http://www.haloseeker.com/install-go...h-directadmin/
When I check my Apache Error Log, I found the following errors:
[pagespeed:error] [pid 2593] [mod_pagespeed 1.11.33.1-0 #2593] Could not create directories for file /var/cache/mod_pagespeed/v3/domain.com/https,3A/,2Fwww.domain.com/icon_feed.gif,.temp
[pagespeed:error] [pid 2593] [mod_pagespeed 1.11.33.1-0 #2593] /var/cache/mod_pagespeed/v3/domain.com/https,3A/,2Fwww.domain.com/icon_feed.gif,.temp8f2OKe:0: opening temp file: No such file or directory
[pagespeed:error] [pid 2673] [mod_pagespeed 1.11.33.1-0 #2673] Failed to make directory /var/cache/mod_pagespeed/v3/domain.com/https,3A/,www.domain.com/images: Permission denied
How can I solve this problem?
Try to update your directory permission with the following command and let me know if you have any issues.
chmod -R a+w /var/cache/mod_pagespeed
This doesn't have to work. Depending on the Apache configuration (mpm_itk), it's possible that each vhost is served as another user.
So important directories are made under user A, and when another request to host B, user B cannot delete/create subdirectories.
I haven't figured out how to solve this, running CentOS and cPanel as hoster.
-rw-------. 1 tvr86nl tvr86nl 13 Aug 17 23:14 !clean!time!
drwxr-xr-x. 4 tvr86nl tvr86nl 37 Aug 17 00:45 prop_page
drwxr-xr-x. 12 tvr86nl tvr86nl 4.0K Aug 17 12:54 rname
drwxr-xr-x. 3 tvr86nl tvr86nl 22 Aug 16 18:16 v3
root#vps1.sse-ict.nl /var/mod_pagespeed/cache>
so this happens every time when these directories are created :(
perhaps a cron-job would do the trick. But it's a mod_pagespeed
shortcoming!