Version error in AWS Elastic beanstalk for Multicontainer Docker Configuration - mysql

Trying to link mysql with phabricator in Elastic beanstalk with
help of dockerrun.aws.json file as shown below.
But it sows error as
[Instance: i-cdbaf100 Module: AWSEBAutoScalingGroup ConfigSet: null]
Command failed on instance.
Return code: 1
Output: Invalid Dockerrun.aws.json version, abort deployment.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh failed.
For more detail, check /var/log/eb-activity.log using console or EB CLI.
Can someone please help in resolving this?
Here is the Dockerfile.aws.json file:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "mysql-database",
"image": "mysql",
"essential": true,
"memory": 400
},
{
"name": "phabricator-only",
"image": "yesnault/docker-phabricator-alone",
"essential": true,
"memory": 400,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": [
"mysql-database"
]
}
]
}
Here is activity log file
[2015-05-09T08:12:17.546Z] INFO [24016] - [CMD-AppDeploy] : Starting activity...
[2015-05-09T08:12:17.820Z] INFO [24016] - [CMD-AppDeploy/AddonsBefore] : Starting activity...
[2015-05-09T08:12:17.820Z] INFO [24016] - [CMD-AppDeploy/AddonsBefore] : Completed activity.
[2015-05-09T08:12:18.086Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0] : Starting activity...
[2015-05-09T08:12:18.086Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteConfig] : Starting activity...
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteConfig] : Completed activity. Result:
Recreated directory /opt/elasticbeanstalk/deploy/configuration/.
Generate appsource url file at /opt/elasticbeanstalk/deploy/configuration/appsourceurl.
Generate container config file at /opt/elasticbeanstalk/deploy/configuration/containerconfiguration.
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp1] : Starting activity...
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp1] : Completed activity. Result:
Recreated directory /opt/elasticbeanstalk/deploy/appsource.
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2] : Starting activity...
[2015-05-09T08:12:18.332Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2] : Starting activity...
[2015-05-09T08:12:18.333Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2] : Starting activity...
[2015-05-09T08:12:18.333Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2/Command 01downloadVersion] : Starting activity...
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2/Command 01downloadVersion] : Completed activity.
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2] : Completed activity.
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2] : Completed activity.
[2015-05-09T08:12:18.407Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2] : Completed activity.
[2015-05-09T08:12:18.407Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Starting activity...
[2015-05-09T08:12:18.646Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Starting activity...
[2015-05-09T08:12:18.647Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Completed activity.
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Completed activity.
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Starting activity...
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/00clean_dir.sh] : Starting activity...
[2015-05-09T08:12:18.843Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/00clean_dir.sh] : Completed activity.
[2015-05-09T08:12:18.843Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/01unzip.sh] : Starting activity...
[2015-05-09T08:12:19.121Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/01unzip.sh] : Completed activity. Result:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "mysql-database",
"image": "mysql",
"essential": true,
"memory": 400
},
{
"name": "phabricator-only",
"image": "yesnault/docker-phabricator-alone",
"essential": true,
"memory": 400,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": [
"mysql-database"
]
}
]
}
[2015-05-09T08:12:19.121Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/02docker_db_check.sh] : Starting activity...
[2015-05-09T08:12:19.124Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/02docker_db_check.sh] : Completed activity. Result:
0||/
[2015-05-09T08:12:19.125Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Starting activity...
[2015-05-09T08:12:19.426Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Activity execution failed, because: Invalid Dockerrun.aws.json version, abort deployment (ElasticBeanstalk::ExternalInvocationError)
caused by: Invalid Dockerrun.aws.json version, abort deployment (Executor::NonZeroExitStatus)
[2015-05-09T08:12:19.426Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy] : Completed activity. Result:
Command CMD-AppDeploy failed.

If you get the error "Invalid Dockerrun.aws.json version, abort deployment. " it's also possible that you're not using the correct Solution Stack.
In my case I was using the Single Container Solution Stack and I should have been using the Multicontainer Solution Stack. Once I configured my environment to use the Multicontainer Solution Stack this error went away.
A list of Solution Stacks can be found here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html#concepts.platforms.docker

You have to select multi-container type when creating your environment. May require deleting and creating new environment as upgrading from single-container is not available right now.
Make sure it says "running Multi-container Docker" on Dashboard under Configuration.

The OP javvaji kiran adds in the comments:
The service was not available for the location which I selected.
But service are available in other locations
Original answer:
It depends on the error message you have, but note that all values of a Dockerrun.aws.json are normally in double quotes.
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "janedoe/image",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "1234"
}
],
....
Check if the error persists after adding double-quotes in your own Dockerrun.aws.json
That said, the exact error message is:
Activity execution failed, because: Invalid Dockerrun.aws.json version
See this source:
# Dockerrun.aws.json verson checking
# right now only one valid version "1"
if [ -f Dockerrun.aws.json ]; then
[ "`cat Dockerrun.aws.json | jq -r .AWSEBDockerrunVersion`" = "1" ] || error_exit "Invalid Dockerrun.aws.json version, abort deployment" 1
fi
So try with "AWSEBDockerrunVersion": "1",
Also, I don't see "links" in the Valid keys and values for the Dockerrun.aws.json file.

Related

Docker swarm stack mysql/mysql-cluster not resolving service names

I'm trying to setup a mysql-cluster on a docker swarm setup.
Given we have 3 nodes (1 manager, 2 workers) we are trying to install it on the manager node.
This is the my.cnf file (correctly read)
[mysqld]
ndbcluster
ndb-connectstring=management1
user=mysql
skip_name_resolve
[mysql_cluster]
ndb-connectstring=management1
This is the mysql-cluster.cnf file (correctly read)
[ndbd default]
NoOfReplicas=2
DataMemory=80M
[ndb_mgmd]
HostName=management1
DataDir=/var/lib/mysql-cluster
[ndbd]
HostName=ndb1
DataDir=/var/lib/mysql-cluster
[ndbd]
HostName=ndb2
DataDir=/var/lib/mysql-cluster
[mysqld]
HostName=mysql1
Docker compose file (deployed from git repository via portainer)
executes ex: docker stack deploy --compose-file docker-compose.yml vossibility
version: '3.3'
services:
management1:
image: mysql/mysql-cluster
command: ndb_mgmd
networks:
- "meroex-network"
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
ndb1:
image: mysql/mysql-cluster
command: ndbd
networks:
- "meroex-network"
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
ndb2:
image: mysql/mysql-cluster
command: ndbd
networks:
- "meroex-network"
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
mysql1:
image: mysql/mysql-cluster
ports:
- "3306:3306"
restart: always
command: mysqld
depends_on:
- "management1"
- "ndb1"
- "ndb2"
networks:
- "meroex-network"
deploy:
placement:
constraints:
- node.role == manager
networks:
meroex-network:
external: true
The network is an overlay network with subnet/24
[
{
"Name": "meroex-network",
"Id": "vs7lmefftygiqkzfxf9u4dqxi",
"Created": "2021-10-07T06:29:10.608882532+08:00",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.0.3.0/24",
"Gateway": "10.0.3.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
...
"lb-meroex-network": {
"Name": "meroex-network-endpoint",
"EndpointID": "a82dd38ffeb66e3a365140b51d8614fdf08ca0f0ffb01c8262a16bde49c891ad",
"MacAddress": "02:42:0a:00:03:34",
"IPv4Address": "10.0.3.52/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4099"
},
"Labels": {},
"Peers": [
...
]
}
]
When deploying the stack we receive the following error in de management1 service:
2021-10-07 00:03:34 [MgmtSrvr] ERROR -- at line 33: Could not resolve hostname [node 1]: management1
2021-10-07 00:03:34 [MgmtSrvr] ERROR -- Could not load configuration from '/etc/mysql-cluster.cnf'
I'm stuck on why the service names are not resolved in this case. I have numerous other spring boot apps that can share their service names to communicate.
It might be that the name lookup for some hostname appear before any address is assigned and published by the name server.
The management server will by default verify all hostnames appearing in the configuration, if some lookup fails the management server will fail to start.
Since MySQL Cluster 8.0.22 there is a configuration parameter to allow management server to start without successfully verified all hostnames, suitable for environment there hosts appear on demand with possibly new ip address each time.
Try add the following to your mysql-cluster.cnf
[tcp default]
AllowUnresolvedHostnames=1
See manual: https://dev.mysql.com/doc/refman/8.0/en/mysql-cluster-tcp-definition.html

