Can't access docker container via host browser. Ping is allowed - docker

I created first time some containers via docker-compose in the same new network. After while the env is completed. I see running containers via docker ps. Normally after that i can use containers. But when I tried to access wordpress web page from host via localhost:20000 or :20000. I get ERR_Connection refused. I was expecting info about "Error connecnting to the database".I can ping the containers by docker containers ip from the host. So maybe someone know how to fix that and get access to them.
This happens with this new network - network_1. Other containers like pihole + portainer in default bridge network are accessible from whole host network.
Thank You.
version: '3'
services:
# Database
db:
image: linuxserver/mariadb
volumes:
- db_data:/var/lib/mysql
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: user
MYSQL_PASSWORD: password
networks:
- network_1
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- 3308:80
environment:
PMA_HOST: 1
MYSQL_ROOT_PASSWORD: password
networks:
- network_1
# Wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- 20000:80
restart: always
volumes: ['./:/var/www/html']
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: user
WORDPRESS_DB_PASSWORD: password
networks:
- network_1
# Nextcloud
nextcloud:
image: nextcloud
restart: always
ports:
- 30000:80
depends_on:
- db
volumes:
- nextcloud:/var/www/html
environment:
MYSQL_PASSWORD: password
MYSQL_DATABASE: nextcloud
MYSQL_USER: user
MYSQL_HOST: db:3306
networks:
- network_1
networks:
network_1:
volumes:
db_data:
nextcloud:
Some commands from docker:
pi#raspberrypi:~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
52d11a5c2931 wordpress:latest "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:20000->80/tcp, :::20000->80/tcp
dom_wordpress_1
39feec5309d3 phpmyadmin/phpmyadmin "/docker-entrypoint.…" 2 hours ago Up 2 minutes 0.0.0.0:3308->80/tcp, :::3308->80/tcp
dom_phpmyadmin_1
62a943db01f2 nextcloud "/entrypoint.sh apac…" 2 hours ago Up 2 hours 0.0.0.0:30000->80/tcp, :::30000->80/tcp
dom_nextcloud_1
0681159165df linuxserver/mariadb "/init" 2 hours ago Up 2 hours 3306/tcp
dom_db_1
d0b6ece5c5aa portainer/portainer-ce:latest "/portainer" 4 hours ago Up 4 hours 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp
portainer
71ee89deb6de nginx:latest "/docker-entrypoint.…" 12 days ago Up 4 hours 0.0.0.0:80->80/tcp, :::80->80/tcp
nginx
03fcbea93e14 pihole/pihole:latest "/s6-init" 5 weeks ago Up 4 hours (unhealthy) 0.0.0.0:53->53/tcp, 0.0.0.0:53->53/udp, :::53->53/tcp, :::53->53/udp, 67/udp, 0.0.0.0:5000->80/tcp, :::5000->80/tcp, 0.0.0.0:5001->443/tcp, :::5001->443/tcp pihole
And docker inspect. !-No output for dom_db_1 and dom_phpmyadmin_1, and running pihole
pi#raspberrypi:~/docker-compose-Templates/dom $ docker port dom_db_1
pi#raspberrypi:~/docker-compose-Templates/dom $ docker port pihole
443/tcp -> 0.0.0.0:5001
443/tcp -> :::5001
53/tcp -> 0.0.0.0:53
53/tcp -> :::53
53/udp -> 0.0.0.0:53
53/udp -> :::53
80/tcp -> 0.0.0.0:5000
80/tcp -> :::5000
Logs from container wordpress(after rebuild-new ID) - it's working but VERY slow... In bridge network wordpress worked normally.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.5. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.5. Set the 'ServerName' directive globally to suppress this message
[Fri Oct 22 13:36:25.354493 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.48 (Debian) PHP/7.4.23 configured -- resuming normal operations
[Fri Oct 22 13:36:25.354772 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
192.168.1.201 - - [22/Oct/2021:13:36:25 +0000] "GET / HTTP/1.1" 500 2834 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:00:21 +0000] "GET / HTTP/1.1" 302 408 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:01:13 +0000] "-" 408 0 "-" "-"
192.168.1.201 - - [22/Oct/2021:14:02:25 +0000] "GET / HTTP/1.1" 302 408 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:00:40 +0000] "GET /wp-admin/install.php HTTP/1.1" 200 2816 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:46 +0000] "GET /wp-includes/css/buttons.min.css?ver=5.8 HTTP/1.1" 200 1791 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:45 +0000] "GET /wp-includes/css/dashicons.min.css?ver=5.8 HTTP/1.1" 200 36068 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:46 +0000] "GET /wp-admin/css/forms.min.css?ver=5.8 HTTP/1.1" 200 6546 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:48 +0000] "GET /wp-admin/css/l10n.min.css?ver=5.8 HTTP/1.1" 200 1021 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:48 +0000] "GET /wp-admin/css/install.min.css?ver=5.8 HTTP/1.1" 200 2129 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:54 +0000] "GET /wp-includes/js/zxcvbn-async.min.js?ver=1.0 HTTP/1.1" 200 605 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:51 +0000] "GET /wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2 HTTP/1.1" 200 4520 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:49 +0000] "GET /wp-includes/js/jquery/jquery.min.js?ver=3.6.0 HTTP/1.1" 200 31261 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:55 +0000] "GET /wp-admin/images/wordpress-logo.svg?ver=20131107 HTTP/1.1" 200 1810 "http://raspberrypi:20000/wp-admin/css/install.min.css?ver=5.8" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:00 +0000] "GET /wp-includes/js/dist/hooks.min.js?ver=a7edae857aab69d69fa10d5aef23a5de HTTP/1.1" 200 2141 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:01 +0000] "GET /wp-includes/js/dist/i18n.min.js?ver=5f1269854226b4dd90450db411a12b79 HTTP/1.1" 200 4209 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:56 +0000] "GET /wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=3.15.0 HTTP/1.1" 200 6382 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:56 +0000] "GET /wp-includes/js/dist/vendor/regenerator-runtime.min.js?ver=0.13.7 HTTP/1.1" 200 2749 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:02 +0000] "GET /wp-admin/js/password-strength-meter.min.js?ver=5.8 HTTP/1.1" 200 970 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:02 +0000] "GET /wp-includes/js/underscore.min.js?ver=1.8.3 HTTP/1.1" 200 7670 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:02 +0000] "GET /wp-includes/js/wp-util.min.js?ver=5.8 HTTP/1.1" 200 1054 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:04 +0000] "GET /wp-admin/js/user-profile.min.js?ver=5.8 HTTP/1.1" 200 2637 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:05 +0000] "GET /favicon.ico HTTP/1.1" 302 407 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:06 +0000] "GET /wp-admin/install.php HTTP/1.1" 200 2815 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:05 +0000] "GET /wp-includes/js/zxcvbn.min.js HTTP/1.1" 200 400400 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:26:39 +0000] "-" 408 0 "-" "-"
172.18.0.1 - - [22/Oct/2021:14:26:53 +0000] "GET / HTTP/1.1" 500 2834 "-" "Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.98 Safari/537.36"
172.18.0.1 - - [22/Oct/2021:14:27:28 +0000] "GET /favicon.ico HTTP/1.1" 500 2834 "http://localhost:20000/" "Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.98 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:25:48 +0000] "POST /wp-admin/install.php?step=2 HTTP/1.1" 200 1789 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:47:22 +0000] "GET /favicon.ico HTTP/1.1" 404 492 "http://raspberrypi:20000/wp-admin/install.php?step=2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:50:43 +0000] "-" 408 0 "-" "-"
192.168.1.201 - - [22/Oct/2021:14:49:51 +0000] "GET /wp-login.php HTTP/1.1" 200 2539 "http://raspberrypi:20000/wp-admin/install.php?step=2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
Logs from phpmyadmin(id may be changed after my actions)
pi#raspberrypi:~ $ docker container logs e569effa480c
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error

