Changing content of application in warden container - docker

I've cf application which I pushed and working as expected,now I want to change some file content in RT to avoid re-push.the application in deployed to warden container so it "persist" (for this instance ) in the filesystem of the container,How can I access to this file (i've node application so I guess with the FS module) location. i.e. if I've paused app with the following structure
myApp
folder1
index.html
1.if I want to change index html content by override how should I do that?I know the path of myApp/folder1/index.html but how I know
where my app is located in the container file system?
2. There is a way when I push application to say where to put the application? I mean in the container filesystem in specific path
e.g. when you create application in windows you decide where to put it...
C:\\myApp\folder1\index.html
or
D:\\myApp\folder1\index.html
I know that maybe this is advanced question but your help is appreciated!
p.s. lets say that I've some proxy for the application in the app container which listen to the app port and this can do some changes on the files of the applications

Writing directly to the container file system is not the right approach, because Cloud Foundry containers are intended to be ephemeral and transient.
Let's say that I have one instance of an application running, in Container A, and I change the contents of folder1/index.html. If that instance fails, and is automatically restarted by Cloud Foundry, the new instance won't have the persisted changes. If I need to scale up to 3 instances of my application, then Containers B and C won't have the changed files.
Allowing Cloud Foundry to manage the container file system will assure that you have consistent, repeatable behavior in your application.
If you need to make file changes in your Cloud Foundry application instance, the two recommended approaches are:
Read and write your file from a file service that is managed by Cloud Foundry. This will ensure that all application instances are accessing the same file system, and that your changes will survive beyond the container lifecycle.
Make the changes in your application artifact, and re-push the application.

Related

Electron does not run on shared folder

C:\share is shared folder.
C:\share\electron-v13.0.1-win32-x64, \\192.168.1.10\share\electron-v13.0.1-win32-x64 and Z:\electron-v13.0.1-win32-x64 are same folder.
Electron app is launched correctly when I execute C:\share\electron-v13.0.1-win32-x64\electron.exe command.
However, electron app is not launched correctly when I execute Z:\electron-v13.0.1-win32-x64\electron.exe command.
According to the task manager, electron processes are running.
However, electron's window is not shown.
Can electron run correctly on shared folder?
Should be safer to use it locally (from the C:\share). The mapped drives behave very differently compared to local filesystem. And their implementations can differ in their settings as well:
https://wiki.samba.org/index.php/Time_Synchronisation
https://www.truenas.com/community/threads/issue-with-modified-timestamps-on-windows-file-copy.82649/
https://help.2brightsparks.com/support/solutions/articles/43000335953-the-last-modification-date-and-time-are-wrong
If I understand you are just mapping back your own shared folder, and overall the Windows server cofigurations felt to me more consistent, however the protocol changed over the time as well:
https://en.wikipedia.org/wiki/Server_Message_Block
I do not understand the network sharing protocols well to give you exact answer why you have the problem, but I know enough to tell you that the mounted shared folders are not like your own local filesystem. In many cases the differences do not matter and it gives great user expierence, but in some cases these minute differences break things in misterious ways, even if they are mapped/mounted almost like a regular/local drive. This is not exclusive problem to Electron.
And that is a problem with a lot of things through SMB (mainly binaries/tools), the shared folder might be running a different filesystem, different permission and privileges (or run a completely different structure of permissions underneath if it's a completely different filesystem). Remote folders might have issues with inotify getting events on file updates, might miss changed file (like touch on Linux is meant to update date on the file), so through shared folder the date updates might be delayed/rounded. I think at one point even Makefiles were misbehaving as it was depending on the access-date to work the way it would locally.
Other problem with tools is the sharability, can it handle run multiple instances from the same location? Is it saving something into a ./tmp or some other file which could conflict with other user running it at the same time?
Overall with shares I tend to use them for data (and few times had issues with them as well), but have shared remotely applications only if they are known to not cause troubles.

Google App Engine: Load another Docker Image for Scrapy + Splash

I'd like to scrape a javascript website using Scrapy + Splash in Google App Engine. The Splash plugin is a Docker image. Is there any way to use this within Google App Engine? App Engine itself uses a Docker image, but I'm not sure how to load and access a secondary image (which is how Splash is used). Here are the Splash install instructions
You can use Custom Runtimes in the App Engine Flexible Environment.
Custom runtimes let you build apps that run in an environment
defined by a Dockerfile. By using a Dockerfile, you can use languages
and packages that are not part of the Google Cloud Platform and use
the same resources and tooling that are used in the App Engine
flexible environment.
Explore more About Custom Runtimes. Please note when you use a custom runtime, you have to write your application code to deal with some flexible environment life-cycle and health checking requests. Check how to build a custom runtime for more information.
Deploying the Splash service separately is the proper way to accomplish this.
I went ahead and tested a few different setups and the only approach that allowed me to have Splash on App Engine was to deploy it as a custom domain, setting the forwarded_ports to able to connect directly to one of the service’s instances through its IP address.
This is clearly not an adequate solution, as it comes with many limitations and, in the end, it becomes basically using Google Compute Engine without all the control it provides.
My suggestion is that you only deploy the Scrapy service of your application to App Engine, and leave the Splash service somewhere else, like in a GCE instance.
Once you have that, all you will need to do is set a static IP address for the instance and connect to it from your App Engine app through that.

Access system trust store from Docker container

in the past, i worked with c# and the .net framework 4.6. There I could directly access the trust stores of the windows system with commands like this:
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(...);
...
Now I want to use .net core and run the application in a docker container.
I can use exactly the same code shown above, but i would see only the certificates that are somehow located inside the container.
I can add cetifidates to the store and read them back but when the container stops running the information is gone.
--> I guess this is because the store is only in memory valid as long as the container runs...
How could I use a trust store from the host system or from another container that is only responsible for managing certs and keys?
Thanks for your answers in advance!

Change the Values of the app config file in a windows service through another program

I have a windows service which downloads some files from SFTP and uploads it to database and generates PDf's from that data. So now when i should give the executable files to my client i think he need to change the app config file like sftp details and the pdf paths. So i am just thinking about a program like a windows forms or a console which reads the input and save those in app config file. Is it possible like and by the way i have created a setup project for the windows service where he gets 2 files .msi file and setup file. Is it possible to achieve the above problem in this case ?
If I understand correctly, you're wanting some kind of UI application that allows the user to configure the operation of the Windows service. This is certainly possible as I've been doing it for several years now. However, you don't want to do this via the app.config file. The app.config file is read by the Windows service when it starts up, so any changes made to it would go unnoticed until the service restarts. A better course of action would be to communicate the changes to the service via the Windows Communication Foundation (or some other ICP mechanism, e.g., pipes, sockets, shared memory, etc.). I've managed to use this successfully, although to be honest, I'm using ordinary sockets now. In any case, the service would basically "listen" for incoming configuration messages, "read" those messages, and then "configure" itself accordingly, perhaps even saving the changes in its app.config file so the changes are preserved for when the service restarts later.
HTH

Creating service on windows xp

I'm creating services on Windows XP.
I have to use a utility that we are using . The utility is making registration in the registry.
My question is that when I'm creating the service a folder name Enum is not created, which I saw was created for all other services.
Is it important ? For what I need it ?
Thanks
You should use the service APIs (CreateService) to create your service instead of manipulating the registry manually (or via your utility).
The format of the services registry has changed over the years and if you don't use the defined APIs, you may risk malfunctions (you're also going to require a reboot after the registry changes are made because the service controller has now way of knowing about your new service).
A common windows service doesn't need anything such as "Enum" Directory. It must be something specific in your applications. So if the directory wasn't created automatically, you need to write an installer for your service which creates this directory automatically, or create it manually.
You can use the command "instsrv" if you want to register a new service running under Windows XP.
Cheers
Tomas

Resources