Log4j2.json ERROR Loggers cannot be configured without a name: arg[2](null)?

This is my log4j2.json file placed inside the resources folder in spring. I dont understand how i can print in both the console and the file at the same time. The console Output is working, the file .html is created but not used
{
"configuration": {
"name": "Default",
"appenders": {
"Console": {
"name": "STDOUT",
"PatternLayout": {
"pattern": "%d [%t] %-5p %c - %m%n"
}
},
"RollingFile": {
"name": "File",
"fileName": "C:/Users/Tiziano/Desktop/LogFile/info-app.html",
"filePattern": "C:/myppInfo-%d{MM-dd-yy-HH-mm-ss}-%i.html.gz",
"HTMLLayout": {
"charset": "UTF-8",
"title": "Info Logs",
"locationInfo": "true"
},
"Policies": {
"SizeBasedTriggeringPolicy": {
"size": "10 MB"
}
},
"DefaultRolloverStrategy": {
"max": "10"
}
}
},
"loggers": {
"logger": {
"level": "info",
"appender-ref": {
"ref": "File"
}
},
"root": {
"level": "info",
"AppenderRef": {
"ref": "STDOUT"
}
}
}
}
}
The error i'm getting in the spring console:
2021-03-02 11:25:51,447 main ERROR Loggers cannot be configured without a name: arg[2](null)
2021-03-02 11:25:51,451 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.LoggerConfig for element logger: org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element logger are invalid org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element logger are invalid
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:280)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1002)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:942)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:934)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:552)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:241)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:288)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:618)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:691)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:708)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.commons.logging.LogAdapter$Log4jLog.<clinit>(LogAdapter.java:155)
at org.apache.commons.logging.LogAdapter$Log4jAdapter.createLog(LogAdapter.java:122)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:89)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:203)
at com.example.myapp.MyappApplication.main(MyappApplication.java:10)
2021-03-02 11:25:51,458 main ERROR Null object returned for logger in loggers.
2021-03-02 11:25:52,019 main ERROR Loggers cannot be configured without a name: arg[2](null)
2021-03-02 11:25:52,020 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.LoggerConfig for element logger: org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element logger are invalid org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element logger are invalid
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:280)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1002)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:942)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:934)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:552)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:241)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:288)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:618)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:691)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:708)
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.reinitialize(Log4J2LoggingSystem.java:207)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:73)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.initialize(Log4J2LoggingSystem.java:163)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:312)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:281)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:216)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at com.example.myapp.MyappApplication.main(MyappApplication.java:10)
2021-03-02 11:25:52,021 main ERROR Null object returned for logger in loggers.
The console Output is fine as you can see, what doesnt work is the output in an external file.
2021-03-02 11:25:52,197 [main] INFO com.example.myapp.MyappApplication - No active profile set, falling back to default profiles: default
2021-03-02 11:25:53,153 [main] INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-03-02 11:25:53,249 [main] INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 81 ms. Found 1 JPA repository interfaces.
2021-03-02 11:25:54,493 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
2021-03-02 11:25:54,507 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
It looks like you may have a typo - should be AppenderRef instead of appender-ref. See manual for examples - https://logging.apache.org/log4j/2.x/manual/configuration.html#Configuration_with_JSON.

Parsing JSON from Ansible

