How to escape comma in ECS task definition command - amazon-ecs

I have docker image and command:
celery -A bits.payment_tracking.app:app worker -l debug -Q celery,reports --concurrency 3
It works perfectly in docker and docker-compose. But it doesn't work in AWS ECS task definition because ECS require to define it separated by comma like this:
celery,-A,bits.payment_tracking.app:app,worker,-l,debug,-Q,celery,reports,--concurrency,3
and this command will not work because -Q celery,reports ECS always split by comma.
I know many workarounds but I couldn't find answer to one question - how to escape comma separation in task definition command?
Thanks for your help.

In your task definition, select your latest revision and click "Create New Revision".
On the page "Create new revision of Task Definition", click your container name to open the container editor.
Under Environment > Command add your comma separated queue command, e.g.
php,artisan,queue:work,--tries=1,--queue=queue1,queue2,queue3
Click Update to save the container.
Scroll to the bottom of the Task Definition Editor and click "Configure via JSON" which will open a JSON editor.
Manually change the command parameter to meet requirements, e.g.
"command": [
"php",
"artisan",
"queue:work",
"--tries=1",
"--queue=queue1,queue2,queue3"
],
Save the JSON, then click Create to create the revision.

Related

Run Multiple VS code projects through batch file (in a single go)

I have so many projects I have to open during windows startup.
So I have created batch file to open them in vs code as following.
start cmd /C code C:\project1
start cmd /C code C:\Project2
start cmd /C code C:\ProjectN
I also need them to run. I have launch.json for each project. How do I execute them through batch file.
First, I suggest streamlining your batch file as follows:
for %%p in (C:\project1 C:\project2 C:\projectN) do code %%p
Each project will open in its own window, asynchronously - no need for start, and no need for cmd child processes (double-quote individual paths as needed).
Note: If you wanted to open all projects in a single window, using a single workspace, you could simply do:
code C:\project1 C:\project2 C:\projectN
As for your desire to launch the projects for debugging after opening, it seems that code, Visual Studio's CLI does not support this, at least as of v1.66.
This isn't too surprising, given that the focus of an editor/IDE is on editing code, not on running it.
As of v1.66, code -h reports the following options (as also documented in the link above):
C:\>code -h
Visual Studio Code 1.66.0
Usage: code [options][paths...]
To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')
Options
-d --diff <file> <file> Compare two files with each other.
-a --add <folder> Add folder(s) to the last active window.
-g --goto <file:line[:character]> Open a file at the path on the specified
line and character position.
-n --new-window Force to open a new window.
-r --reuse-window Force to open a file or folder in an
already opened window.
-w --wait Wait for the files to be closed before
returning.
--locale <locale> The locale to use (e.g. en-US or zh-TW).
--user-data-dir <dir> Specifies the directory that user data is
kept in. Can be used to open multiple
distinct instances of Code.
-h --help Print usage.
Extensions Management
--extensions-dir <dir> Set the root path for extensions.
--list-extensions List the installed extensions.
--show-versions Show versions of installed extensions,
when using --list-extensions.
--category <category> Filters installed extensions by provided
category, when using --list-extensions.
--install-extension <ext-id | path> Installs or updates an extension. The
argument is either an extension id or a
path to a VSIX. The identifier of an
extension is '${publisher}.${name}'. Use
'--force' argument to update to latest
version. To install a specific version
provide '#${version}'. For example:
'vscode.csharp#1.2.3'.
--pre-release Installs the pre-release version of the
extension, when using
--install-extension
--uninstall-extension <ext-id> Uninstalls an extension.
--enable-proposed-api <ext-id> Enables proposed API features for
extensions. Can receive one or more
extension IDs to enable individually.
Troubleshooting
-v --version Print version.
--verbose Print verbose output (implies --wait).
--log <level> Log level to use. Default is 'info'. Allowed
values are 'critical', 'error', 'warn',
'info', 'debug', 'trace', 'off'.
-s --status Print process usage and diagnostics
information.
--prof-startup Run CPU profiler during startup.
--disable-extensions Disable all installed extensions.
--disable-extension <ext-id> Disable an extension.
--sync <on | off> Turn sync on or off.
--inspect-extensions <port> Allow debugging and profiling of extensions.
Check the developer tools for the connection
URI.
--inspect-brk-extensions <port> Allow debugging and profiling of extensions
with the extension host being paused after
start. Check the developer tools for the
connection URI.
--disable-gpu Disable GPU hardware acceleration.
--max-memory <memory> Max memory size for a window (in Mbytes).
--telemetry Shows all telemetry events which VS code
collects.
Originally I wanted to run all the projects in one go. Figured that vs code provides such functionality through multi-root workspaces (You will be also able to check all git changes in one place using this multi-root workspace).
We can run all the projects in one go with the workspace definition below where configurations are nothing but individual launch.json file's name field which you need to launch in vs code which are inside sub folders/projects (if name are same in multiple launch.json then you need to specify folder along with name. More details in link below.)
And place this workspace at root of all child projects. Open this workspace and hit F5, it will run all the projects as well in single go (having said that you have individual launch.json files for each project which you have mentioned in below workspace).
"compounds": [{
"name": "Launch Server & Client",
"configurations": [
"Launch Server",
{
"folder": "Web Client",
"name": "Launch Client"
},
{
"folder": "Desktop Client",
"name": "Launch Client"
}
]
}]
Source: https://code.visualstudio.com/docs/editor/multi-root-workspaces

vscode devcontainer "postCreateCommand": "alias 'll=ls -alF'"

I am using a default MS configuration (in Visual Studio Code -> "Remote-Container: Add Development Container Configuration Files...") and added the following to the
.devcontainer/devcontainer.json
"postCreateCommand": "alias ll='ls -alF'"
Using the command manually in the vscode terminal after creation yields the desired ll.
How do I have to specify the "postCreateCommand"-entry to get the alias?
Correct me if I'm wrong. You want to have the ll alias available inside the container.
You can achieve this by adding this line to the Dockerfile:
RUN echo "alias ll='ls -alF'" >> /etc/bash.bashrc
If you want to leave the Dockerfile as is, you can also add it to the postCreateCommand like this:
"postCreateCommand": "echo alias ll=\\'ls -alF\\' >> /etc/bash.bashrc"
This will add the alias directly to the system-wide bashrc file. The alias will be available in all interactive shells started within the container:

How can I start GitKraken from the command line with a Git repository path on Windows?

I'd like to create a bunch of shortcuts to open Git repository
GitKraken starts like this:
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe"
I tried to just add the path like this, but nothing happened:
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe \"C:\<path to repo with spaces>\MyRepo1\""
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe \"C:\<path to repo with spaces>\MyRepo2\""
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe \"C:\<path to repo with spaces>\MyRepo3\""
There could be multiple problems:
GitKraken might not support a path as parameter. Didn't find any documentation when I googled for "gitkraken from command line with repository path as parameter"
Quotes within quotes might be wrong, but I think it's correct: Command line passing quotes within quotes
The command line syntax might be different, but as mentioned above, I didn't find any documentation. I tried "-p" because I saw something similar while googling but it didn't work either C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe -p \"C:\<path to repo with spaces>\MyRepo1\""
GitKraken uses the Squirrel.Windows project for installation and update management for it's Windows installs. So the update.exe that is running when you click on the shortcut labeled "GitKraken" is running the Squirrel.Windows process that checks for and downloads updates and then runs the newest version of GitKraken. Once that check is complete, it launches the GitKraken.exe and starts the program.
To solve your issue you will need to pass a CLI option through the Squirrel call into the the gitkraken.exe. You are correct that gitkraken.exe accepts the -p | --path option for the repo to open at launch (e.g. gitkraken.exe -p "\path\to\repo"). If you run it from the app folder directly, you can see the options available at gitkraken.exe --help. Luckily, there are a couple of as-yet undocumented options you can pass that do the pass-through for you (referenced here) so your custom shortcut could now be:
..\Update.exe --processStart "gitkraken.exe" --process-start-args="--path \"d:\path with spaces\to\repo\""
Re: persistence through GitKraken executable updates- OP has confirmed in comments after GitKraken updated to v4.2 that the shortcuts they set up continued to work!
This is what working for me in Ubuntu Desktop
Define it
gkk() { # gkk aka gitkraken
repo_d=$1
if [ -z $repo_d ]; then repo_d=`pwd`; fi
if [ ! -d $repo_d ]; then echo "Invalid :repo_d at $repo_d"; exit 1; fi
/usr/bin/gitkraken -p $repo_d &
}
Use it
cd /path/to/your/repo
gkk
Note, calling the command again on 2nd repo will NOT work!
The workaround I can think of is to close and reopen GitKraken app

