[Apiman-user] Creating resources using Docker image

Arun Gupta arun.gupta at gmail.com
Thu Jul 23 12:57:14 EDT 2015


Start/stop yes, but not if the container is removed.

And because the "cost" associated with restarting a container is low,
restarting is more common that start/stop.

Arun

On Thu, Jul 23, 2015 at 10:45 AM, Eric Wittmann
<eric.wittmann at redhat.com> wrote:
> Is that true?  The state of the container is lost each time you stop it?  I
> thought the EAP data directory was preserved across container start/stop, so
> that the state was preserved.  But I guess I'm wrong?
>
> If it's true that state is *not* preserved, then the script can just blindly
> run I guess.
>
> -Eric
>
> On 7/23/2015 12:26 PM, Arun Gupta wrote:
>>
>> That could work too! I was just trying to be comprehensive but YAGNI!
>>
>> Either way, as the state of the container is not preserved and a new
>> container is started every time, what is the likelihood that the
>> entity to be created will exist?
>>
>> Arun
>>
>> On Thu, Jul 23, 2015 at 9:59 AM, Eric Wittmann <eric.wittmann at redhat.com>
>> wrote:
>>>
>>> I'm not sure what you mean by this.  I'm only suggesting that the
>>> "bootstrap" script could first do a GET on *one* of the entities that the
>>> script is planning on creating.  If the entity already exists then the
>>> script can bail at that point.  I don't see how a loop is possible.  And
>>> I
>>> don't think you would need to check for *each* entity you plan on
>>> creating.
>>> Just use the first entity as a marker - if *that* one exists then assume
>>> the
>>> rest do as well.
>>>
>>> On 7/23/2015 11:15 AM, Arun Gupta wrote:
>>>>
>>>>
>>>> If the container is started a fresh then it would not have any
>>>> existing resources, isn't it?
>>>>
>>>> Otherwise the script will get into a nested loop to first check for
>>>> organization, then service, then version, etc.
>>>>
>>>> Arun
>>>>
>>>> On Thu, Jul 23, 2015 at 7:34 AM, Eric Wittmann
>>>> <eric.wittmann at redhat.com>
>>>> wrote:
>>>>>
>>>>>
>>>>> I think it would be possible to have a run-once shell script.  Either
>>>>> by
>>>>> writing/checking some sort of "already run" file.  Or else by querying
>>>>> apiman to see if a particular entity exists.  For example, query to see
>>>>> if
>>>>> "My-Custom-Organization" exists ... if it does then skip the script.
>>>>> If
>>>>> not, then run the multitude of curl commands to do what you want.
>>>>>
>>>>> -Eric
>>>>>
>>>>> On 7/23/2015 7:48 AM, Arun Gupta wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> I've been thinking something on those lines.
>>>>>>
>>>>>> - Invoke shell script from Dockerfile
>>>>>> - Start API Man
>>>>>> - Run shell scripts
>>>>>> - Shut it down
>>>>>> - Go back to Dockerfile which will then start it
>>>>>>
>>>>>> Will share something, stay tuned.
>>>>>>
>>>>>> Arun
>>>>>>
>>>>>> On Thu, Jul 23, 2015 at 5:45 AM, Eric Wittmann
>>>>>> <eric.wittmann at redhat.com>
>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> You are probably more deft with docker than I am, but perhaps a shell
>>>>>>> script
>>>>>>> could be used to send a bunch of curl commands?
>>>>>>>
>>>>>>> -Eric
>>>>>>>
>>>>>>> On 7/23/2015 7:35 AM, Arun Gupta wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks!
>>>>>>>>
>>>>>>>> What is the recommended design pattern to extend the Dockerfile in
>>>>>>>> the
>>>>>>>> meanwhile?
>>>>>>>>
>>>>>>>> Arun
>>>>>>>>
>>>>>>>> On Thu, Jul 23, 2015 at 5:32 AM, Eric Wittmann
>>>>>>>> <eric.wittmann at redhat.com>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> That is not currently a feature.  But I've now added a JIRA for it,
>>>>>>>>> since it seems like a nice idea (especially for extending the
>>>>>>>>> docker
>>>>>>>>> container).
>>>>>>>>>
>>>>>>>>> https://issues.jboss.org/browse/APIMAN-566
>>>>>>>>>
>>>>>>>>> -Eric
>>>>>>>>>
>>>>>>>>> On 7/23/2015 3:47 AM, Tim Dudgeon wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> This indeed would be very useful.
>>>>>>>>>> Tim
>>>>>>>>>>
>>>>>>>>>> On 23/07/2015 04:44, Arun Gupta wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I've created a Dockerfile [1] that will attempt to create
>>>>>>>>>>> different
>>>>>>>>>>> resources. Is there any standard format where I can drop
>>>>>>>>>>> <organization>.yml in a pre-defined directory and API Man will
>>>>>>>>>>> read
>>>>>>>>>>> the resources defined there and create them?
>>>>>>>>>>>
>>>>>>>>>>> This will simplify how the resources are created using Docker.
>>>>>>>>>>> The
>>>>>>>>>>> samples at [2] do not show that.
>>>>>>>>>>>
>>>>>>>>>>> [1]
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> https://github.com/arun-gupta/microservices/blob/master/microservice/docker/Dockerfile
>>>>>>>>>>> [2] https://registry.hub.docker.com/u/jboss/apiman-wildfly/
>>>>>>>>>>>
>>>>>>>>>>> Arun
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Apiman-user mailing list
>>>>>>>>>> Apiman-user at lists.jboss.org
>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/apiman-user
>>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Apiman-user mailing list
>>>>>>>>> Apiman-user at lists.jboss.org
>>>>>>>>> https://lists.jboss.org/mailman/listinfo/apiman-user
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>



-- 
http://blog.arungupta.me
http://twitter.com/arungupta


More information about the Apiman-user mailing list