vchunikhin commented on code in PR #22096: URL: https://github.com/apache/beam/pull/22096#discussion_r912810812
########## playground/sdks.yaml: ########## @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +sdks: Review Comment: Since examples will be moved to the cloud datastore from the storage, the information about default examples will store to this yaml file and it will be parsed during application startup to download that to pg_sdks kind ########## playground/backend/start_datastore_emulator.sh: ########## @@ -0,0 +1,42 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Launch db emulator +DATASTORE_FULL_ADDRESS="${DATASTORE_EMULATOR_HOST:-"127.0.0.1:8888"}" +DATASTORE_PORT="${DATASTORE_FULL_ADDRESS##*:}" +TEST_PROJECT_ID="test" + +waitport() { + while ! nc -z localhost "$1"; do + echo "waiting for datastore emulator to start..." + sleep 1 + done +} + +PID=$(lsof -t -i :"${DATASTORE_PORT}" -s tcp:LISTEN) + +if [ -z "$PID" ]; then + echo "Starting Datastore emulator" + nohup gcloud beta emulators datastore start \ + --host-port="${DATASTORE_FULL_ADDRESS}" \ + --project="${TEST_PROJECT_ID}" \ + --consistency=1 \ + --no-store-on-disk \ + >/tmp/mock-db-logs & + waitport "$DATASTORE_PORT" +else + echo "There is an instance of Datastore emulator already running" Review Comment: This shell script is needed in order to run the datastore emulator. There are two cases where it can be used: - deploying locally without docker compose, e.g via IDEA (in addition, a developer should set the DATASTORE_EMULATOR_HOST variable to connect to this emulator) - tests ########## playground/backend/stop_datastore_emulator.sh: ########## @@ -0,0 +1,25 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Kill db emulator +DATASTORE_FULL_ADDRESS="${DATASTORE_EMULATOR_HOST:-"127.0.0.1:8888"}" +DATASTORE_PORT="${DATASTORE_FULL_ADDRESS##*:}" + +PID=$(lsof -t -i :"${DATASTORE_PORT}" -s tcp:LISTEN) +if [ ! -z "$PID" ]; then + echo "Stopping Datastore emulator" + kill "$PID" Review Comment: This shell script is needed in order to stop the datastore emulator. There are two cases where it can be used: - deploying locally without docker compose - tests ########## playground/backend/containers/router/docker-compose.local.yml: ########## @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: "2" + +services: + datastore: + image: singularities/datastore-emulator + environment: + DATASTORE_PROJECT_ID: project-test + DATASTORE_LISTEN_ADDRESS: 0.0.0.0:8081 + ports: + - "8081:8081" + datastore-ui: + image: 346o/datastore-gui:latest Review Comment: Yes, it's a good point so i removed this image and left only the google sdk image and the router image ########## playground/backend/cmd/server/controller_test.go: ########## @@ -173,7 +174,7 @@ func TestPlaygroundController_RunCode(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - conn, err := grpc.DialContext(tt.args.ctx, "bufnet", grpc.WithContextDialer(bufDialer), grpc.WithInsecure()) + conn, err := grpc.DialContext(tt.args.ctx, "bufnet", grpc.WithContextDialer(bufDialer), grpc.WithTransportCredentials(insecure.NewCredentials())) Review Comment: It was deprecated when the go libs were updated so it was changed ########## playground/backend/containers/router/docker-compose.local.yml: ########## @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: "2" + +services: + datastore: + image: singularities/datastore-emulator Review Comment: @pabloem Hi, It's a good point, thank you. I updated, namely i used [google sdk image](https://hub.docker.com/r/google/cloud-sdk) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