I think
# Database
db:
image: linuxserver/mariadb
volumes:
- db_data:/var/lib/mysql
restart: always
ports:
- 3306:3306
should be
# Database
db:
image: linuxserver/mariadb
volumes:
- db_data:/var/lib/mysql
restart: always
ports:
- 3306:3306

Try another image. I have a lot trouble using linuxserver image after few update. mariadb have official image on docker. Or maybe if you are want to still use linuxserver image, try another mariadb image version.

Related

docker containers: mariaDB connection issue with nextcloud

I'm the super user at my maschine. There is docker inside my volumne (/volume1/docker). I pulled the latest version of the images and run MariaDB, PhpMyAdmin and NextCloud:
docker run -d --name mariadb --network nextcloud --network-alias db -e MYSQL_ROOT_PASSWORD=r00tp#ss -e MYSQL_USER=nextcloud_rw -e MYSQL_PASSWORD=N3xtCl0ud! -e MYSQL_DATABASE=nextcloud -v /volume1/docker/mariadb:/var/lib/mysql --restart=unless-stopped mariadb:latest
docker run -d --name phpmyadmin --network nextcloud --link mariadb:db -e PMA_ARBITRARY=1 -e PMA_HOST=db -e PMA_USER=nextcloud_rw -e PMA_PASSWORD=N3xtCl0ud! -p 8082:80 --restart=unless-stopped phpmyadmin:latest
docker run -d --name nextcloud --network nextcloud -e MYSQL_HOST=db -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud_rw -e MYSQL_PASSWORD=N3xtCl0ud! -v /volume1/docker/nextcloud:/var/www/html -v db:/var/lib/mysql --restart=unless-stopped -p 8080:80 nextcloud:latest
When I open the browser and navigate to http:\\whereNextCloudLives:8080, I see the NextClud background plus the installation form. I enter the user nextcloud and the pw N3xtCl0ud! and get the response "Please check your mysql credentials. Cannot connect to DB".
MariaDB-Log:
[Note] mariadbd: ready for connections.
[Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation)
[Note] [Entrypoint]: Giving user nextcloud_rw access to schema nextcloud
[Note] [Entrypoint]: Creating user nextcloud_rw
[Note] [Entrypoint]: Creating database nextcloud
[Note] [Entrypoint]: Temporary server started.
stderr Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
[Note] mariadbd: ready for connections.
[Warning] Access denied for user 'nextcloud_rw'#'172.18.0.4' (using password: YES)
[Warning] Access denied for user 'nextcloud_rw'#'172.18.0.4' (using password: YES)
[Warning] Access denied for user 'nextcloud_rw'#'172.18.0.4' (using password: YES)
stderr Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
NextCloud-Log:
442381598Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:11 +0000] "POST /index.php HTTP/1.1" 200 3538 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:11.300610626Z stdout 127.0.0.1 - - [02/Dec/2022:18:26:11 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.54 (Debian) PHP/8.0.24 (internal dummy connection)"
2022-12-02T18:26:05.648774341Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /dist/core-common.js.map?v=dc4002698c876c22453e HTTP/1.1" 200 4483569 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.864831573Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /dist/core-main.js.map?v=0a05117109bf8b6240ea HTTP/1.1" 200 106976 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.845899731Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /core/vendor/zxcvbn/dist/zxcvbn.js.map HTTP/1.1" 404 680 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.844799000Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /dist/core-install.js.map?v=ee580b4e58a4177adf85 HTTP/1.1" 200 9627 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.331553336Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /core/img/manifest.json HTTP/1.1" 200 728 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:25:47.268364543Z stderr [Fri Dec 02 18:25:47.267810 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
2022-12-02T18:25:47.268255142Z stderr [Fri Dec 02 18:25:47.267778 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.0.24 configured -- resuming normal operations
2022-12-02T18:25:47.252431732Z stderr AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
2022-12-02T18:25:47.240345812Z stderr AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
I just use the IP. There is no domain configured. I've access to the DB with PhpMyAdmin.
Anyone with an idea what is wrong?

Rails Deployment to Elastic Beanstalk failed

I am new to rails and a pretty junior dev. I inherited a project with no documentation. Could anyone help decipher why my deployment failed based on these logs. I am trying to deploy to a staging environment.
So I set the environment variables on elastic beanstack
RAILS_ENV=staging
I set my RAILS_MASTER_KEY as my key I found inside the config/credentials/staging.key
I set a bunch of other environment variables that I needed such as DATABASE_URL, REDIS_URL
I tried deploying through the command line using eb deploy
Do I need a Procfile? The project has a Procfile.dev
Here are the logs from elastic beanstalk.
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] Puma starting in cluster mode...
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] * Version 4.3.3 (ruby 3.0.4-p208), codename: Mysterious Traveller
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] * Min threads: 8, max threads: 32
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] * Environment: production
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] * Process workers: 1
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] * Phased restart available
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] * Listening on unix:///var/run/puma/my_app.sock
Sep 17 22:17:31 ip-172-31-20-217 web: [3823] Use Ctrl-C to stop
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] Puma starting in cluster mode...
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] * Version 4.3.3 (ruby 3.0.4-p208), codename: Mysterious Traveller
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] * Min threads: 8, max threads: 32
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] * Environment: production
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] * Process workers: 1
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] * Phased restart available
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] * Listening on unix:///var/run/puma/my_app.sock
Sep 17 22:39:08 ip-172-31-20-217 web: [4783] Use Ctrl-C to stop
----------------------------------------
/var/log/eb-engine.log
----------------------------------------
2022/09/17 22:39:08.230799 [INFO] Executing platform hooks in .platform/confighooks/postdeploy/
2022/09/17 22:39:08.230816 [INFO] The dir .platform/confighooks/postdeploy/ does not exist
2022/09/17 22:39:08.230821 [INFO] Finished running scripts in /var/app/current/.platform/confighooks/postdeploy
2022/09/17 22:39:08.230827 [INFO] Executing cleanup logic
2022/09/17 22:39:08.230979 [INFO] CommandService Response: {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"Engine execution has succeeded.","returncode":0,"events":[{"msg":"Instance deployment completed successfully.","timestamp":1663454348230,"severity":"INFO"}]}]}
2022/09/17 22:39:08.232392 [INFO] Platform Engine finished execution on command: config-deploy
2022/09/17 22:52:37.072133 [INFO] Starting...
2022/09/17 22:52:37.072184 [INFO] Starting EBPlatform-PlatformEngine
2022/09/17 22:52:37.072203 [INFO] reading event message file
2022/09/17 22:52:37.072362 [INFO] Engine received EB command cfn-hup-exec
2022/09/17 22:52:37.153376 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:128499673453:stack/awseb-e-ccpkpxs6mt-stack/3a519600-36d6-11ed-a060-0a8c5403ef94 -r AWSEBAutoScalingGroup --region us-east-2
2022/09/17 22:52:37.462867 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:128499673453:stack/awseb-e-ccpkpxs6mt-stack/3a519600-36d6-11ed-a060-0a8c5403ef94 -r AWSEBBeanstalkMetadata --region us-east-2
2022/09/17 22:52:37.755236 [INFO] checking whether command app-deploy is applicable to this instance...
2022/09/17 22:52:37.755250 [INFO] this command is applicable to the instance, thus instance should execute command
2022/09/17 22:52:37.755255 [INFO] Engine command: (app-deploy)
2022/09/17 22:52:37.755262 [INFO] Downloading EB Application...
2022/09/17 22:52:37.755266 [INFO] Region: us-east-2
2022/09/17 22:52:37.755270 [INFO] envID: e-ccpkpxs6mt
2022/09/17 22:52:37.755274 [INFO] envBucket: elasticbeanstalk-us-east-2-128499673453
2022/09/17 22:52:37.755279 [INFO] Using manifest file name from command request
2022/09/17 22:52:37.755286 [INFO] Manifest name is : manifest_1663455120542
2022/09/17 22:52:37.755290 [INFO] Download app version manifest
2022/09/17 22:52:37.755396 [INFO] Downloading: bucket: elasticbeanstalk-us-east-2-128499673453, object: /resources/environments/e-ccpkpxs6mt/_runtime/versions/manifest_1663455120542
2022/09/17 22:52:37.796067 [INFO] Download successful121bytes downloaded
2022/09/17 22:52:37.796227 [INFO] Trying to read and parse version manifest...
2022/09/17 22:52:37.796449 [INFO] Downloading: bucket: elasticbeanstalk-us-east-2-128499673453, object: /resources/environments/e-ccpkpxs6mt/_runtime/_versions/village-wellth-ruby-api/app-67775-220917_185154781092
2022/09/17 22:52:37.813117 [INFO] Download successful197775bytes downloaded
2022/09/17 22:52:37.813325 [INFO] Executing instruction: ElectLeader
2022/09/17 22:52:37.813333 [INFO] Running leader election for instance i-0e0872d509267bfcf...
2022/09/17 22:52:37.813337 [INFO] Calling the cfn-elect-cmd-leader to elect the command leader.
2022/09/17 22:52:37.813350 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-elect-cmd-leader --stack arn:aws:cloudformation:us-east-2:128499673453:stack/awseb-e-ccpkpxs6mt-stack/3a519600-36d6-11ed-a060-0a8c5403ef94 --command-name ElasticBeanstalkCommand-AWSEBAutoScalingGroup --invocation-id 999ab5cf-586c-4c68-893a-ef2ed13fb680 --listener-id i-0e0872d509267bfcf --region us-east-2
2022/09/17 22:52:38.118455 [INFO] Instance is Leader.
2022/09/17 22:52:38.118511 [INFO] Executing instruction: stopSqsd
2022/09/17 22:52:38.118517 [INFO] This is a web server environment instance, skip stop sqsd daemon ...
2022/09/17 22:52:38.118522 [INFO] Executing instruction: PreBuildEbExtension
2022/09/17 22:52:38.118526 [INFO] Starting executing the config set Infra-EmbeddedPreBuild.
2022/09/17 22:52:38.118548 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-2:128499673453:stack/awseb-e-ccpkpxs6mt-stack/3a519600-36d6-11ed-a060-0a8c5403ef94 -r AWSEBAutoScalingGroup --region us-east-2 --configsets Infra-EmbeddedPreBuild
2022/09/17 22:52:38.438215 [INFO] Finished executing the config set Infra-EmbeddedPreBuild.
2022/09/17 22:52:38.438244 [INFO] Executing instruction: StageApplication
2022/09/17 22:52:38.438426 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2022/09/17 22:52:38.438443 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2022/09/17 22:52:38.460921 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2022/09/17 22:52:38.464089 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2022/09/17 22:52:38.464125 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2022/09/17 22:52:38.464149 [INFO] The dir .platform/hooks/prebuild/ does not exist
2022/09/17 22:52:38.464154 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/prebuild
2022/09/17 22:52:38.464160 [INFO] Executing instruction: stage ruby application
2022/09/17 22:52:38.464165 [INFO] stage ruby application ....
2022/09/17 22:52:38.464189 [INFO] Running command /bin/sh -c rbenv global
2022/09/17 22:52:38.474902 [INFO] 3.0.4
2022/09/17 22:52:38.474970 [INFO] Running command /bin/sh -c bundle --version
2022/09/17 22:52:38.663164 [INFO] Bundler version 2.3.20
2022/09/17 22:52:38.663209 [INFO] Running command /bin/sh -c bundle config set --local deployment true
2022/09/17 22:52:38.854040 [INFO] Running command /bin/sh -c bundle _2.3.20_ install
2022/09/17 22:52:39.179447 [INFO] Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Gemfile lists the gem ffaker (~> 2.2) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Your Ruby version is 3.0.4, but your Gemfile specified 3.0.2
2022/09/17 22:52:39.179483 [ERROR] An error occurred during execution of command [app-deploy] - [stage ruby application]. Stop running the command. Error: install dependencies in Gemfile failed with error Command /bin/sh -c bundle _2.3.20_ install failed with error exit status 18. Stderr:Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Gemfile lists the gem ffaker (~> 2.2) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Your Ruby version is 3.0.4, but your Gemfile specified 3.0.2
2022/09/17 22:52:39.179488 [INFO] Executing cleanup logic
2022/09/17 22:52:39.179602 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed to install dependency gems that you defined in 'Gemfile'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1663455159179,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1663455159179,"severity":"ERROR"}]}]}
2022/09/17 22:52:39.180595 [INFO] Platform Engine finished execution on command: app-deploy
2022/09/17 22:59:38.710545 [INFO] Starting...
2022/09/17 22:59:38.710595 [INFO] Starting EBPlatform-PlatformEngine
2022/09/17 22:59:38.710614 [INFO] reading event message file
2022/09/17 22:59:38.710776 [INFO] Engine received EB command cfn-hup-exec
2022/09/17 22:59:38.788846 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:128499673453:stack/awseb-e-ccpkpxs6mt-stack/3a519600-36d6-11ed-a060-0a8c5403ef94 -r AWSEBAutoScalingGroup --region us-east-2
2022/09/17 22:59:39.099998 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:128499673453:stack/awseb-e-ccpkpxs6mt-stack/3a519600-36d6-11ed-a060-0a8c5403ef94 -r AWSEBBeanstalkMetadata --region us-east-2
2022/09/17 22:59:39.407845 [INFO] checking whether command tail-log is applicable to this instance...
2022/09/17 22:59:39.407859 [INFO] this command is applicable to the instance, thus instance should execute command
2022/09/17 22:59:39.407863 [INFO] Engine command: (tail-log)
2022/09/17 22:59:39.407918 [INFO] Executing instruction: GetTailLogs
2022/09/17 22:59:39.407928 [INFO] Tail Logs...
2022/09/17 22:59:39.408288 [INFO] Running command /bin/sh -c tail -n 100 /var/log/web.stdout.log
2022/09/17 22:59:39.410046 [INFO] Running command /bin/sh -c tail -n 100 /var/log/eb-engine.log
----------------------------------------
/var/log/eb-hooks.log
----------------------------------------
----------------------------------------
/var/log/nginx/access.log
----------------------------------------
172.31.11.185 - - [17/Sep/2022:22:52:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:52:43 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:52:51 +0000] "GET /tpns?cmd=event&uid=8TBEBGJKL1K5JHF3111A&event_type=1&event_time=1663440769&dev_type=0001&MSG=0020220917185249 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "69.249.130.77"
172.31.11.185 - - [17/Sep/2022:22:52:56 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:52:58 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:00 +0000] "GET /tpns?cmd=event&uid=F36Z3S2FWW7GV2TF111A&event_type=1&event_time=1663440778&dev_type=0001&MSG=0020220917185258 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.31.15.156"
172.31.11.185 - - [17/Sep/2022:22:53:11 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:12 +0000] "GET /tpns?cmd=event&uid=9G1BCYSETEW6NXJS111A&event_type=1&event_time=1663426390&dev_type=0001&MSG=0020220917145310 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "104.137.136.7"
172.31.18.240 - - [17/Sep/2022:22:53:13 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:14 +0000] "GET /tpns?cmd=event&uid=RL16E938YL7PGHJ9111A&event_type=1&event_time=1663429992&dev_type=0001&MSG=0020220917155312 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "75.83.104.228"
172.31.18.240 - - [17/Sep/2022:22:53:19 +0000] "GET /tpns?cmd=event&uid=8ULE4M2XZZYA43WS111A&event_type=1&event_time=1663429997&dev_type=0001&MSG=0020220917155317 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.109.40.49"
172.31.11.185 - - [17/Sep/2022:22:53:26 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:28 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:29 +0000] "GET /tpns?cmd=event&uid=GBJUNWM21VPX8GLU111A&event_type=5&event_time=1663440807&dev_type=0001&MSG=0020220917185327 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "24.151.241.9"
172.31.11.185 - - [17/Sep/2022:22:53:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:43 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.11.185 - - [17/Sep/2022:22:53:56 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:53:58 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.11.185 - - [17/Sep/2022:22:54:11 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:11 +0000] "GET /tpns?cmd=event&uid=9G1BCYSETEW6NXJS111A&event_type=1&event_time=1663426450&dev_type=0001&MSG=0020220917145410 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "104.137.136.7"
172.31.18.240 - - [17/Sep/2022:22:54:13 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:22 +0000] "GET /tpns?cmd=event&uid=F36Z3S2FWW7GV2TF111A&event_type=1&event_time=1663440860&dev_type=0001&MSG=0020220917185420 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.31.15.156"
172.31.18.240 - - [17/Sep/2022:22:54:22 +0000] "GET /tpns?cmd=event&uid=E4VAP5K14DUYJEV3111A&event_type=1&event_time=1663430061&dev_type=0001&MSG=0020220917155421 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.181.247.95"
172.31.11.185 - - [17/Sep/2022:22:54:26 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:29 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:31 +0000] "GET /tpns?cmd=event&uid=HFW8E9VP3LS3D6GB111A&event_type=1&event_time=1663440869&dev_type=0001&MSG=0020220917185429 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "108.28.75.108"
172.31.11.185 - - [17/Sep/2022:22:54:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:42 +0000] "GET /tpns?cmd=event&uid=V7ZED6GBJ4LD3UT1111A&event_type=1&event_time=1663440881&dev_type=0001&MSG=0120220917185441 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "99.253.235.235"
172.31.18.240 - - [17/Sep/2022:22:54:44 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:48 +0000] "GET /tpns/apns.php?cmd=raise_event&uid=3JCBMUE8X42J5LCW111A&event_type=1&event_time=1069171954&dev_type=0001&MSG=0620220917195449 HTTP/1.1" 404 18 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.248.140.179"
172.31.18.240 - - [17/Sep/2022:22:54:55 +0000] "GET /tpns?cmd=event&uid=DFKPUNG427Y5FBV7111A&event_type=1&event_time=1663440893&dev_type=0001&MSG=0020220917185453 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "47.205.13.108"
172.31.11.185 - - [17/Sep/2022:22:54:56 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:59 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:54:59 +0000] "GET /tpns/apns.php?cmd=raise_event&uid=3HJVFLAZ8NKFHP3L111A&event_type=1&event_time=1039171555&dev_type=0001&MSG=0320220917155500 HTTP/1.1" 404 18 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "24.22.176.105"
172.31.11.185 - - [17/Sep/2022:22:55:11 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:14 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:18 +0000] "GET /tpns?cmd=event&uid=8ULE4M2XZZYA43WS111A&event_type=1&event_time=1663430116&dev_type=0001&MSG=0020220917155516 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.109.40.49"
172.31.18.240 - - [17/Sep/2022:22:55:24 +0000] "GET /tpns?cmd=event&uid=9G1BCYSETEW6NXJS111A&event_type=1&event_time=1663426522&dev_type=0001&MSG=0020220917145522 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "104.137.136.7"
172.31.11.185 - - [17/Sep/2022:22:55:26 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:29 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:39 +0000] "GET /tpns?cmd=event&uid=F36Z3S2FWW7GV2TF111A&event_type=1&event_time=1663440937&dev_type=0001&MSG=0020220917185537 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.31.15.156"
172.31.18.240 - - [17/Sep/2022:22:55:41 +0000] "GET /tpns/apns.php?cmd=raise_event&uid=3JCBMUE8X42J5LCW111A&event_type=1&event_time=1049171955&dev_type=0001&MSG=0420220917195532 HTTP/1.1" 404 18 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.248.140.179"
172.31.11.185 - - [17/Sep/2022:22:55:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:44 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.11.185 - - [17/Sep/2022:22:55:56 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:59 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:55:59 +0000] "GET /tpns?cmd=event&uid=RKDVF7BUNHG2W767111A&event_type=1&event_time=1663430157&dev_type=0001&MSG=0020220917155557 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "50.159.54.121"
172.31.11.185 - - [17/Sep/2022:22:56:11 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:56:14 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:56:25 +0000] "GET /tpns/apns.php?cmd=raise_event&uid=3JCBMUE8X42J5LCW111A&event_type=1&event_time=1069171956&dev_type=0001&MSG=0620220917195606 HTTP/1.1" 404 18 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.248.140.179"
172.31.11.185 - - [17/Sep/2022:22:56:26 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:56:29 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.11.185 - - [17/Sep/2022:22:56:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:56:44 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:56:47 +0000] "GET /tpns?cmd=event&uid=F36Z3S2FWW7GV2TF111A&event_type=1&event_time=1663441005&dev_type=0001&MSG=0020220917185645 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.31.15.156"
172.31.11.185 - - [17/Sep/2022:22:56:56 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:56:59 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:05 +0000] "GET /tpns?cmd=event&uid=9G1BCYSETEW6NXJS111A&event_type=1&event_time=1663426623&dev_type=0001&MSG=0020220917145703 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "104.137.136.7"
172.31.11.185 - - [17/Sep/2022:22:57:11 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:14 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:23 +0000] "GET /tpns?cmd=event&uid=8ULE4M2XZZYA43WS111A&event_type=1&event_time=1663430241&dev_type=0001&MSG=0020220917155721 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.109.40.49"
172.31.11.185 - - [17/Sep/2022:22:57:26 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:29 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:34 +0000] "GET /tpns?cmd=event&uid=L5ZD2FWE7DVG5ATS111A&event_type=1&event_time=1663441053&dev_type=0001&MSG=0120220917185733 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.188.141.30"
172.31.18.240 - - [17/Sep/2022:22:57:41 +0000] "GET /tpns?cmd=event&uid=RKDVF7BUNHG2W767111A&event_type=1&event_time=1663430259&dev_type=0001&MSG=0020220917155739 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "50.159.54.121"
172.31.11.185 - - [17/Sep/2022:22:57:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:44 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:49 +0000] "GET /tpns?cmd=event&uid=F36Z3S2FWW7GV2TF111A&event_type=1&event_time=1663441067&dev_type=0001&MSG=0020220917185747 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.31.15.156"
172.31.18.240 - - [17/Sep/2022:22:57:49 +0000] "GET /tpns?cmd=event&uid=R612GSDMZ4VNW5BE111A&event_type=1&event_time=1663430267&dev_type=0001&MSG=0020220917155747 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.140.215.133"
172.31.11.185 - - [17/Sep/2022:22:57:56 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:57:59 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.11.185 - - [17/Sep/2022:22:58:11 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:14 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:20 +0000] "GET /tpns?cmd=event&uid=LVVRGNGRBGHBW47S111A&event_type=1&event_time=1663441098&dev_type=0001&MSG=0020220917185818 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "71.56.160.221"
172.31.11.185 - - [17/Sep/2022:22:58:26 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:28 +0000] "GET /tpns?cmd=event&uid=S9SUFXU3DPNKZSEU111A&event_type=1&event_time=1663437506&dev_type=0001&MSG=0020220917175826 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "143.55.60.22"
172.31.18.240 - - [17/Sep/2022:22:58:29 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:32 +0000] "GET /tpns?cmd=event&uid=9G1BCYSETEW6NXJS111A&event_type=1&event_time=1663426711&dev_type=0001&MSG=0020220917145831 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "104.137.136.7"
172.31.18.240 - - [17/Sep/2022:22:58:35 +0000] "GET /tpns?cmd=event&uid=JXWZBY1KBFLMF8H1111A&event_type=1&event_time=1663437513&dev_type=0001&MSG=0020220917175833 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "104.192.238.29"
172.31.11.185 - - [17/Sep/2022:22:58:41 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:44 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:49 +0000] "GET /tpns?cmd=event&uid=F36Z3S2FWW7GV2TF111A&event_type=1&event_time=1663441127&dev_type=0001&MSG=0020220917185847 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.31.15.156"
172.31.11.185 - - [17/Sep/2022:22:58:57 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:58 +0000] "GET /.env HTTP/1.1" 404 9 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "20.29.101.230"
172.31.18.240 - - [17/Sep/2022:22:58:59 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:58:59 +0000] "GET /tpns?cmd=event&uid=R612GSDMZ4VNW5BE111A&event_type=1&event_time=1663430337&dev_type=0001&MSG=0020220917155857 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.140.215.133"
172.31.18.240 - - [17/Sep/2022:22:58:59 +0000] "POST / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "20.29.101.230"
172.31.11.185 - - [17/Sep/2022:22:59:01 +0000] "GET / HTTP/1.1" 200 3710 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:103.0) Gecko/20100101 Firefox/103.0" "149.248.174.14"
172.31.11.185 - - [17/Sep/2022:22:59:01 +0000] "GET /favicon.ico HTTP/1.1" 404 16 "http://vw-staging.eba-qp4vtugk.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:103.0) Gecko/20100101 Firefox/103.0" "149.248.174.14"
172.31.11.185 - - [17/Sep/2022:22:59:12 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:59:14 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:59:15 +0000] "GET /tpns?cmd=event&uid=8ULE4M2XZZYA43WS111A&event_type=1&event_time=1663430353&dev_type=0001&MSG=0020220917155913 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "73.109.40.49"
172.31.18.240 - - [17/Sep/2022:22:59:21 +0000] "GET /tpns?cmd=event&uid=934PCX21LYV87MJW111A&event_type=1&event_time=1663430360&dev_type=0001&MSG=0520220917155920 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "64.234.40.152"
172.31.18.240 - - [17/Sep/2022:22:59:25 +0000] "GET /tpns?cmd=event&uid=934PCX21LYV87MJW111A&event_type=1&event_time=1663430364&dev_type=0001&MSG=0420220917155924 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "64.234.40.152"
172.31.11.185 - - [17/Sep/2022:22:59:27 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"
172.31.18.240 - - [17/Sep/2022:22:59:27 +0000] "GET /tpns?cmd=event&uid=934PCX21LYV87MJW111A&event_type=1&event_time=1663430366&dev_type=0001&MSG=0520220917155926 HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5" "64.234.40.152"
172.31.18.240 - - [17/Sep/2022:22:59:29 +0000] "GET / HTTP/1.1" 200 3710 "-" "ELB-HealthChecker/2.0" "-"

Swagger UI is blank or empty when i try t connect it to kong.yaml

This is the swagger of port 8099 swagger of 8099 then after i connect it to kong kong swagger the tab name is changing to Swagger UI that means its working but its empty. Any Solution?
//kong.yaml for swagger
_format_version: "2.1"
_transform: true
services:
# ------ Swagger port -------
- host: host.docker.internal
port: 8099
name: swagger-service
path: /swagger-ui/index.html
routes:
- name: swagger-service
paths:
- /swagger
strip_path: true
After i enter the port http://localhost:8000/swagger this will show
kong | 172.24.0.1 - - [24/May/2022:07:48:11 +0000] "GET /favicon-16x16.png HTTP/1.1" 404 48 "http://localhost:8000/swagger" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53"

Ingress Nginx rules doesn't get followed always

I got 2 spring app pods deployed in k8 cluster. 1 replica each. Both have their cluster-ip services exposing the services.
/upstream/agentLabs/makeotherTierCall should forward to prevlab deployment /agentLabs/makeOtherTierCall
/downstream/basics/hello should forward to newlab deployment /basics/hello
I am using ingress-nginx to redirect the traffic with following rules.
ingress-service.yml
apiVersion: networking.k8s.io/v1
# UPDATE API
kind: Ingress
metadata:
namespace: javaspace
name: ingress-service
annotations:
kubernetes.io/ingress.class: 'nginx'
nginx.ingress.kubernetes.io/use-regex: 'true'
# ADD ANNOTATION
nginx.ingress.kubernetes.io/rewrite-target: /$1
# UPDATE ANNOTATION
spec:
rules:
- http:
paths:
- path: /upstream?(.*)
# UPDATE PATH
pathType: Prefix
# ADD PATHTYPE
backend:
service:
# UPDATE SERVICE FIELDS
name: prevlab-cluster-ip-service
port:
number: 8080
- path: /downstream?(.*)
# UPDATE PATH
pathType: Prefix
# ADD PATHTYPE
backend:
service:
# UPDATE SERVICE FIELDS
name: newlab-cluster-ip-service
port:
number: 8080
The issue is when I make any call (both 1 and 2) sometimes the ingress controller forwards the traffic correctly and sometimes it doesn't and I get 404. Basically, what I am observing is that alternatively the traffic is getting routed to both cluster-ip services one after the other.
for eg. if I make /upstream/agentLabs/makeotherTierCall request 2 times, at first it forwards wrongly to newlab cluster-ip service (giving back 404), and then next it forwards correctly to prevlab cluster-ip service (giving back 200).
ingress-nginx controller setup
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.1/deploy/static/provider/cloud/deploy.yaml
ingress-controller logs
192.168.65.3 - - [24/Sep/2021:10:04:21 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.008 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.181:8080 12 0.007 200 24ae53531ce4d7109004f81e79534ca4
192.168.65.3 - - [24/Sep/2021:10:04:21 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 404 286 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.006 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.179:8080 286 0.005 404 1a32efb3a9dc21cce01b908afeb0248a
192.168.65.3 - - [24/Sep/2021:10:04:22 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.007 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.181:8080 12 0.007 200 542bd4abba25be5a416deca1152cb29b
192.168.65.3 - - [24/Sep/2021:10:04:22 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 404 286 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.008 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.179:8080 286 0.007 404 aaea8e3bf60dab81ef7454d51863a22d
192.168.65.3 - - [24/Sep/2021:10:07:23 +0000] "GET /downstream/basics/hello HTTP/2.0" 404 306 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.009 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.181:8080 306 0.009 404 178bd79cc71b73f7a337a2652322d65f
192.168.65.3 - - [24/Sep/2021:10:07:23 +0000] "GET /downstream/basics/hello HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.002 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.179:8080 12 0.003 200 280d2b7974ae38a467237cc6cf437b98
192.168.65.3 - - [24/Sep/2021:10:07:24 +0000] "GET /downstream/basics/hello HTTP/2.0" 404 306 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.008 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.181:8080 306 0.008 404 4e237232b4c53c9bb90e7bb59c15e916
192.168.65.3 - - [24/Sep/2021:10:07:24 +0000] "GET /downstream/basics/hello HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.003 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.179:8080 12 0.002 200 be0cf532a972ec0d783e15869470f579
Using Docker Desktop's Kubernetes. Kubernetes 1.21.2
What am I doing wrong here? Is this default behavior? Do I need to do some additional config?
Nevermind. I had done a very small but very stupid mistake. In case someone comes wandering around here: I had used the same label for my 2 backend services. And for each of the cluster-IP services used the same selector. Hence, I was seeing inconsistent behavior.

Nginx config issue : vue.js history mode on k8s cluster

I'm trying to deploy a vue.js application on a k8s cluster using docker and docker-compose. I'm also using a nginx ingress controller.
I'm using a configmap to load my custom nginx conf, according to this :
https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations
As a matter of fact my application loads properly, but refreshing a page other than the homepage results in a 404 error. And that's just the same if I try and access any given page by its URL.
What am I doing wrong ?
I'm using kubectl in command line to deploy.
Here's my Dockerfile :
# build environment
FROM node:12.2.0-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY ./[project folder]/ .
RUN npm config set unsafe-perm true
RUN npm install --silent
RUN npm install #vue/cli#3.7.0 -g
RUN npm run build
# production environment
FROM nginx:1.16.0-alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
My ingress.yaml:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: foo-ingress-lb
annotations:
kubernetes.io/ingress.class: "nginx"
kubernetes.io/tls-acme: "true"
cert-manager.io/issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
tls:
- hosts:
- www.foo.com
# This assumes tls-secret exists and the SSL
# certificate contains a CN for foo.bar.com
secretName: tls-secret
rules:
- host: www.foo.com
http:
paths:
- path: /.*
pathType: Prefix
backend:
service:
name: my-service
port:
number: 80
My configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: vue-config
labels:
app: vue-config
data:
default.conf:
server {
listen 8080 default;
root /var/www/app;
location / {
try_files $uri $uri/ /index.html;
}
}
service.yaml
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
ports:
- port: 80
name: http-front
protocol: TCP
targetPort: 80
selector:
app: my-app
And finally my deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: "my-deployment"
spec:
replicas: 1
selector:
matchLabels:
app: "my-app"
template:
metadata:
labels:
app: "my-app"
spec:
containers:
- name: "vue-nginx"
image: XXX/nginx:alpine
volumeMounts:
- mountPath: /var/www/app
name: html-files
- mountPath: /etc/nginx/conf.d
name: config
ports:
- containerPort: 8080
imagePullPolicy: "Always"
- name: "vue"
image:XXX/my_image:latest
volumeMounts:
- mountPath: /var/www/app
name: html-files
ports:
- containerPort: 8080
imagePullPolicy: "Always"
imagePullSecrets:
- name: registry-secret
restartPolicy: Always
volumes:
- name: html-files
emptyDir: {}
- name: config
configMap:
name: vue-config
kubectl logs -n kube-system nginx-ingress-xxx
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET / HTTP/2.0" 200 3114 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 684 0.019 [default-maorie-service-front-80] [] 100.64.0.205:80 3114 0.016 200 eaa454a87cf4cee8929f15f3ecd75dcc
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/app.8b722d7e.css HTTP/2.0" 200 11488 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 85 0.001 [default-maorie-service-front-80] [] 100.64.0.205:80 11488 0.000 200 6cce6ff53f0b3b57807eef9df4ab1e2d
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-vendors.2072d5c4.css HTTP/2.0" 200 398846 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 36 0.005 [default-maorie-service-front-80] [] 100.64.0.205:80 398846 0.004 200 ea59b05209b2d7e910ac380ceda13b3f
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/app.147dc57f.js HTTP/2.0" 200 46213 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.002 [default-maorie-service-front-80] [] 100.64.0.205:80 46213 0.000 200 cc6b44751229b2ef4a279defae770da5
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/chunk-vendors.ed6dc4c7.js HTTP/2.0" 200 590498 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 36 0.004 [default-maorie-service-front-80] [] 100.64.0.205:80 590498 0.004 200 49e3731caaf832ec21e669affa6c722d
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-2678b26c.8577e149.css HTTP/2.0" 200 2478 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.002 [default-maorie-service-front-80] [] 100.64.0.205:80 2478 0.000 200 001a3ce8a18e6c9b8433f84ddd7a0412
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-2470e996.066be083.css HTTP/2.0" 200 72983 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 94 0.006 [default-maorie-service-front-80] [] 100.64.0.205:80 72983 0.008 200 092515d8d6804324d24fc3fabad87eba
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-30fff3f3.e2b55839.css HTTP/2.0" 200 20814 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.001 [default-maorie-service-front-80] [] 100.64.0.205:80 20814 0.000 200 f9f78eb5b9b1963a06d386a1c9421189
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-3db1ab7a.0a0e84c4.css HTTP/2.0" 200 3329 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.001 [default-maorie-service-front-80] [] 100.64.0.205:80 3329 0.000 200 d66e57d023158381d0eb7b4ce0fcf4c1
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-7ac8b24c.353e933b.css HTTP/2.0" 200 10170 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.003 [default-maorie-service-front-80] [] 100.64.0.205:80 10170 0.000 200 fcb3655b95599822f79587650ca0c017
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/chunk-2678b26c.e69fb49a.js HTTP/2.0" 200 103310 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 37 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 103310 0.008 200 3423ac43407db755c1a23bca65ca8a0e
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/canvg.a381dd7b.js HTTP/2.0" 200 143368 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 31 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 143368 0.008 200 61d6e047f66dc9b36c836c1b49d2452d
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/chunk-3db1ab7a.6fc5dc72.js HTTP/2.0" 200 8157 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 37 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 8157 0.008 200 90231ff6f00b168861f10511ab58ae29
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/chunk-6e83591c.163e5349.js HTTP/2.0" 200 22685 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 37 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 22685 0.008 200 7d56be2022473cc6055cf8101090fdb7
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/chunk-7ac8b24c.1a4727cd.js HTTP/2.0" 200 37637 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 37 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 37637 0.008 200 e38c234d67700b4f4e2ffe4125bed445
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /css/chunk-b09da666.b0ea57ae.css HTTP/2.0" 200 1414 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 1414 0.008 200 e8b8c016069e4c59c929b61e8ba5502b
195.154.69.132 - - [21/Jan/2021:09:23:06 +0000] "GET /js/chunk-b09da666.e5df996b.js HTTP/2.0" 200 1228 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 38 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 1228 0.008 200 4964cb095baf55cebed49bbcc3fe1af2
195.154.69.132 - - [21/Jan/2021:09:23:08 +0000] "GET /js/chunk-30fff3f3.f6defc09.js HTTP/2.0" 200 3386928 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 37 1.634 [default-maorie-service-front-80] [] 100.64.0.205:80 3386928 1.632 200 4ed3d78d4d72be629deaf579670168ff
195.154.69.132 - - [21/Jan/2021:09:23:08 +0000] "GET /img/logo.956610d4.png HTTP/2.0" 200 6620 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 75 0.355 [default-maorie-service-front-80] [] 100.64.0.205:80 6620 0.352 200 c16abf3b959c147ab469b73fd548dc95
195.154.69.132 - - [21/Jan/2021:09:23:13 +0000] "GET /img/icons/favicon-32x32.png HTTP/2.0" 200 1690 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 34 0.583 [default-maorie-service-front-80] [] 100.64.0.205:80 1690 0.584 200 f7c2c72bebd294c07f174fa91c4fd40f
195.154.69.132 - - [21/Jan/2021:09:23:15 +0000] "GET /js/pdfmake.b17ba0e4.js HTTP/2.0" 200 2127948 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 32 8.697 [default-maorie-service-front-80] [] 100.64.0.205:80 2127948 8.696 200 edb7e05dd9d87cfc91bc5986b80ff8a8
195.154.69.132 - - [21/Jan/2021:09:23:20 +0000] "GET /js/xlsx.a4e6cbf1.js HTTP/2.0" 200 924857 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 30 13.529 [default-maorie-service-front-80] [] 100.64.0.205:80 924857 13.528 200 8ffa5bb28d9d255e69021ccce35a4dfe
195.154.69.132 - - [21/Jan/2021:09:23:20 +0000] "GET /js/chunk-2470e996.bc9a0d30.js HTTP/2.0" 200 9615968 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 37 13.992 [default-maorie-service-front-80] [] 100.64.0.205:80 9615968 13.992 200 6e42aeb8a644afa385aa8a166fbb5860
195.154.69.132 - - [21/Jan/2021:09:23:31 +0000] "GET /js/chunk-2470e996.bc9a0d30.js HTTP/2.0" 200 9615968 "https://dev.maorie.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" 36 10.464 [default-maorie-service-front-80] [] 100.64.0.205:80 9615968 10.464 200 f8eb813e1091ed422525611f61a17d68
195.154.69.132 - - [21/Jan/2021:09:35:01 +0000] "GET /service-worker.js HTTP/2.0" 200 1069 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" 919 0.004 [default-maorie-service-front-80] [] 100.64.0.205:80 1069 0.004 200 a03dd0f950c451a8016823c28a958dae
195.154.69.132 - - [21/Jan/2021:09:35:01 +0000] "GET /precache-manifest.2a722082efdadd279fa63223d8219496.js HTTP/2.0" 200 3232 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" 51 0.009 [default-maorie-service-front-80] [] 100.64.0.205:80 3232 0.008 200 e8cdcd5bc52b8a9a8777de4a1e680f1d
195.154.69.132 - - [21/Jan/2021:09:35:05 +0000] "GET /service-worker.js HTTP/2.0" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" 50 0.002 [default-maorie-service-front-80] [] 100.64.0.205:80 0 0.000 304 c0e319cf30abfffd9dc13da6bad8453c
193.32.164.26 - - [21/Jan/2021:10:06:33 +0000] "\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr" 400 150 "-" "-" 0 0.021 [] [] - - - - 5de24d60404270018011b04db4194bd4
193.32.164.26 - - [21/Jan/2021:10:06:33 +0000] "\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr" 400 150 "-" "-" 0 0.019 [] [] - - - - 860c19f03a627f6de82bd538fc0c68f1
195.154.69.132 - - [21/Jan/2021:10:20:14 +0000] "\xAA\xAA\xAA\xAAUUUUUUUU\xAA\xAA\xAA\xAAUUUU\xAA\xAA\xAA\xAAUUUU\xAA\xAA\xAA\xAAUUUU\xAA\xAA\xAA\xAAUUUU\xAA\xAA\xAA\xAAUUUU\xAA\xAA\xAA\xAAUUUU\xAA\xAA\xAA\xAA" 400 150 "-" "-" 0 0.015 [] [] - - - - a604c37ad900da39307e364e55f4db90
195.154.69.132 - - [21/Jan/2021:10:25:19 +0000] "GET /service-worker.js HTTP/2.0" 200 1069 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" 914 0.015 [default-maorie-service-front-80] [] 100.64.0.205:80 1069 0.016 200 5856773011e3f4887361fd864e7ca3cc
195.154.69.132 - - [21/Jan/2021:10:25:24 +0000] "GET /service-worker.js HTTP/2.0" 200 1069 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" 13 0.001 [default-maorie-service-front-80] [] 100.64.0.205:80 1069 0.000 200 a2157ea238ab87fa87f59262a4023076
5.188.210.227 - - [21/Jan/2021:10:30:35 +0000] "\x05\x01\x00" 400 150 "-" "-" 0 0.622 [] [] - - - - b42d10d3b0579c8c55d3febbebc1da59
5.188.210.227 - - [21/Jan/2021:10:31:47 +0000] "\x04\x01\x00P\x05\xBC\xD2\xE3\x00" 400 150 "-" "-" 0 0.380 [] [] - - - - 77536a3304f9d249198240df300dec18
195.154.69.132 - - [21/Jan/2021:10:44:04 +0000] "GET / HTTP/1.1" 200 3114 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 255 0.013 [default-maorie-service-front-80] [] 100.64.0.205:80 3114 0.012 200 2e568e4805e1bfd0ccdfd8e91e5807c3
157.245.176.143 - - [21/Jan/2021:10:54:31 +0000] "SSTP_DUPLEX_POST /sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/ HTTP/1.1" 400 150 "-" "-" 192 0.000 [] [] - - - - e28b66acd059bf0d8c9264395c119aad
E0121 11:00:21.036598 6 leaderelection.go:357] Failed to update lock: etcdserver: request timed out
195.154.69.132 - - [21/Jan/2021:11:21:48 +0000] "GET / HTTP/1.1" 308 164 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 255 0.000 [default-maorie-service-front-80] [] - - - - 5cf25e7eba89ae4a9c06d81532951824
18.136.126.138 - - [21/Jan/2021:11:46:06 +0000] "\x16\x03\x01\x02\x00\x01\x00\x01\xFC\x03\x03\x8F^\xE5#p\xB3\xA4\xA7H\xB1`\xF7\x9FZ\xF7=|\xA6\x82" 400 150 "-" "-" 0 0.494 [] [] - - - - 83a6709f7eaa820c4f9829979de617a4
195.154.69.132 - - [21/Jan/2021:12:56:23 +0000] "CONNECT ip.ws.126.net:443 HTTP/1.1" 400 150 "-" "-" 0 0.913 [] [] - - - - 1ddfb9204b6efa687d05a138f213bef2
222.186.136.150 - - [21/Jan/2021:13:15:16 +0000] "CONNECT ip.ws.126.net:443 HTTP/1.1" 400 150 "-" "-" 0 0.257 [] [] - - - - 87c08e487d0c9a7e786685c8dd1a589b
64.227.97.195 - - [21/Jan/2021:13:18:32 +0000] "\x00\x0E8\x97\xAB\xB2\xBB\xBA\xB1\x1D\x90\x00\x00\x00\x00\x00" 400 150 "-" "-" 0 0.152 [] [] - - - - 4d89d6868e909990414d125fe5e3862d
167.71.102.181 - - [21/Jan/2021:13:19:52 +0000] "\x00\x0E8f:d5\xBE\xC3\xBC_\x00\x00\x00\x00\x00" 400 150 "-" "-" 0 0.086 [] [] - - - - efbe674f606c5bf20e6903da0ae39855
I0121 14:15:35.862702 6 controller.go:144] "Configuration changes detected, backend reload required"
I0121 14:15:35.865621 6 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"maorie-ingress-lb", UID:"a5ad31d8-c913-4139-a721-2a5c0f7119d3", APIVersion:"networking.k8s.io/v1beta1", ResourceVersion:"5627714245", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0121 14:15:36.262759 6 controller.go:161] "Backend successfully reloaded"
I0121 14:15:36.265762 6 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"kube-system", Name:"nginx-ingress-29787", UID:"07845f40-87d4-40ce-83d1-01a3d37011c1", APIVersion:"v1", ResourceVersion:"4834374834", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
As said in the comments, I finally realised the nginx configmap was not needed, as the docker image embedded an nginx on its own.
Removing the configmap instructions in deployment.yaml did the trick !

Resources