I'm looking on the web but I'm unable to find a solution, the scenario in quite complex.
I have one json array with values like these:
[
{
"IP1": "1.2.3.4"
"IP1_VLAN": "900 - CLOUD-DEV"
"IP1_Role": "Management"
"IP2": "4.5.6.7"
"IP2_VLAN": "901 - CLOUD-DEV"
"IP2_Role": "Production"
"IP2": "8.9.10.11"
"IP2_VLAN": "902 - CLOUD-DEV"
"IP2_Role": "Backup"
}
]
My goal is: "Select the IP with the role of Management and tell me the address", it should select IP*_Role == Management and tell me in this case 1.2.3.4
Do you have any idea how to deal with this?
Following my comment, my 2 cent answer: searching through your actual data structure is going to be hard and ugly. If you have the option to change it a bit, things can get much easier.
Here is an example using a list declared in yaml in the following demo playbook. Data is extracted using json_query with the relevent jmespath expression (i.e. the query variable in the debug task)
---
- hosts: localhost
gather_facts: False
vars:
my_ips:
- ip: "1.2.3.4"
vlan: "900 - CLOUD-DEV"
role: "Management"
- ip: "4.5.6.7"
vlan: "901 - CLOUD-DEV"
role: "Production"
- ip: "8.9.10.11"
vlan: "902 - CLOUD-DEV"
role: "Backup"
tasks:
- name: Get ips per role
vars:
query: >-
[?role=='{{ item }}']
debug:
msg: "List of ips for role {{ item }}: {{ my_ips | json_query(query) }}"
loop:
- Management
- Production
- Backup
Which gives
PLAY [localhost] ********************************************************************************************************************************************************************************************************************************************************
TASK [Get ips per role] *************************************************************************************************************************************************************************************************************************************************
Wednesday 23 October 2019 16:14:23 +0200 (0:00:00.043) 0:00:00.043 *****
ok: [localhost] => (item=Management) => {
"msg": "List of ips for role Management: [{'ip': '1.2.3.4', 'vlan': '900 - CLOUD-DEV', 'role': 'Management'}]"
}
ok: [localhost] => (item=Production) => {
"msg": "List of ips for role Production: [{'ip': '4.5.6.7', 'vlan': '901 - CLOUD-DEV', 'role': 'Production'}]"
}
ok: [localhost] => (item=Backup) => {
"msg": "List of ips for role Backup: [{'ip': '8.9.10.11', 'vlan': '902 - CLOUD-DEV', 'role': 'Backup'}]"
}
PLAY RECAP **************************************************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
The equivalent variable declaration in plain json would be:
[
{
"ip": "1.2.3.4",
"vlan": "900 - CLOUD-DEV",
"role": "Management"
},
{
"ip": "4.5.6.7",
"vlan": "901 - CLOUD-DEV",
"role": "Production"
},
{
"ip": "8.9.10.11",
"vlan": "902 - CLOUD-DEV",
"role": "Backup"
}
]
If you have to load this from an external string (e.g. loading a file...), you can use the from_json filter in your playbook

Fail to create ElasticBeanstalk custom platform with "Unmatched region"

I'm trying to create a custom platform for region ap-northeast-1 following aws documentation.
ebp create ends with failure, and ebp events shows an error indicating that the created AMI is in different region from the service region.
2018-04-28 00:49:18 INFO Initiated platform version creation for 'NodePlatform_Ubuntu/1.0.0'.
2018-04-28 00:49:22 INFO Creating Packer builder environment 'eb-custom-platform-builder-packer'.
2018-04-28 00:52:39 INFO Starting Packer building task.
2018-04-28 00:52:44 INFO Creating CloudWatch log group '/aws/elasticbeanstalk/platform/NodePlatform_Ubuntu'.
2018-04-28 01:03:48 INFO Successfully built AMI(s): 'ami-5f2f4527' for 'arn:aws:elasticbeanstalk:ap-northeast-1:392559473945:platform/NodePlatform_Ubuntu/1.0.0'
2018-04-28 01:04:03 ERROR Unmatched region for created AMI 'ami-5f2f4527': 'us-west-2' (service region: 'ap-northeast-1').
2018-04-28 01:04:03 INFO Failed to create platform version 'NodePlatform_Ubuntu/1.0.0'.
I used this sample custom platform provided in aws document and modified only custom_platform.json for builders.region and builders.source_ami to match with the region of my Custom Platform Builder.
.elasticbeanstalk/config.yml
global:
application_name: Custom Platform Builder
branch: null
default_ec2_keyname: null
default_platform: null
default_region: ap-northeast-1
instance_profile: null
platform_name: NodePlatform_Ubuntu
platform_version: null
profile: eb-cli
repository: null
sc: git
workspace_type: Platform
custom_platform.json
{
"variables": {
"platform_name": "{{env `AWS_EB_PLATFORM_NAME`}}",
"platform_version": "{{env `AWS_EB_PLATFORM_VERSION`}}",
"platform_arn": "{{env `AWS_EB_PLATFORM_ARN`}}"
},
"builders": [
{
"type": "amazon-ebs",
"name": "HVM AMI builder",
"region": "ap-northeast-1",
"source_ami": "ami-60a4b21c",
"instance_type": "m3.medium",
"ssh_username": "ubuntu",
"ssh_pty": "true",
"ami_name": "NodeJs running on Ubuntu Server 16.04 LTS (built on {{isotime \"20060102150405\"}})",
"tags": {
"eb_platform_name": "{{user `platform_name`}}",
"eb_platform_version": "{{user `platform_version`}}",
"eb_platform_arn": "{{user `platform_arn`}}"
}
}
],
"provisioners": [
{
"type": "file",
"source": "builder",
"destination": "/tmp/"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo {{ .Path }}",
"scripts": [
"builder/builder.sh"
]
}
]
}
It seems my modification to custom_platform.json does not take effect.
What I missed was committing the changes...
Though EB and Packer documentation do not refer to anything about vcs or git, it seems packer uses git to create an archive of the custom platform files and thus the changes I made was not included in it because I did not commit them.
I noticed that ebp create was giving me this warning...
mac.local:NodePlatform_Ubuntu% ebp create
WARNING: You have uncommitted changes.

