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

add compose-postgres.yaml to allow persistent / scale ak #186

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

efiShtain
Copy link
Contributor

Start AK with scaled version using compose

docker compose up --scale server=3 # can be any number
  • This uses an nginx as a reverse proxy
  • It uses AK as temporal dev server
  • Uses postgres as a persistent db

- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
volumes:
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need persistency? I think we could skip the volume part

Copy link
Contributor

Choose a reason for hiding this comment

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

you must have persistency with multi instance, that's how state is shared

Copy link
Contributor Author

Choose a reason for hiding this comment

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

technically we share the same postgres, so you don't have to have persistency

but it is normally expected from postgres to be persistence
so I prefer to have it

environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
Copy link
Contributor

Choose a reason for hiding this comment

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

random port? or anything that will prevent with other dockers/ real PG running on the same machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is standard (at least as far as I saw) to expose the standard port
users can change it if they want

@itayd
Copy link
Contributor

itayd commented Apr 15, 2024

not sure what "It uses AK as temporal dev server" means?

timeout: 5s
retries: 5
nginx:
image: nginx:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think it might be worthwhile to pin to a specific version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since this is only development / local playground purposes, I don't really care about the version
we don't use any advanced logic here, just basic of the basic and nginx is super stable, so latest == less to maintain

but I'll change it to stable instead of latest to be on the safe side

@efiShtain
Copy link
Contributor Author

not sure what "It uses AK as temporal dev server" means?

I didn't want to have a custom docker image to run temporal, I also didn't find any public temporal docker image that runs temporal dev-server

since I wanted to reuse the temporal server between all AK instances, I start another ak just to use it's temporal dev-server, the nginx doesn't pass any requests to this ak, only other ak servers talk to this container's temporal instance (and they don't start their own instances)

@itayd
Copy link
Contributor

itayd commented Apr 16, 2024

not sure what "It uses AK as temporal dev server" means?

I didn't want to have a custom docker image to run temporal, I also didn't find any public temporal docker image that runs temporal dev-server

since I wanted to reuse the temporal server between all AK instances, I start another ak just to use it's temporal dev-server, the nginx doesn't pass any requests to this ak, only other ak servers talk to this container's temporal instance (and they don't start their own instances)

ah i see. interesting. you could just install temporal using curl and then run the start-dev though.
https://github.com/temporalio/cli?tab=readme-ov-file#curl

less... convoluted :p

@efiShtain
Copy link
Contributor Author

not sure what "It uses AK as temporal dev server" means?

I didn't want to have a custom docker image to run temporal, I also didn't find any public temporal docker image that runs temporal dev-server
since I wanted to reuse the temporal server between all AK instances, I start another ak just to use it's temporal dev-server, the nginx doesn't pass any requests to this ak, only other ak servers talk to this container's temporal instance (and they don't start their own instances)

ah i see. interesting. you could just install temporal using curl and then run the start-dev though. https://github.com/temporalio/cli?tab=readme-ov-file#curl

less... convoluted :p

you can do the same with postgres and use the other compose file running just ak

depends what we want to achieve
I'm ok with all options

@itayd
Copy link
Contributor

itayd commented Apr 17, 2024

oh - can you add redis to the party here?

Copy link
Contributor

@itayd itayd left a comment

Choose a reason for hiding this comment

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

now i see that all these files are at root :/ can we put it anywhere else? maybe scripts?

@efiShtain
Copy link
Contributor Author

@itayd
I've added redis

could you verify it works as expected on your end?

if so, please ack the pr

regarding location of docker-compose, as far as I saw, it is mostly on the main directory, especially in kind of monorepos, since it might involve multiple components

I don't see any value in moving it, I'll move it if you insist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants