Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodeploy service for dev #749

Merged
merged 9 commits into from
Feb 4, 2019
Merged

Conversation

antho1404
Copy link
Member

With the new services deployed from tar and the new kind of system services that are just services #725 we need a way to easily work and deploy local services locally and for production a way to configure the endpoint of the services we will want for the release.

For that few things:

  • dev and prod Configurable variable in the config package with the URL of the services with the format ServiceURL
  • dev A server that contains all the services archives from the systemservices directory
  • dev A script dev-core that inject the services tar endpoint from the server created

This way we now have a way to configure the address of the services needed by the core during the compilation (and can be integrated in the CI) and a way in development to work with the local directory without any hack on the code base, just on the dev tools.

@antho1404 antho1404 requested review from krhubert, NicolasMahe and ilgooz and removed request for krhubert January 29, 2019 16:20
dev-core Show resolved Hide resolved
@NicolasMahe
Copy link
Member

NicolasMahe commented Feb 1, 2019

The function deleteServiceServer in dev-core script doesn't work if there is no service core-service-server.

I add some output to see what happen:

function deleteServiceServer {
  echo "1"
  rm -rf tmp-systemservices
  echo "2"
  serviceExists=$(docker service list | grep core-service-server)
  echo "3"
  if [[ "$serviceExists" != "" ]]; then
    echo "4"
    docker service rm $MESG_SERVICE_SERVER
    echo "5"
  fi
  echo "6"
}
➜  core git:(feature/autodeploy-service-for-dev) ✗ ./dev-core
1
2

and then the script stop with an error code (the terminal indicator is red).

dev-core Outdated Show resolved Hide resolved
dev-core Outdated Show resolved Hide resolved
NicolasMahe and others added 3 commits February 1, 2019 16:46
Co-Authored-By: antho1404 <anthony@mesg.com>
Co-Authored-By: antho1404 <anthony@mesg.com>
Co-Authored-By: antho1404 <anthony@mesg.com>
NicolasMahe
NicolasMahe previously approved these changes Feb 1, 2019
@antho1404
Copy link
Member Author

Can you please review @krhubert @ilgooz

// )
var ()

func (c *Config) initServices() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of initServices?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called from the config, it's to have all the logic about the services in the same folder instead of having to initialize it on the config.go but declare it here

Copy link
Contributor

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting PR. This approach wouldn't be my first choice. Instead we could find out and deploy local services from systemservices folder by their path, programmatically, in the config pkg depending on the env (dev or prod).

Because creating a tar for all services will produce an overhead under active development. If we do this with Go, we were just going to pass an io.Reader produced by the archiver func which means archiving process was going to be made on the fly while sending the context to Docker daemon. But with this approach we're waiting the archiving to be finished and then sending it to Docker.

I understand the idea behind of this new script. We didn't want to add env(dev/prod) related deployment rules to Core for simplicity. But to me it's not a problem, infact maybe better because it's easier to code in Go and bash commands doesn't work in every OS without having additional tools. So no need to heavily depend on that. And we lose more on IO time this way with pre archiving services also, we cannot do parallel deployments...

@NicolasMahe NicolasMahe merged commit cf19a76 into dev Feb 4, 2019
@NicolasMahe NicolasMahe deleted the feature/autodeploy-service-for-dev branch February 4, 2019 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants