Bubblewrap CLI throws "ERROR spawn jarsigner ENOENT" - progressive-web-apps

I am trying to make an initial build of a PWA (Progressive Web App) that is vanilla JS/HTML/CSS using using TWA (Trusted Web Activity) and Bubblewrap, but get the message cli ERROR spawn jarsigner ENOENT
The $ bubblewrap init --manifest=https://my-pwa.com/manifest.json step was seemingly successful.
However, when I go to build the project I get the following:
$ bubblewrap build
,-----. ,--. ,--. ,--.
| |) /_,--.,--| |-.| |-.| |,---.,--. ,--,--.--.,--,--.,---.
| .-. | || | .-. | .-. | | .-. | |.'.| | .--' ,-. | .-. |
| '--' ' '' | `-' | `-' | \ --| .'. | | \ '-' | '-' '
`------' `----' `---' `---'`--'`----'--' '--`--' `--`--| |-'
`--'
Please, enter passwords for the keystore /home/my-user/AndroidStudioProjects/android.keystore and alias android.
? Password for the Key Store: ***************
? Password for the Key: ***************
Building the Android App...
- Generated Android APK at ./app-release-signed.apk
cli ERROR spawn jarsigner ENOENT
Further context:
$ bubblewrap doctor
doctor Your jdkpath and androidSdkPath are valid.
$ node -v
v19.3.0
$ printf "%s\n" $PATH
/home/my-user/.local/share/nvm/v19.3.0/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
/snap/bin
$cat ~/.bubblewrap/config.json
{"jdkPath":"/usr/lib/jvm/default-java/","androidSdkPath":"/home/my-user/Android/Sdk/"}
Answers or any clues on where to investigate next appreciated, thanks.

My issue was resolved by putting a copy of OpenJDK 11 within my home directory and updating the jdkPath in /home/my-user/.bubblewrap/config.json with its location: {"jdkPath":"/home/my-user/Android/jdk-11.0.17+8","androidSdkPath":"/home/my-user/Android/Sdk/"}

Related

Remote VS Code without scp

I have a question on installing vs-code server on a remote machine without scp. I have no root priveleges on the remote. Also scp is not available on remote machine. So connection freezes on message "Setting up SSH Host $hostname: Copying VS Code Server to host with scp".
I tried to transfer .vscode-server from another remote machine that connects without problems to target remote machine but in this case the message is
Acquiring lock on /home/username/.vscode-server/bin/5235c6bb189b60b01b1f4906"
May be the problem is in commitId 5235c6bb189b60b01b1f4906?
May be there is some solution to install the server on a remote machine in the reight way that do not leed to Acquiring lock problems?
Probably it's not specific to the commit, but rooted in the problem that VSCode still can't use SCP to create lock files (or any files for that matter).
So, fix that (probably takes an email to an admin. Disabling SCP and SFTP has zero security advantage, because an attacker can do the very same thing with raw remote shell – just normal users have a harder time, as you notice). Your VS Code depends on it.
Worst case, if necessary, you can copy over your own SSH server, and matching configuration that runs as your regular user, uses a non-privileged port (instead of 22) and has SCP enabled, start it manually via the regular SSH connection, and use your remote machine's "official" ssh server only as jumphost to get to your "private" SSH server.
In short, something like
/usr/sbin/sshd -h ~/some_key_you_generated -f /dev/null -e -D -p 9999
#^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
#\……………….……………/ | \………………………….……………………………/ | \…….………/ | | | \.…/
# | | | | | | | | |
#Need to run | You'll have to generate | Was too | | \ /
#openSSHd with | a valid SSH keypair. | lazy to | | \/
#full path,else | But it's the same | write a | | Use port 9999
#it refuses to | `ssh-keygen` invo- | config. | | (needs to be
#run | cation as for genera- | Use de- | | > 1024, for un-
# | ting user keys. | faults. | | privileged
# Specify your own | | | users)
# host key Specify your own | Don't fork
# config file | into back-
# | ground
# |
# Error messages go to
# standard output in-
# stead of system log
# (which we can't write,
# anyways)
might do

Initialise and pull terraform public modules using GitHub SSH private key

Context:
I have gitlab runners which are executing terraform init command which is pulling all necessary terraform modules. Recently, I started hitting github throttling issues (60 calls to github api per hour). So I am trying to reconfigure my pipeline so it uses Github user's private key.
Currently, I have the following in my pipeline but it still doesn't seem to work and private key isn't used to pull the terraform modules.
- GITHUB_SECRET=$(aws --region ${REGION} ssm get-parameters-by-path --path /github/umotifdev --with-decryption --query 'Parameters[*].{Name:Name,Value:Value}' --output json);
- PRIVATE_KEY=$(echo "${GITHUB_SECRET}" | jq -r '.[] | select(.Name == "/github/umotifdev/private_key").Value' | base64 -d);
- PUBLIC_KEY=$(echo "${GITHUB_SECRET}" | jq -r '.[] | select(.Name == "/github/umotifdev/public_key").Value' | base64 -d);
- mkdir -p ~/.ssh;
- echo "${PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa;
- chmod 700 ~/.ssh/id_rsa;
- eval $(ssh-agent -s);
- ssh-add ~/.ssh/id_rsa;
- ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts;
- ssh-keyscan github.com | sort -u - ~/.ssh/known_hosts -o ~/.ssh/known_host;
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config;
- echo ${PUBLIC_KEY} >> ~/.ssh/authorized_keys
The error I am seeing in my pipeline is something like (which is basically throttling from github):
Error: Failed to download module
Could not download module "vpc" (vpc.tf:17) source code from
"https://api.github.com/repos/terraform-aws-modules/terraform-aws-vpc/tarball/v2.21.0//*?archive=tar.gz":
bad response code: 403.
Anyone can advise how to resolve an issue where private key isn't used to pull terraform modules?

Fabric Mac: Not able to generate Fastlane

Recently I updated my Mac OS to High Sierra. After the OS update, the Fabric app is not working properly. Not able to generate the "Fastlane beta".
OS Details: Mac OS X: macOS High Sierra (10.13.2)
Fabric Details: App Version: 2.6.17 (1288) Fabric Version: 2.78.0
Environment:
<details><summary>✅ fastlane environment ✅</summary>
### Stack
| Key | Value |
| --------------------------- | ----------------------------------------------- |
| OS | 10.13.2 |
| Ruby | 2.2.4 |
| Bundler? | false |
| Git | git version 2.11.0 (Apple Git-81) |
| Installation Source | /usr/local/lib/fastlane_lib/bundle/bin/fastlane |
| Host | Mac OS X 10.13.2 (17C88) |
| Ruby Lib Dir | /usr/local/lib/fastlane_lib/bundle/lib |
| OpenSSL Version | OpenSSL 1.0.2g 1 Mar 2016 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | true |
| Xcode Path | /Applications/Xcode 8.3.app/Contents/Developer/ |
| Xcode Version | 8.3.3 |
### System Locale
| Variable | Value | |
| -------- | ----------- | - |
| LANG | en_US.UTF-8 | ✅ |
| LC_ALL | en_US.UTF-8 | ✅ |
| LANGUAGE | en_US.UTF-8 | ✅ |
### fastlane files:
**No Fastfile found**
**No Appfile found**
### fastlane gems
| Gem | Version | Update-Status |
| -------- | ------- | -------------- |
| fastlane | 2.78.0 | 💥 Check failed |
### Loaded fastlane plugins:
**No plugins Loaded**
<details><summary><b>Loaded gems</b></summary>
| Gem | Version |
| ------------------------- | ------------ |
| slack-notifier | 2.3.2 |
| CFPropertyList | 2.3.6 |
| claide | 1.0.2 |
| colored2 | 3.1.2 |
| nanaimo | 0.2.3 |
| xcodeproj | 1.5.4 |
| rouge | 2.0.7 |
| xcpretty | 0.2.8 |
| terminal-notifier | 1.8.0 |
| unicode-display_width | 1.3.0 |
| terminal-table | 1.8.0 |
| plist | 3.4.0 |
| public_suffix | 2.0.5 |
| addressable | 2.5.2 |
| multipart-post | 2.0.0 |
| word_wrap | 1.0.0 |
| tty-screen | 0.6.4 |
| tty-cursor | 0.5.0 |
| tty-spinner | 0.8.0 |
| babosa | 1.0.2 |
| colored | 1.2 |
| highline | 1.7.10 |
| commander-fastlane | 4.4.5 |
| excon | 0.60.0 |
| faraday | 0.14.0 |
| unf_ext | 0.0.7.4 |
| unf | 0.1.4 |
| domain_name | 0.5.20170404 |
| http-cookie | 1.0.3 |
| faraday-cookie_jar | 0.0.6 |
| fastimage | 2.1.1 |
| gh_inspector | 1.0.3 |
| json | 1.8.1 |
| mini_magick | 4.5.1 |
| multi_json | 1.13.1 |
| multi_xml | 0.6.0 |
| rubyzip | 1.2.1 |
| security | 0.1.3 |
| xcpretty-travis-formatter | 1.0.0 |
| dotenv | 2.2.1 |
| bundler | 1.16.1 |
| faraday_middleware | 0.12.2 |
| uber | 0.1.0 |
| declarative | 0.0.10 |
| declarative-option | 0.1.0 |
| representable | 3.0.4 |
| retriable | 3.1.1 |
| mime-types-data | 3.2016.0521 |
| mime-types | 3.1 |
| little-plugger | 1.1.4 |
| logging | 2.2.2 |
| jwt | 2.1.0 |
| memoist | 0.16.0 |
| os | 0.9.6 |
| signet | 0.8.1 |
| googleauth | 0.6.2 |
| httpclient | 2.8.3 |
| google-api-client | 0.13.6 |
| libxml-ruby | 3.0.0 |
</details>
*generated on:* **2018-02-01**
</details>
Can anyone please let me know what is the issue on this configuration? Thanks in advance.
EDIT:
I have tried the solution given by #Mike but, I couldn't resolve the issue. Please find the Terminal output,
Last login: Mon Feb 5 16:45:31 on qqvm915 Yuva-M:~ Yuva$ rm -rf
~/.fastlane/bin Yuva-M:~ Yuva$ rm -rf /usr/local/lib/fastlane_lib
Yuva-M:~ Yuva$ cd /Users/Yuva/Documents/iOS\
Applications/TestApp/TestApp\ App/TestApp\ App\ Dev Yuva-M:TestApp
Dev Yuva$ touch Gemfile Yuva-M:TestApp Dev Yuva$ bundle update
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not
fetch specs from https://rubygems.org/ Retrying fetcher due to error
(3/4): Bundler::HTTPError Could not fetch specs from
https://rubygems.org/ Retrying fetcher due to error (4/4):
Bundler::HTTPError Could not fetch specs from
https://rubygems.org/Resolving
dependencies............................ Using CFPropertyList 2.3.6
Using public_suffix 2.0.5 Using addressable 2.5.2 Fetching atomos
0.1.2
Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your
password and install the bundled gems to RubyGems using sudo.
Password:
Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your
password and install the bundled gems to RubyGems using sudo.
Password: Installing atomos 0.1.2 Using babosa 1.0.2 Using bundler
1.16.1 Using claide 1.0.2 Using colored 1.2 Using colored2 3.1.2 Using highline 1.7.10 Using commander-fastlane 4.4.5 Using declarative
0.0.10 Using declarative-option 0.1.0 Using unf_ext 0.0.7.4 Using unf 0.1.4 Using domain_name 0.5.20170404 Using dotenv 2.2.1 Using excon 0.60.0 Using multipart-post 2.0.0 Using faraday 0.14.0 Using http-cookie 1.0.3 Using faraday-cookie_jar 0.0.6 Using
faraday_middleware 0.12.2 Using fastimage 2.1.1 Fetching gh_inspector
1.1.1 Installing gh_inspector 1.1.1 Using jwt 2.1.0 Using little-plugger 1.1.4 Using multi_json 1.13.1 Using logging 2.2.2 Using
memoist 0.16.0 Using os 0.9.6 Using signet 0.8.1 Using googleauth
0.6.2 Using httpclient 2.8.3 Using mime-types-data 3.2016.0521 Using mime-types 3.1 Using uber 0.1.0 Using representable 3.0.4 Using
retriable 3.1.1 Using google-api-client 0.13.6 Fetching json 2.1.0
Installing json 2.1.0 with native extensions Using mini_magick 4.5.1
Using multi_xml 0.6.0 Using plist 3.4.0 Using rubyzip 1.2.1 Using
security 0.1.3 Using slack-notifier 2.3.2 Using terminal-notifier
1.8.0 Using unicode-display_width 1.3.0 Using terminal-table 1.8.0 Using tty-screen 0.6.4 Using tty-cursor 0.5.0 Using tty-spinner 0.8.0
Using word_wrap 1.0.0 Using nanaimo 0.2.3 Fetching xcodeproj 1.5.6
Installing xcodeproj 1.5.6 Using rouge 2.0.7 Using xcpretty 0.2.8
Using xcpretty-travis-formatter 1.0.0 Using fastlane 2.80.0 Bundle
updated! Yuva-M:TestApp Dev Yuva$ bundle exec fastlane beta [✔] 🚀
[17:10:27]: Could not find fastlane in current directory. Make sure to
have your fastlane configuration files inside a folder called
"fastlane". Would you like to set fastlane up? (y/n) y [✔] Looking for
iOS and Android projects in current directory... [17:10:34]: Created
new folder './fastlane'. [17:10:34]: Detected an iOS/macOS project in
the current directory: 'TestApp.xcworkspace' [17:10:34]:
----------------------------- [17:10:34]: --- Welcome to fastlane 🚀 --- [17:10:34]: ----------------------------- [17:10:34]: fastlane can help you with all kinds of automation for your mobile app [17:10:34]:
We recommend automating one task first, and then gradually automating
more over time [17:10:34]: What would you like to use fastlane for?
1. 📸 Automate screenshots
2. 👩‍✈️ Automate beta distribution to TestFlight
3. 🚀 Automate App Store distribution
4. 🛠 Manual setup - manually setup your project to automate your tasks ?
Fastlane folder generated into project directory but, no file were there. I just tried to generate a build from "Fabric" Mac App, still am getting the error (Find the screenshot.) Any guidance? Thanks.
Mike from Fabric. I'd recommend switching from fastlane in Fabric to using it independently. Here's how to do it, referenced from Felix Krause.
In terminal, run:
rm -rf ~/.fastlane/bin
-- This removes the current fastlane installation from your home directory.
rm -rf /usr/local/lib/fastlane_lib
-- This removes the current fastlane installation from your system.)
After, edit your ~/.bashrc or ~/.bash_profile and remove any reference to fastlane. We're clearing everything out so that you can set up a fresh install.
Now, navigate to your project directory and run touch Gemfile. Add the following content to that file:
source "https://rubygems.org"
gem "fastlane"
Save the file and run bundle update. Commit both the Gemfile and the Gemfile.lock to version control and from now on, every time you run fastlane, prefix your command using bundle exec:
bundle exec fastlane beta
Finally, restart the Fabric macOS app and you'll be all set.

Configure PM2 module with linked docker container

I have my app in a Docker container..
FROM keymetrics/pm2-docker-alpine:7
ENV environment development
# Add PM2 modules
RUN pm2 install pm2-mongodb
ADD . .
EXPOSE 3000
CMD ["pm2-docker", "ecosystem.config.js", "--env ${environment}"]
And I use PM2 with ecosystem.config.js
module.exports = {
apps: [
{
name: 'api',
script: 'api/index.js',
env: {
PORT: process.env.PORT || 3000,
API_MONGO_URL: process.env.MONGO_URL || 'mongodb://localhost/api',
},
env_production: {
MONGO_URL: `mongodb://${process.env.MONGODB_PORT_27017_TCP_ADDR}:${process.env.MONGODB_PORT_27017_TCP_PORT}/api`,
},
},
],
};
This app depends on MongoDB service... so I run this with linked container..
docker run -it --name api -e environment=production --link mongodb:mongodb api:latest sh
The problem is when I execute this command inside the container ...
/app # pm2-docker ecosystem.config.js --env $environment
[STREAMING] Now streaming realtime logs for [all] processes
0|pm2-mong | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|pm2-mong | Error: double colon in host identifier
0|pm2-mong | at module.exports (/root/.pm2/node_modules/mongodb/lib/url_parser.js:89:13)
0|pm2-mong | at connect (/root/.pm2/node_modules/mongodb/lib/mongo_client.js:480:16)
0|pm2-mong | at /root/.pm2/node_modules/mongodb/lib/mongo_client.js:234:7
0|pm2-mong | at Function.MongoClient.connect (/root/.pm2/node_modules/mongodb/lib/mongo_client.js:230:12)
0|pm2-mong | at Object.init (/root/.pm2/node_modules/pm2-mongodb/lib/stats/client.js:53:15)
0|pm2-mong | at Object.init (/root/.pm2/node_modules/pm2-mongodb/lib/stats/index.js:78:12)
0|pm2-mong | at /root/.pm2/node_modules/pm2-mongodb/app.js:33:9
0|pm2-mong | at Object.PMX.initModule (/root/.pm2/node_modules/pmx/lib/pmx.js:116:12)
0|pm2-mong | at Object.<anonymous> (/root/.pm2/node_modules/pm2-mongodb/app.js:4:5)
0|pm2-mong | at Module._compile (module.js:571:32)
PM2 | App [pm2-mongodb] with id [0] and pid [21], exited with code [0] via signal [SIGINT]
PM2 | Starting execution sequence in -fork mode- for app name:pm2-mongodb id:0
PM2 | App name:pm2-mongodb id:0 online
This error is caused because I use pm2-mongodb module, I need to configure the module as follow...
pm2 set pm2-mongodb:ip ${MONGODB_PORT_27017_TCP_ADDR}
pm2 set pm2-mongodb:port ${MONGODB_PORT_27017_TCP_PORT}
So the question is... when/where I can do that?
The MONGODB_PORT_27017_TCP_ADDR and MONGODB_PORT_27017_TCP_PORT will be available after I run the container only.

