Strapi on Windows, error EACCES on port 80 - strapi

Strapi Version: 4.4.5
Operating System: Windows 2022 Datacenter + Plesk Obsidian 18.0.48
Database: MariaDB 10.6.9
Node Version: 16.16
NPM Version: 8.19.2
Yarn Version: N/A
Error : listen EACCES: permission denied 0.0.0.0:80
-> server.js
module.exports = ({env}) => ({
host: '0.0.0.0',
port: 8081,
app: {
keys: env.array('APP_KEYS'),
},
});
-> package.json
"dependencies": {
"#strapi/plugin-i18n": "4.4.5",
"#strapi/plugin-users-permissions": "4.4.5",
"#strapi/strapi": "4.4.5",
"better-sqlite3": "7.4.6",
"cross-env": "^7.0.3",
"mysql": "^2.18.1"
},
"engines": {
"node": ">=14.19.1 <=18.x.x",
"npm": ">=6.0.0"
},
Hi,
if use port 8081, application run in localhost:8081, but if use my domain xyz.com:8081, i have this error :
-> localhost : 80
$ npm run-script start
> plesk-strapi#0.1.0 start
> strapi start
Project information
┌────────────────────┬──────────────────────────────────────────────────┐
│ Time │ Tue Jan 10 2023 16:05:06 GMT+0100 (heure normal… │
│ Launched in │ 1628 ms │
│ Environment │ development │
│ Process PID │ 11532 │
│ Version │ 4.4.5 (node v16.19.0) │
│ Edition │ Community │
Actions available
Welcome back!
To manage your project , go to the administration panel at:
http://localhost:8081/admin
To access the server , go to:
http://localhost:8081
-> xyz.com : 8081
HRESULT: 0x2
HTTP status: 500
HTTP subStatus: 1002
HTTP reason: Internal Server Error
Application has thrown an uncaught exception and is terminated:
TypeError: process.send is not a function
at Strapi.stop (E:\plesk\vhost\xyz.com\strapi-demo.xyz.com\node_modules\#strapi\strapi\lib\Strapi.js:321:15)
at Strapi.stopWithError (E:\plesk\vhost\xyz.com\strapi-demo.xyz.com\node_modules\#strapi\strapi\lib\Strapi.js:314:17)
at Server.<anonymous> (E:\plesk\vhost\xyz.com\strapi-demo.xyz.com\node_modules\#strapi\strapi\lib\services\server\http-server.js:31:21)
at Server.emit (node:events:513:28)
at emitErrorNT (node:net:1490:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
if change for port 80, localhost & online not runing, i have this error :
-> localhost : 80
$ npm run-script start
> plesk-strapi#0.1.0 start
> strapi start
[2023-01-10 16:02:29.555] error: listen EACCES: permission denied 0.0.0.0:80
Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (node:net:1446:21)
at listenInCluster (node:net:1511:12)
at doListen (node:net:1660:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
-> xyz.com : 80
(node:10548) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Related

running browserstack-cypress run --sync ends up with ends up with Client network socket disconnected before secure TLS connection was established

I am trying to use browserstack-cypress with parameter local
Below are my step
run browserstacklocal for linux with command
./BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --local-identifier $LOCAL_IDENTIFIER --proxy-host $PROXY_HOST --proxy-port $PROXY_PORT --proxy-pass $PROXY_PASS --proxy-user $PROXY_USER --enable-logging-for-api --force-proxy --force-local --verbose 2 > /dev/null 2>&1 &
- sleep 10
verified above step is successful so next is running browserstack-cypress with below option
browserstack-cypress run --sync --specs "${TEST_SPEC_PATH}" --key $BROWSERSTACK_ACCESS_KEY --cf $TEST_CONFIG_PATH --env TEST_USER_NAME=$UBSTEST_USER_NAME,TEST_USER_PASSWORD=$UBSTEST_USER_PASSWORD,BROWSERSTACK_USER=$BROWSERSTACK_USERNAME,BROWSERSTACK_KEY=$BROWSERSTACK_ACCESS_KEY --verbose 2
I have below in my browserstack.json
{
"auth": {
"username": "username",
"access_key": "password",
},
"connection_settings": {
"local": true,
"local_identifier": "5C0E65F2D95C4E55A8DE465248A44E99"
},
but step above ends up with below error
Got Error in binary downloading request Error: Client network socket disconnected before secure TLS connection was established
at connResetException (internal/errors.js:604:14)
at TLSSocket.onConnectEnd (_tls_wrap.js:1513:19)
at Object.onceWrapper (events.js:417:28)
at TLSSocket.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'ECONNRESET',
path: null,
host: 'bstack-local-prod.s3.amazonaws.com',
port: 443,
localAddress: undefined
I am using node v12.16.1 and npm 6.13.1
Same issue was raised before may be this helps https://github.com/browserstack/browserstack-cypress-cli/issues/126

Unable to put Vault UI in https

I try to run Vault with a CRC OpenShift 4.7 and helm3 but I've some problems when I try to enable the UI in https.
Add hashicorp repo :
helm repo add hashicorp https://helm.releases.hashicorp.com
Install the latest version of vault :
[[tim#localhost config]]$ helm install vault hashicorp/vault \
> --namespace vault-project \
> --set "global.openshift=true" \
> --set "server.dev.enabled=true"
Then I run oc get pods
[tim#localhost config]$ oc get pods
NAME READY STATUS RESTARTS AGE
vault-project-0 0/1 Running 0 48m
vault-project-agent-injector-8568dbf75d-4gjnw 1/1 Running 0 6h9m
I run an interactive shell session with the vault-0 pod :
oc rsh vault-project-0
Then I initialize Vault :
/ $ vault operator init --tls-skip-verify -key-shares=1 -key-threshold=1
Unseal Key 1: iE1iU5bnEsRPSkx0Jd5LWx2NMy2YH6C8bG9+Zo6/VOs=
Initial Root Token: s.xVb0DvIMQRYam7oS2C0ZsHBC
Vault initialized with 1 key shares and a key threshold of 1. Please securely
distribute the key shares printed above. When the Vault is re-sealed,
restarted, or stopped, you must supply at least 1 of these keys to unseal it
before it can start servicing requests.
Vault does not store the generated master key. Without at least 1 key to
reconstruct the master key, Vault will remain permanently sealed!
It is possible to generate new unseal keys, provided you have a quorum of
existing unseal keys shares. See "vault operator rekey" for more information.
Export the token :
export VAULT_TOKEN=s.xVb0DvIMQRYam7oS2C0ZsHBC
Unseal Vault :
/ $ vault operator unseal --tls-skip-verify iE1iU5bnEsRPSkx0Jd5LWx2NMy2YH6C8bG9+Zo6/VOs=
Key Value
--- -----
Seal Type shamir
Initialized true
Sealed false
Total Shares 1
Threshold 1
Version 1.6.2
Storage Type file
Cluster Name vault-cluster-21448fb0
Cluster ID e4d4649f-2187-4682-fbcb-4fc175d20a6b
HA Enabled false
I check the pods :
[tim#localhost config]$ oc get pods
NAME READY STATUS RESTARTS AGE
vault-project-0 1/1 Running 0 35m
vault-project-agent-injector-8568dbf75d-4gjnw 1/1 Running 0 35m
 
I'm able to get the UI without https :
In the OpenShift console, I switch to the Administrator mode and this is what I've done :
Networking part
- Routes > Create routes
Name : vault-route
Hostname : 192.168.130.11
Path :
Service : vault
Target Port : 8200 -> 8200 (TCP)
Now, if I check the URL : http://192.168.130.11/ui :
The UI is available.
 
In order to enable the https, I've followed the step here :
https://www.vaultproject.io/docs/platform/k8s/helm/examples/standalone-tls
But I've change the K8S commands for the OpenShift commands
# SERVICE is the name of the Vault service in Kubernetes.
# It does not have to match the actual running service, though it may help for consistency.
SERVICE=vault-server-tls
# NAMESPACE where the Vault service is running.
NAMESPACE=vault-project
# SECRET_NAME to create in the Kubernetes secrets store.
SECRET_NAME=vault-server-tls
# TMPDIR is a temporary working directory.
TMPDIR=/**tmp**
Then :
openssl genrsa -out ${TMPDIR}/vault.key 2048
Then create the csr.conf file :
[tim#localhost tmp]$ cat csr.conf
[req]
default_bits = 4096
default_md = sha256
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = #alt_names
[alt_names]
DNS.1 = vault-project
DNS.2 = vault-project.vault-project
DNS.3 = *apps-crc.testing
DNS.4 = *api.crc.testing
IP.1 = 127.0.0.1
Create the CSR :
openssl req -new -key': openssl req -new -key ${TMPDIR}/vault.key -subj "/CN=${SERVICE}.${NAMESPACE}.apps-crc.testing" -out ${TMPDIR}/server.csr -config ${TMPDIR}/csr.conf
Create the file ** csr.yaml :
$ export CSR_NAME=vault-csr
$ cat <<EOF >${TMPDIR}/csr.yaml
apiVersion: certificates.k8s.io/v1beta1
kind: CertificateSigningRequest
metadata:
name: ${CSR_NAME}
spec:
groups:
- system:authenticated
request: $(cat ${TMPDIR}/server.csr | base64 | tr -d '\n')
usages:
- digital signature
- key encipherment
- server auth
EOF
Send the CSR to OpenShfit :
oc create -f ${TMPDIR}/csr.yaml
Approve CSR :
oc adm certificate approve ${CSR_NAME}
Retrieve the certificate :
serverCert=$(oc get csr ${CSR_NAME} -o jsonpath='{.status.certificate}')
Write the certificate out to a file :
echo "${serverCert}" | openssl base64 -d -A -out ${TMPDIR}/vault.crt
Retrieve Openshift CA :
oc config view --raw --minify --flatten -o jsonpath='{.clusters[].cluster.certificate-authority-data}' | base64 -d > ${TMPDIR}/vault.ca
Store the key, cert, and OpenShift CA into Kubernetes secrets :
oc create secret generic ${SECRET_NAME} \
--namespace ${NAMESPACE} \
--from-file=vault.key=/home/vault/certs/vault.key \
--from-file=vault.crt=/home/vault/certs//vault.crt \
--from-file=vault.ca=/home/vault/certs/vault.ca
The command oc get secret | grep vault :
NAME TYPE DATA AGE
vault-server-tls Opaque 3 4h15m
Edit my vault-config with the oc edit cm vault-config command:
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
extraconfig-from-values.hcl: |-
disable_mlock = true
ui = true
listener "tcp" {
tls_cert_file = "/vault/certs/vault.crt"
tls_key_file = "/vault/certs/vault.key"
tls_client_ca_file = "/vault/certs/vault.ca"
address = "[::]:8200"
cluster_address = "[::]:8201"
}
storage "file" {
path = "/vault/data"
}
kind: ConfigMap
metadata:
creationTimestamp: "2021-03-15T13:47:24Z"
name: vault-config
namespace: vault-project
resourceVersion: "396958"
selfLink: /api/v1/namespaces/vault-project/configmaps/vault-config
uid: 844603a1-b529-4e33-9d58-20525ea7bff
Edit the VolumeMounst, volumes and ADDR parts my statefulset :
volumeMounts:
- mountPath: /home/vault
name: home
- mountPath: /vault/certs
name: certs
volumes:
- configMap:
defaultMode: 420
name: vault-config
name: config
- emptyDir: {}
name: home
- name: certs
secret:
defaultMode: 420
secretName: vault-server-tls
name: VAULT_ADDR
value: https://127.0.0.1:8200
I delete my pods in order to take into account all my changes
oc delete pods vault-project-0
And...
tim#localhost config]$ oc get pods
NAME READY STATUS RESTARTS AGE
vault-project-0 0/1 Running 0 48m
vault-project-agent-injector-8568dbf75d-4gjnw 1/1 Running 0 6h9m
vault-project-0 is on 0/1 but running. If I describe the pods :
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 1s (x6 over 26s) kubelet Readiness probe failed: Error checking seal status: Get "https://127.0.0.1:8200/v1/sys/seal-status": http: server gave HTTP response to HTTPS client
If think that I've missed something but I don't know what...
Someone to tell me how to enable https for the vault UI with openshift ?

Can't build vue3+vite sample app in production mode on Windows

I cannot build a newly created vue3+vite app on Windows in production mode, while it works ok in development mode. Below are steps I executed to get an error :
npx create-vite-app test_vue3
cd test_vue3
npm install
npm run build
And the error is :
2020-12-01T21:42:14.689Z vite:config env mode: production
2020-12-01T21:42:14.705Z vite:config env: {}
[vite] Build errored out.
{ Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
at error (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:5253:30)
at Module.error (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:9821:16)
at tryParse (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:9702:23)
at Module.setSource (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:10128:19)
at ModuleLoader.addModuleSource (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:18289:20)
code: 'PARSE_ERROR',
parserError:
{ SyntaxError: Unexpected token (1:0)
at Object.pp$4.raise (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:15543:13)
at Object.pp.unexpected (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:13235:8)
at Object.pp$3.parseExprAtom (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14942:10)
at Object.pp$3.parseExprSubscripts (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14745:19)
at Object.pp$3.parseMaybeUnary (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14722:17)
at Object.parseMaybeUnary (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:19145:29)
at Object.pp$3.parseExprOps (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14657:19)
at Object.pp$3.parseMaybeConditional (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14640:19)
at Object.pp$3.parseMaybeAssign (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14608:19)
at Object.pp$3.parseExpression (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14574:19) pos: 0, loc: Position { line: 1, column: 0 }, raisedAt: 1 },
id: 'D:\\Proj_VUE\\test_vue3\\index.html',
pos: 0,
loc:
{ file: 'D:\\Proj_VUE\\test_vue3\\index.html',
line: 1,
column: 0 },
frame: '1: <!DOCTYPE html>\n ^\n2: <html lang="en">\n3: <head>',
watchFiles: [ 'D:\\Proj_VUE\\test_vue3\\index.html' ] }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test_vue3#0.0.0 build: `vite build --debug`
npm ERR! Exit status 1
Is there a way to workaround it somehow ? (I tried it on linux, and it works flawlessly)

Rails 6 Application deployment fails using Elastic Beanstalk - 502 errors

Trying to deploy my rails application to elastic beanstalk but I'm getting 502 errors. I'm running React on Rails and I've tried to follow this -> Rails application deployed on Elastic Beanstalk with Puma fails - 502 errors on every request but no luck. Any ideas?
Here are the logs
/var/logs/nginx/error.log
2020/01/09 04:11:45 [warn] 3083#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2020/01/09 04:20:04 [crit] 3087#0: *108 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.44.209, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "staging5.q39956drtr.ap-southeast-1.elasticbeanstalk.com"
2020/01/09 04:25:23 [crit] 3087#0: *185 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.44.209, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "staging5.q39956drtr.ap-southeast-1.elasticbeanstalk.com"
2020/01/09 04:25:24 [crit] 3087#0: *185 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.44.209, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "staging5.q39956drtr.ap-southeast-1.elasticbeanstalk.com", referrer: "http://staging5.q39956drtr.ap-southeast-1.elasticbeanstalk.com/"
Puma
healthd 2775 0.0 3.4 683640 34356 ? Ssl 04:11 0:04 puma 2.11.1 (tcp://127.0.0.1:22221) [healthd]
root 7841 1.5 0.2 58788 2612 ? Ss 05:56 0:00 su -s /bin/bash -c bundle exec puma -C /opt/elasticbeanstalk/support/conf/pumaconf.rb webapp
webapp 7940 43.0 1.1 70180 11460 ? Rs 05:56 0:00 /opt/rubies/ruby-2.6.5/bin/ruby /opt/rubies/ruby-2.6.5/bin/bundle exec puma -C /opt/elasticbeanstalk/support/conf/pumaconf.rb
root 7957 0.0 0.2 110516 2136 pts/0 S+ 05:56 0:00 grep --color=auto puma
pumaconf.rb
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
port ENV.fetch("PORT") { 3000 }
#
environment ENV.fetch("RAILS_ENV") { "development" }
# pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
bind "unix:///var/run/puma/my_app.sock"
pidfile "/var/run/puma/my_app.sock"
plugin :tmp_restart

Running GitlabRunner locally with private regsitry on Mac OSX

I'm trying to run GitlabRunner locally but ..
This works ...
❯ docker pull registry.gitlab.com/{MY_PROJECT}
❯ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.gitlab.com/{MY_PRIVATE_IMAGE} latest XXXX 2 days ago 605MB
❯ gitlab-runner verify
WARNING: Running in user-mode.
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...
Verifying runner... is alive runner={XXXX}
❯ cat /.gitlab-runner/config.toml
concurrent = 1
check_interval = 0
[[runners]]
name = "macbook-{XXXX}"
url = "https://gitlab.com/"
token = "XXXXXXX"
executor = "docker"
[runners.docker]
tls_verify = false
image = "registry.gitlab.com/{MY_PRIVATE_IMAGE}:latest"
privileged = true
disable_cache = false
volumes = ["/cache"]
shm_size = 0
pull_policy = "if-not-present"
[runners.cache]
❯ cat ../../../.docker/config.json
{
"auths": {
"https://index.docker.io/v1/": {},
"https://registry.gitlab.com": {},
"registry.gitlab.com": {}
},
"credsStore": "osxkeychain"
}
In my project when I try to execute runner ..
❯ gitlab-runner exec docker lint
WARNING: You most probably have uncommitted changes.
WARNING: These changes will not be tested.
Running with gitlab-ci-multi-runner 9.4.0 (ef0b1a6)
on ()
Using Docker executor with image registry.gitlab.com/{MY_PRIVATE_IMAGE} ...
map[]
Using docker image sha256:XXXX for predefined container...
Pulling docker image registry.gitlab.com/{MY_PRIVATE_IMAGE} ...
ERROR: Preparation failed: Error response from daemon: Get https://registry.gitlab.com/v2/{MY_PRIVATE_IMAGE}/manifests/latest: denied: access forbidden
Will be retried in 3s ...
Using Docker executor with image registry.gitlab.com/{MY_PRIVATE_IMAGE} ...
map[]
Using docker image sha256:XXX for predefined container...
ERROR: Preparation failed: Error response from daemon: Get {MY_PRIVATE_IMAGE}/manifests/latest: denied: access forbidden
open your ~/.docker/config.json file and replace the credsStore entry with an empty string, docker login <your-registry> again and it should work out

Resources