creating my first image for rocket (serviio with java dependency) - coreos

I have CoreOS stable (1068.10.0) installed and I want to create a serviio streaming media server image for rocket.
this is my manifest file:
{
"acVersion": "1.0.0",
"acKind": "ImageManifest",
"name": "tux-in.com/serviio",
"app": {
"exec": [
"/opt/serviio/bin/serviio.sh"
],
"user":"serviio",
"group":"serviio"
},
"labels": [
{
"name": "version",
"value": "1.0.0"
},
{
"name": "arch",
"value": "amd64"
},
{
"name": "os",
"value": "linux"
}
],
"ports": [
{
"name": "serviio",
"protocol": "tcp",
"port": 8895
}
],
"mountPoints": [
{
"name": "serviio-config",
"path": "/config/serviio",
"kind": "host",
"readOnly": false
}
],
"environment": {
"JAVA_HOME": "/opt/jre1.8.0_102"
}
}
I couldn't find on google how to add java package depenency, so I just downloaded jre, opened it to /rootfs/opt and set a JAVA_HOME environment variable. is that the right way to go?
welp.. because I configured serviio to run on user and group called serviio, I created /etc/group with serviio:x:500:serviio and /etc/passwd with serviio:x:500:500:Serviio:/opt/serviio:/bin/bash. is this ok? should I added and configured users differently ?
then I crated a rocket image with actool build serviio serviio-1.0-linux-amd64.aci, signed it and ran it with rkt run serviio-1.0-linux-amd64.aci. then with rkt list i see that the container started and exited immediately.
UUID APP IMAGE NAME STATE CREATED STARTED NETWORKS
bea402d9 serviio tux-in.com/serviio:1.0.0 exited 11 minutes ago 11 minutes ago
rkt status bea402d9 returns:
state=exited
created=2016-09-03 12:38:03.792 +0000 UTC
started=2016-09-03 12:38:03.909 +0000 UTC
pid=15904
exited=true
app-serviio=203
no idea how to debug this issue further. how can I see the output of the sh command that was executed? any other error related information?
have I configured things properly? I'm pretty lost so any information regarding the issue would be greatly appreciated.
thanks!

Related

CoreOS linux ignition.json, download a remote directory, is it possible?