Selenium 3.1.0 Standalone and chromedriver 2.27

I had Selenium and Chrome working perfectly, but since last week its not working any more. This is what I get:
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.1.0', revision: '86a5d70', time: '2017-02-16 07:57:44 -0800'
System info: host: 'Scs-MacBook-Pro.local', ip: 'fe80:0:0:0:8d7:2cd3:84d5:161%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.2', java.version: '1.8.0_51'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:622)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:178)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:146)
... 14 more
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:76)
at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:174)
at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:183)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:179)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:168)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
... 19 more
13:04:18.947 WARN - Exception: The process has not exited yet therefore no result is available ...
13:04:47.978 INFO - Executing: [new session: Capabilities [{acceptSslCerts=true, name=Incart Fi, browserName=chrome, javascriptEnabled=true, platform=ANY}]])
13:04:47.979 INFO - Creating a new session for Capabilities [{acceptSslCerts=true, name=Incart Fi, browserName=chrome, javascriptEnabled=true, platform=ANY}]
Starting ChromeDriver 2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9) on port 29092
Only local connections are allowed.
Now I am wondering why, since I did not change any settings. It starts the safari browser, but there the waitForElement from nightwatch does not work. So can somebody tell me by the error why I got this issue?
{
"_comment": "./selenium-server-standalone-3.0.1.jar",
"_comment2": "/Users/SCMacBook/node_modules/chromedriver/bin/chromedriver",
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "./selenium-server-standalone-3.1.0.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "/Users/SCMacBook/webdriver/chromedriver",
"webdriver.gecko.driver" : "/Users/SCMacBook/webdriver/geckodriver",
"webdriver.firefox.profile" : "nightwatch"
}
},
"test_settings" : {
"default" : {
"silent": true,
"screenshots" : {
"enabled" : true,
"path" : "./pics/"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true
}
},
"firefox" : {
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
},
"safari" : {
"desiredCapabilities": {
"browserName": "safari"
}
},
"edge" : {
"desiredCapabilities": {
"platform": "WIN10",
"browserName": "MicrosoftEdge"
}
},
"ie" : {
"desiredCapabilities": {
"platform": "WIN10",
"browserName": "internet explorer",
"acceptSslCerts" : false
}
}
}
}
My solution was pretty simple and I feel espacially dumb. Somehow my /etc/hosts file was changed (MAMP ? My fault ?) and the
127.0.0.1 localhost
part was missing. So the machine couldn't use the localhost as 127.0.0.1
Hope this helps a poor someone someday :/
I also got the same error when running a nightwatch.js test and my problem was also due to a wrong entry to the /etc/hosts file:
0.0.0.0 localhost
The error went away after the above entry was removed.