Collect all rpm dependencies to deploy a project

I need to deploy a software project (packaged as an rpm) from a developer machine into a server. I'm using Fedora 23, along with the dnf package manager. I have to collect all dependencies of my rpm before I deploy to the server. The server can't be connected to the internet due to internal regulation (But I can ssh onto it). Running repository mirrors, etc. is not an option. I'm afraid I just have to collect all dependencies on the developer machine, scp (or ansible) them to the server and install them on the server.
I hoped that --installroot option in dnf could be of much help, as I could retrieve all rpms that would get installed into what dnf thinks is an empty system. This however doesn't work.
mkdir foo && sudo dnf install --installroot=$PWD/foo golang
gives an error:
Failed to synchronize cache for repo 'fedora'
Why does this fail? What are my options?
I'd like to see an elegant and robust solution. I'd prefer not to install anything on the server (I'd be most happy to do a single scp followed by one or two commands over ssh). A combination of rpm + yum/dnf magic would be great, but other solutions, including apt + deb are also of interest. I'd prefer not to use docker, and I'm strongly against running any additional infrastructure (docker registry, rpm mirror, etc.)
Here is a (ad hoc, lightly tested) script (assuming you have an already installed rpm system) to generate the list of all the rpm package names needed to install a given package (the script assumes goal="bash", edit to taste).
Feed the output names to dnf/yum to install.
#!/bin/sh
goal=bash
deps=$(rpm -q --qf '[%{REQUIRENAME}\n]' $goal | egrep -v '^(rpmlib|rtld|config|/)')
goals=
while true; do
subs=$(rpm -q --qf '%{NAME}\n' --whatprovides $deps | sort -u | tr '\n' ' ')
if [ ."$subs" = ."$goals" ]; then
echo "--- packages needed"
echo "$goals" | tr ' ' '\n'
exit 0
fi
goals=$(echo $goals $subs | tr ' ' '\n' | sort -u | tr '\n' ' ')
for sub in $subs; do
subdeps=$(rpm -q --qf '[%{REQUIRENAME}\n]' $sub | egrep -v '^(rpmlib|rtld|config|/)')
deps=$(echo $deps $subdeps | sort -u)
done
done