I am newbie to Flatcar Linux. I managed to install flatcar linux to disk successfully.Is it possible to download a remote directory using ignition.json ?
I have a very minimal ignition.json. Partial snippet is here
"storage": {
"files": [{
"filesystem": "root",
"path": "/etc/hostname",
"mode": 420,
"contents": { "source": "data:,core4" }
},
{
"filesystem": "root",
"path": "/opt/bin/mydata",
"user": {},
"contents": {
"source": "http://192.168.56.114/ks/mydata",
"verification": {}
},
But this creates a blank directory in /opt/bin named mydata.
Is it possible to Download a remote directory?
Regards,
J
No, the current version of Ignition configuration specification (v3.3.0) does not support that.
To check what is currently supported, you can look at the current specification at https://coreos.github.io/ignition/configuration-v3_3/.

VSCode using relative paths in build task on remote set up

I'm trying to add a build task to build the current file, just a simple "make path/to/file.o". I'm using vscode on windows 10 over a remote SSH connection to linux.
However, if I use ${relativeFileDirname} it converts the path separators to windows format. Eg...
${fileDirname}=/home/me/git/project/data/source
${relativeFileDirname}=data\source
I've read about explorer.copyRelativePathSeparator. Can that be applied to the build task in tasks.json? Or is there another way?
This is the build task...
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/make",
"args": [
"${relativeFileDirname}/${fileBasenameNoExtension}.o"
],
"options": {
"cwd": "/home/me/git/project"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/gcc",
"presentation": {
"clear": true
}
}
Thanks.
There is an extension for Visual Studio Code for this purpose that, after many failed attempts to use string substitution with bash built-ins and sed, was the only working solution for me:
"customOptions": "--workdir /home/user/${command:extension.commandvariable.file.relativeFileDirnamePosix}",

Usage of Command Override in Azure Container Instances within Azure Portal

I'm trying to deploy a Windows-based Container from a private repository within an Azure Container Instance using the Azure Portal and I'm not sure whether I use the "Command override" at the "Advanced" section properly (probably I do not). The thing is I've to pass an argument during runtime, which sets the value of a License Server, so that a specific application, which needs to establish a connection to the License Server, can start up.
In general, the run command for the container would look like:
docker run IMAGE:TAG -LicenseServer Port#Host
My entrypoint within the Dockerfile is a Powershell Script "Start.ps1", which requests the corresponding value of the mentioned License Server.
I've read the manual and therefore I've inserted following string to override and to pass the argument:
[ "cmd", "Start.ps1", "-LicenseServer", "<Port>#<Hostname>"]
After deploying the ACI, the Container gets the state "running" for a few seconds, after that, it's terminated again. According to logs, it didn't work anyway.
So I wonder, what would be the proper way to deploy the container to get it running?
Thank you a lot in advance!
In addition to my question, to get more context:
ACI was created within Azure Portal:
I've used following settings see JSON view:
{
"properties": {
"sku": "Standard",
"provisioningState": "Succeeded",
"containers": [
{
"name": "<name>",
"properties": {
"image": "<image name>",
"command": [
"powershell",
"Start.ps1",
"-LicenseServer",
"<port>#<host>"
],
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"environmentVariables": [],
"instanceView": {
"restartCount": 1,
"currentState": {
"state": "Terminated",
"finishTime": "2021-04-28T06:06:22.2263538Z",
"detailStatus": "Container stopped per client request"
},
"previousState": {
"state": "Waiting",
"detailStatus": "CrashLoopBackOff: Back-off restarting failed"
}
},
"resources": {
"requests": {
"memoryInGB": 8,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"imageRegistryCredentials": [
{
"server": "<login server>",
"username": "<user>"
}
],
"restartPolicy": "OnFailure",
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"type": "Public",
"dnsNameLabel": "mycontainerdns",
"fqdn": "mycontainerdns.westeurope.azurecontainer.io"
},
"osType": "Windows",
"instanceView": {
"events": [],
"state": "Stopped"
}
},
"id": "/subscriptions/<subscription id>",
"name": "<aci name>",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "westeurope",
"tags": {}
}
Actually, the cmd just tell you when you need to connect to the windows container instance, you need to use the command:
az container exec -g resource_group_name -n container_group_name --container-name container_name --exec-command "cmd"
But when you want to overwrite the CMD command, you need to pass the arguments like this:
["powershell", "Start.ps1", "-LicenseServer", "<Port>#<Hostname>"]
It means you need to execute the Powershell script in the cmd terminal.
I finally found the solution. The command string, provided within "Command override" was wrong.
I've tried several versions, but it now worked with following:
[ "powershell", "C:/Windows/Scripts/Start.ps1", "-LicenseServer", "<port>#<host>" ]
Now I get logs and the running state of the container within the ACI deployment.
Before, I've tried as suggested in the first answer: (among others)
["powershell", "Start.ps1", "-LicenseServer", "<Port>#<Hostname>"]
But that seems not to work within ACI, as "Start.ps1" script couldn't be found ALTHOUGH I've set the working directory within the Dockerfile and of course it works within my Rancher deployment (by just providing "-LicenseServer PortatHost").
So, as conclusion you've to provide the full path to your file when it serves as Entrypoint within the Container.
Thank you a lot anyway for your help!

Debugging multiple Node js Function apps in VS Code

I am currently developing a couple of node js function apps in the same project that I would like to be able to debug together. After some effort I was able to run them without a debugger with compounds. And it kinda works since all functions are running although im only able to see output from one at a time.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Func1",
"type": "node",
"request": "launch",
"port": 9000,
"preLaunchTask": "npm: start - func1"
},
{
"name": "Func2",
"type": "node",
"request": "launch",
"port": 9001,
"preLaunchTask": "npm: start - func2"
}
],
"compounds": [
{
"name": "Compound",
"configurations": [
"Func1",
"Func2"
]
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"path": "func1/",
"problemMatcher": [],
"label": "npm: start - func1",
"detail": "func start"
},
{
"type": "npm",
"script": "start",
"path": "func2/",
"problemMatcher": [],
"label": "npm: start - func2",
"detail": "func start"
}
]
}
I have also tried different configurations in tasks.json and launch.json using func start with moderate success and I have been able to attach a single function app to debugger while starting the rest.
"type": "func",
"label": "func: start - func1"
"command": "host start",
"problemMatcher": "$func-node-watch",
"isBackground": true,
"dependsOn": "npm: install - func1",
"options": {
"cwd": "${workspaceFolder}/func1"
}
But when I attempt to add a second one with another label it is only able to recognize one of them and the launch of the other app receives error "Could not find the task 'func: start - func2'".
My questions are if it is possible to have multiple Function App attached to debugger and in that case how? Would it also be possible to get the logs in the same output terminal or multiple terminals for each Function App. I know that both can be achived in Visual Studio with c# but is it possible in VS Code with Node.
I am currently developing a couple of node js function apps in the
same project
1, If your function app here refers to Trigger, then the default settings of VS Code should be able to be achieved (unprocessed functions will be in a waiting state, but every place marked with a breakpoint will be executed, but you cannot be in different at the same time Breakpoints).
2, If your function app here refers to a standalone app, then the key is the port. Below settings can change the default port of function app on local:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "python"
},
"Host": {
"LocalHttpPort": 5861,
"CORS": "*",
"CORSCredentials": false
}
}
After the above settings, you can start two VS Code programs Debug different function app at the same time without causing conflicts.

Typescript build task in VSCode on Windows 10 with Windows Subsystem for Linux

My VSCode settings (workspace settings in my case) are setup to use bash as the default terminal:
{
"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\bash.exe"
}
I need this to be able to debug my app.
My tasks.json looks like that:
{
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "./tsconfig.json",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
So when I try to build my project / run the build task (i.e. Ctrl + B), I get the following error:
> Executing task: tsc -p "c:\PATH_TO_MY_PROJECT\tsconfig.json" <
error TS5058: The specified path does not exist: 'c:\PATH_TO_MY_PROJECT\tsconfig.json'.
The terminal process terminated with exit code: 1
If I disable bash in my settings an use the default Windows terminal, the build works fine.
I remember it working few VSCode updates ago, but it stopped working in the latest VSCode versions. Not sure how that's related.
I tried to fix this for a while, but finally gave up on the built-in Typescript task and instead just used a custom task:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Typescript watch",
"type": "shell",
"command": "tsc --watch",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$tsc"
]
}
]
}

Resources