File tree Expand file tree Collapse file tree 4 files changed +91
-17
lines changed Expand file tree Collapse file tree 4 files changed +91
-17
lines changed Original file line number Diff line number Diff line change @@ -59,3 +59,9 @@ RUN wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/c
59
59
&& tar -xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \
60
60
&& cp ccache-${CCACHE_VERSION}-linux-x86_64/ccache /usr/local/bin/ \
61
61
&& rm -rf ccache-${CCACHE_VERSION}-linux-x86_64 ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz
62
+
63
+ # Install ydb cli 2.16.0
64
+ ENV YDB_VERSION=2.16.0
65
+ RUN wget https://storage.yandexcloud.net/yandexcloud-ydb/release/${YDB_VERSION}/linux/amd64/ydb && \
66
+ chmod u+x ydb && \
67
+ mv ydb /usr/local/bin/
Original file line number Diff line number Diff line change
1
+ volumes :
2
+ ydb-data :
3
+ # driver: local
4
+ # driver_opts:
5
+ # type: tmpfs
6
+ # device: tmpfs
7
+ # o: size=80g
8
+ ydb-certs :
9
+
10
+ services :
11
+ sdk :
12
+ platform : linux/amd64
13
+
14
+ build :
15
+ context : .
16
+ dockerfile : Dockerfile
17
+
18
+ volumes :
19
+ - ydb-certs:/ydb_certs
20
+ - ../:/workspaces/ydb-cpp-sdk:cached
21
+
22
+ environment :
23
+ - YDB_VERSION=24.3
24
+ - YDB_CONNECTION_STRING=grpc://ydb:2136/local
25
+ - YDB_CONNECTION_STRING_SECURE=grpcs://ydb:2135/local
26
+ - YDB_ANONYMOUS_CREDENTIALS=1
27
+ - YDB_SSL_ROOT_CERTIFICATES_FILE=/ydb_certs/ca.pem
28
+
29
+ # Overrides default command so things don't shut down after the process ends.
30
+ command : sleep infinity
31
+
32
+ # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
33
+ network_mode : service:ydb
34
+
35
+ # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
36
+ # (Adding the "ports" property to this file will not forward from a Codespace.)
37
+
38
+ ydb :
39
+ image : ghcr.io/ydb-platform/local-ydb:24.3
40
+ restart : unless-stopped
41
+ hostname : ydb
42
+ platform : linux/amd64
43
+
44
+ volumes :
45
+ - ydb-data:/ydb_data
46
+ - ydb-certs:/ydb_certs
47
+
48
+ environment :
49
+ - YDB_USE_IN_MEMORY_PDISKS=true
50
+ - GRPC_TLS_PORT=2135
51
+ - GRPC_PORT=2136
52
+ - MON_PORT=8765
53
+
54
+ # Add "forwardPorts": [2135, 8765] to **devcontainer.json** to forward YDB locally.
55
+ # (Adding the "ports" property to this file will not forward from a Codespace.)
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
- WORKSPACE_FOLDER=$1
3
2
4
- cd $1
5
3
mkdir -p build
6
4
git submodule update --init --recursive
7
5
ccache -o cache_dir=/root/.ccache
8
6
cmake --preset release-test-with-ccache-basedir -DCMAKE_EXPORT_COMPILE_COMMANDS=1
7
+
8
+ if which ydb > /dev/null 2>&1 ; then
9
+ ENDPOINT=$( echo ${YDB_CONNECTION_STRING_SECURE:- $YDB_CONNECTION_STRING } | awk -F/ ' {print $3}' )
10
+ DATABASE=$( echo ${YDB_CONNECTION_STRING_SECURE:- $YDB_CONNECTION_STRING } | awk -F/ ' {print "/" $4}' )
11
+ CA_FILE_OPTION=" "
12
+
13
+ if [ -n " $YDB_CONNECTION_STRING_SECURE " ]; then
14
+ CA_FILE_OPTION=" --ca-file ${YDB_SSL_ROOT_CERTIFICATES_FILE} "
15
+ fi
16
+
17
+ ydb config profile create local \
18
+ --endpoint " $ENDPOINT " \
19
+ --database " $DATABASE " \
20
+ $CA_FILE_OPTION
21
+
22
+ ydb config profile activate local
23
+ fi
Original file line number Diff line number Diff line change 1
1
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
2
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
3
3
{
4
- "name" : " C++" ,
5
- "build" : {
6
- "dockerfile" : " Dockerfile" ,
7
- "options" : [
8
- " --platform" ,
9
- " linux/amd64"
10
- ]
11
- },
4
+ "name" : " C++ & YDB" ,
5
+ "service" : " sdk" ,
6
+ "dockerComposeFile" : " compose.yml" ,
7
+ "workspaceFolder" : " /workspaces/ydb-cpp-sdk" ,
12
8
// Allows the container to use ptrace, which is useful for debugging.
13
9
"capAdd" : [
14
10
" SYS_PTRACE"
19
15
],
20
16
// Features to add to the dev container. More info: https://containers.dev/features.
21
17
"features" : {
22
- "ghcr.io/devcontainers/features/github-cli:1" : {
23
- "installDirectlyFromGitHubRelease" : true ,
24
- "version" : " latest"
25
- }
18
+ "ghcr.io/devcontainers/features/github-cli:1" : {}
26
19
},
27
20
// Use 'forwardPorts' to make a list of ports inside the container available locally.
28
- "forwardPorts" : [],
21
+ "forwardPorts" : [
22
+ 2135 ,
23
+ 2136 ,
24
+ 8765
25
+ ],
26
+ // Use 'initializeCommand' to run commands before the container is created.
29
27
"initializeCommand" : " mkdir -p ${localEnv:HOME}/.ccache && cd \" ${localWorkspaceFolder}\" && git config --local user.email \" $(git config user.email)\" && git config --local user.name \" $(git config user.name)\" " ,
30
- // Use 'postCreateCommand ' to run commands after the container is created .
31
- "postCreateCommand " : " .devcontainer/configure.sh ${containerWorkspaceFolder} " ,
28
+ // Use 'postStartCommand ' to run commands after the container is started .
29
+ "postStartCommand " : " .devcontainer/configure.sh" ,
32
30
// Configure tool-specific properties.
33
31
"customizations" : {
34
32
"vscode" : {
You can’t perform that action at this time.
0 commit comments