How Would I Retrieve All Git Commit SHA-1 Hashes Deployed to AppEngine Using the CLI? - google-app-engine

The "Versions" page in the AppEngine section of the GCP console here displays a table containing all of the git commit SHA-1 hashes that have been deployed for a given AppEngine Service.
How would I display this list using the gcloud CLI?

You are able to generate the table you're looking for using the app group within the gcloud CLI.
Here is an example table with some formatting and asc. sorting:
gcloud app versions list \
--format="table[box](last_deployed_time.datetime:label=DEPLOYED, version.id:label=GIT_COMMIT_HASH)" \
--service=$GAE_SERVICE_NAME \
--sort-by=DEPLOYED
#=>
┌───────────────────────────┬──────────────────────────────────────────┐
│ DEPLOYED │ GIT_COMMIT_HASH │
├───────────────────────────┼──────────────────────────────────────────┤
│ 1970-01-01 00:00:00-00:00 │ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │
│ . . . │ . . . │
│ . . . │ . . . │
│ . . . │ . . . │
│ 1970-01-01 00:00:01-00:00 │ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy │
└───────────────────────────┴──────────────────────────────────────────┘

Related

How to run init.sql using docker-compose.yml?

I'm creating a SQL server in docker container using docker-compose.yml, but i can't execute my init.sql when i run docker
Code from docker-compose.yml
version: "3.9"
services:
mssql-service:
image: mcr.microsoft.com/mssql/server:2019-latest # Or whatever version you want
container_name: mssql
restart: unless-stopped
ports:
- "1433:1433"
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=my_password
- MSSQL_PID=Developer
- MSSQL_AGENT_ENABLED=True
volumes:
- sqlvolume:/var/opt/mssql
- C:/Users/joel_/Documents/GitLab/Emaresa/apps/api/init.sql:/docker-entrypoint-initdb.d/init.sql
code from init.sql
USE master;
GO
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'my_database')
CREATE DATABASE my_database;
GO
my folder:
project/
│ .gitignore
│ alembic.ini
│ database.env
│ docker-command.bash
│ docker-compose.yml
│ init.sql
│ poetry.lock
│ pyproject.toml
hope someone help me with this because i didn't figure it out how to execute init.sql and create my_database