Run a specific talend component using the shell executable

My question is similar to this: Execute only one talend component. Except instead of using the Talend Open Studio, I want to be able to run a specific component from the shell executable I get from building the job.
I have set up my job in a way that if a component is succeeded, the OnComponentOk trigger is used to run the next component. To run the job I run sudo bash NAME_OF_THE_JOB.sh. Is it possible to run only one component, perhaps by passing arguments to the bash shell file?
A Talend job is a single java program. Components are translated to java functions. There are no arguments that allow you to execute a single component.
What you could do is write your job in such a way to execute a component whose name is passed via a context variable but it's not pretty.
You can test the component name passed via a variable named componentName using Run If triggers:
tRunJob_1
/
if("tRunJob_1".equals(context.componentName)
/
/
Start ---if("tJava_2".equals(context.componentName))-- tJava_2
\
\
if("tRest_1".equals(context.componentName))
\
tRest_1
As you can see, this can get very cumbersome, and requires you to know the component's name in order to run it.
You can then launch your job by passing the component name as argument :
sudo bash NAME_OF_THE_JOB.sh --context_param componentName=tJava_2

How Can I Compile Postgresql (pl/pgsql) Functions from Sublime?

Is there a way to compile pl/psql functions from within Sublime Text 2?
Add New Build System file with this commands and save it.
{
"cmd": ["psql", "-d", "your-database name",
"-U", "postgres",
"-f", "$file"],
"word_wrap": "false"
}
I actually just released a plugin (called DB1) that allows you to do just that. You can dynamically connect to and execute queries and functions against a PostgreSQL or MySQL database (I'm in the process of adding more databases too). A cool part about it is it doesn't require you to install anything on your computer (other than Sublime Text).
All you have to do is install DB1 through Package Control, and then in a view you can run the command DB1: Connect to connect to your database. You can then execute sql in that view through one of the DB1: Execute commands.
You can also just open the PSQL function (if you have it saved in a file) and execute the whole file.
To see how it works you can check out the DB1 Website or the documentation. Let me know if you have any questions about it!
Yes you can. In order for this answer to work your network user must have access to the database. The way to do it is to create a new build system in Sublime for postgresql. You can do this by clicking Tools>Build System>New Build System.... Then replace the default build text with:
{
"path": "C:/Program Files (x86)/pgAdmin III/1.20/",
"cmd": ["psql.exe", "-f", "$file", "postgresql://db-staging-1:5432/mydbname"],
"selector": "source.postgresql",
"shell": true
}
Path: This should be the location of your psql.exe executable. Note if this path is in your environment variables path this line is unnecessary.
CMD: This is what will be run from the command line. I've included my connection information here as well. You'll need to replace it with the server path and port number for your database. Note, if you are having trouble with getting your build to run, the easiest way to debug what it's actually trying to run is to add echo on the front of this line:
"cmd": ["echo", "psql.exe", "-f", "$file", "postgresql://db-staging-1:5432/mydbname"],
Now the output of your build will be exactly what it's trying to run on the command line. If what it outputs here doesn't work on your command line then you need to change it to something that will.
Selector: This set the default build for postgresql files.
Shell: Treats the command as a shell script.
Now you can choose your build to be postgresql under Tools>Build System. After that a simple Ctrl+B will compile pl/pgsql functions to your database! Note that regular SQL can be run against your Postgresql database now as well.
If you regularly interact with more than one database at once, see this article as a good reference for setting up connections to multiple databases: How to make build system for PostgreSQL
Other Sublime text build options can be found here: http://sublimetext.info/docs/en/reference/build_systems.html