Importing Apache Commons dbcp2 in Apache Karaf [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
I have imported my Apache Camel blueprint xml bundle into Apache Karaf. When I try to start the bundle, it is complaining about dbcp2. I've tried to bundle it into my Apache Karaf but still no luck. The error I am getting:
Error executing command: Error executing command on bundles:
Error starting bundle 129: Unable to resolve xxx.yyy [129](R 129.0): missing
requirement [xxx.yyy [129](R 129.0)] osgi.wiring.package; (&
(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.9.0)(!(version>=3.0.0)))
[caused by: Unable to resolve org.apache.commons.commons-dbcp2 [119](R 119.0): missing
requirement [org.apache.commons.commons-dbcp2 [119](R 119.0)] osgi.wiring.package; (&
(osgi.wiring.package=javax.transaction)(version>=1.1.0))] Unresolved requirements:
[[xxx.yyy [129](R 129.0)] osgi.wiring.package; (&
(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.9.0)(!(version>=3.0.0)))]
I am not sure if the problem is the dbcp2 or the javax.transaction.
I've bundled both into my Apache Karaf therefore as shown here:
119 │ Installed │ 80 │ 2.9.0 │ Apache Commons DBCP
120 │ Resolved │ 80 │ 20220320.0.0 │ JSON in Java
129 │ Installed │ 80 │ 0.0.1.SNAPSHOT │ Route for xxxxx (my bundle)
131 │ Resolved │ 80 │ 0 │ wrap_mvn_javax.transaction_jta_1.1
My pom file in my bundle imports dbcp2 as shown here:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.9.0</version>
</dependency>
After trying out a bit of different bundles,
I've found out that bundle:install transaction fixed it.

Serving a Vite.js React project with a FastAPI backend via Docker

I have a project that uses a fastapi backend and a vite.js React front end. I currently have each dockerized as image.
Is there a way I can get fastapi to serve the vite projects static files so I don't have to have two images.
I have seen this https://fastapi.tiangolo.com/tutorial/static-files/ but not sure if that's what I need or would it be like
from fastapi.staticfiles import StaticFiles
load_dotenv() # take environment variables from .env.
app = FastAPI()
# serves static files from the /frontend/dist directory
app.mount("/frontend", StaticFiles(directory="frontend/dist"), name="frontend")
I have ran the above and got error RuntimeError: Directory 'frontend/dist' does not exist
I have my vite project in frontend I ran the vite build command which produced a dist folder with my static files inside. This is my current structure
.
├── README.md
├── backend
│ ├── Dockerfile
│ ├── Pipfile
│ ├── Pipfile.lock
│ └── main.py
└── frontend
├── Dockerfile
├── dist
│ ├── assets
│ │ ├── favicon.17e50649.svg
│ │ ├── index.1cd49a68.js
│ │ └── index.30ea237b.css
│ └── index.html
├── index.html
├── package-lock.json
├── package.json
├── postcss.config.js
├── src
│ ├── App.jsx
│ ├── favicon.svg
│ ├── index.css
│ ├── logo.svg
│ └── main.jsx
├── tailwind.config.js
└── vite.config.js
After MadsLindh suggested the change, I was able to start the fastapi server from within the backend directory but now I get
> uvicorn main:app --reload
INFO: Will watch for changes in these directories: ['/Users/paul/Desktop/deal_query_ui/backend']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [79530] using WatchFiles
INFO: Started server process [79532]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:63011 - "GET / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63012 - "GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63012 - "GET /apple-touch-icon.png HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63013 - "GET /favicon.ico HTTP/1.1" 404 Not Found
I even tried to go to http://127.0.0.1:8000/frontend/ but nothing I get the same {"detail":"Not Found"}
Docker
I went on to then create a Dockerfile within the root
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim
EXPOSE 80
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY ./backend/Pipfile ./backend/Pipfile.lock ./
RUN python -m pip install --upgrade pip
RUN pip install pipenv && pipenv install --dev --system --deploy
WORKDIR /app
COPY . /app
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "80"]
When running this locally I get the error
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 407, in main
run(
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 575, in run
server.run()
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/usr/local/lib/python3.8/site-packages/uvicorn/config.py", line 479, in load
self.loaded_app = import_from_string(self.app)
File "/usr/local/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/./backend/main.py", line 14, in <module>
app.mount("/frontend", StaticFiles(directory="../frontend/dist"), name="frontend")
File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
raise RuntimeError(f"Directory '{directory}' does not exist")
RuntimeError: Directory '../frontend/dist' does not exist
Which from my experience doesn't make sense to me as I could get the server up and running from within the BE directory.

Waiting for namespace handlers

I'm upgrading to Fuse 7.3 and getting new errors in any routes that use CXF.
Blueprint bundle ruleEngineService/5.0.2 is waiting for namespace
handlers [http://camel.apache.org/schema/blueprint]
My blueprint.xml contains the correct schema locations, according to all the documentation. eg. link
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
I haven't changed much since it was working in Fuse 7.0.0.
Features are installed:
cxf | 3.2.7.fuse-731004-redhat-00003 | x | Started | cxf-3.2.7.fuse-731004-redhat-00003 |
camel-cxf | 2.21.0.fuse-731003-redhat-00003 | x | Started | camel-2.21.0.fuse-731003-redhat-00003 |
The things that set this blueprint apart from ones that are resolving are:
<cxf:cxfEndpoint id="myEndpoint" ...>
and
<bean id="myRoute" class="com.application.CxfCamelRoute" />
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="serviceRoutes">
<routeBuilder ref="myRoute" />
</camelContext>
where CxfCamelRoute contains a reference to cxf://bean:myEndpoint?serviceClass="..."
Regarding blueprint features:
admin#root()> features:list | grep blueprint
kie-aries-blueprint | 7.11.0.Final | | Uninstalled | karaf-features-core-droolsjbpm-7.11.0.Final | KIE Aries Blueprint
camel-blueprint | 2.23.2.fuse-740006 | | Uninstalled | camel-2.23.2.fuse-740006 |
camel-blueprint | 2.21.0.fuse-731003-redhat-00003 | x | Started | camel-2.21.0.fuse-731003-redhat-00003 |
aries-blueprint-spring | 4.3.20.RELEASE_1 | | Uninstalled | spring-legacy-4.2.0.fuse-731003-redhat-00003 |
aries-blueprint | 4.2.0.fuse-731003-redhat-00003 | x | Started | standard-4.2.0.fuse-731003-redhat-00003 | Aries Blueprint
Could it be a conflict between aries-blueprint and camel-blueprint?
I am running out of ideas.
Ok, I seem to have solved it.
I added the repo for KIE (features:addurl mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features) before doing anything else. The order change fixed my issue. It seems as though KIE 7.11.0.Final adds the following repos:
mvn:org.apache.camel.karaf/apache-camel/RELEASE/xml/features
mvn:org.apache.cxf.karaf/apache-cxf/3.2.7.fuse-sb2-740011/xml/features
The namehandler issue was presumably from some conflict between the Fuse 7.3 libraries, and the latest camel/cxf RELEASE versions.
To me, this feels like a bug, to have KIE 7.11.0.Final use RELEASE features. It clearly has bad consequences. But I don't know another way to make feature:install kie accessible to my Karaf.
Never use RELEASE in maven coordinates. You can end up even with Camel 3, when expecting Camel 2. (Never use LATEST either).
If you use Fuse to install KIE features, you should not install mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features
First you have to install bridge features that provide feature dependencies for KIE from Fuse:
karaf#root()> feature:repo-add mvn:org.jboss.fuse.features/rhba-features/7.6.0.fuse-760014/xml/features
Adding feature url mvn:org.jboss.fuse.features/rhba-features/7.6.0.fuse-760014/xml/features
Then you have ton install Fuse variant of Kie features. Not this one, but this one
The description in kie-karaf-features-7.11.0.Final-features-fuse.xml is a bit older than current Fuse, because the feature artifactId has changed:
In order to install the below features into Fuse 7, target runtime needs to provide these features:
- drools7-dependencies
- jbpm7-dependencies
- optaplanner-dependencies
- kie7-remote-dependencies
- db-dependencies
- hibernate-dependencies
- hibernate-validator-dependencies
These features are contained in some repository not referenced explicitly with <repository> (loose coupling).
Fuse 7 specific repository is 'mvn:org.jboss.fuse.features/brms-features/VERSION/xml/features'
So here's the command:
karaf#root()> feature:repo-add mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features-fuse
Adding feature url mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features-fuse
karaf#root()> feature:list|grep kie
kie │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE API
kie-ci │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE CI
kie-spring │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE Spring
kie-aries-blueprint │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE Aries Blueprint
kie-camel │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │
kie-dmn │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │ Kie DMN
kie-server-client │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │ KIE Server Client
servlet-api-kie │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │
kie-pmml │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │
kie7-remote-dependencies │ 0.0.0 │ │ Uninstalled │ fuse-features-dependencies-droolsjbpm-7.6.0.fuse-760014 │

Routes not starting in Karaf 4.1.1 but runs in ServiceMix

I am using a simple camel-spring project which has a file route to copy from one location to another. But when i deploy the bundle and even the bundle is in Active State, not sure why the routes are not starting. Below are the dependent bundles i have started.
28 │ Active │ 80 │ 4.1.1 │ Apache Karaf :: OSGi Services :: Event
53 │ Active │ 80 │ 2.19.1 │ camel-commands-core
54 │ Active │ 50 │ 2.19.1 │ camel-core
55 │ Active │ 80 │ 2.19.1 │ camel-karaf-commands
59 │ Active │ 50 │ 2.19.1 │ camel-spring
68 │ Active │ 80 │ 1.0.0.SNAPSHOT │ A Camel Spring Route
But when i use the same Camel Spring Route bundle to install in Apache Service Mix , I see in the route-list that my routes are started and working fine. Do i need to have any other bundles to be start for my route bundle to work .
Please follow the link to take a look into the bundle.
Link to Download Bundle
Here is the Image of the simple project
Below the details from service mix which works.
karaf#root>list | grep Active
43 | Active | 50 | 2.16.5 | camel-core
47 | Active | 50 | 2.16.5 | camel-spring
49 | Active | 80 | 2.16.5 | camel-karaf-commands
224 | Active | 80 | 1.0.0.SNAPSHOT | A Camel Spring Route
Thanks in advance.
You need to install the camel-spring-dm feature in Karaf 4.1.1, eg feature:install camel-spring-dm. Also mind spring-dm is deprecated / dead so its not recommended to be used. Use OSGi Blueprint instead if you want to do XML routes in Karaf/ServiceMix with Camel.
In karaf 4.1.1 spring dm is not present by default. You need to first do
feature:repo-add spring-legacy 4.1.1

Resources