Skip to content

Commit ac9b1cd

Browse files
committed
rename -> upastebin
1 parent 05287aa commit ac9b1cd

14 files changed

+39
-39
lines changed

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ jobs:
6767
- name: Test run after install
6868
if: matrix.make == 'test-release'
6969
run: >-
70-
./local_installation/bin/pg_service_template
71-
--config=./local_installation/etc/pg_service_template/static_config.yaml
72-
--config_vars=./local_installation/etc/pg_service_template/config_vars.yaml
70+
./local_installation/bin/upastebin
71+
--config=./local_installation/etc/upastebin/static_config.yaml
72+
--config_vars=./local_installation/etc/upastebin/config_vars.yaml
7373
&
7474
7575
- name: Check work run service
7676
if: matrix.make == 'test-release'
7777
run: |
78-
ps aux | grep pg_service_template | grep config && curl http://localhost:8080/ping -v
78+
ps aux | grep upastebin | grep config && curl http://localhost:8080/ping -v
7979
8080
- name: Stop all
8181
if: matrix.make == 'test-release'
8282
run: |
83-
killall pg_service_template
83+
killall upastebin

.github/workflows/docker.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
ccache-
2929
3030
- name: Setup ccache
31-
run: docker-compose run --rm pg_service_template-container bash -c 'ccache -M 2.0GB && ccache -s'
31+
run: docker-compose run --rm upastebin-container bash -c 'ccache -M 2.0GB && ccache -s'
3232

3333
- name: Cmake
3434
run: make docker-cmake-release

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.12)
2-
project(pg_service_template CXX)
2+
project(upastebin CXX)
33

44

55
# Adding userver dependency

Makefile

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ build_release/CMakeCache.txt: cmake-release
2929
# Build using cmake
3030
.PHONY: build-debug build-release
3131
build-debug build-release: build-%: build_%/CMakeCache.txt
32-
cmake --build build_$* -j $(NPROCS) --target pg_service_template
32+
cmake --build build_$* -j $(NPROCS) --target upastebin
3333

3434
# Test
3535
.PHONY: test-debug test-release
3636
test-debug test-release: test-%: build-%
37-
cmake --build build_$* -j $(NPROCS) --target pg_service_template_unittest
38-
cmake --build build_$* -j $(NPROCS) --target pg_service_template_benchmark
37+
cmake --build build_$* -j $(NPROCS) --target upastebin_unittest
38+
cmake --build build_$* -j $(NPROCS) --target upastebin_benchmark
3939
cd build_$* && ((test -t 1 && GTEST_COLOR=1 PYTEST_ADDOPTS="--color=yes" ctest -V) || ctest -V)
4040
pycodestyle tests
4141

4242
# Start the service (via testsuite service runner)
4343
.PHONY: service-start-debug service-start-release
4444
service-start-debug service-start-release: service-start-%: build-%
45-
cmake --build build_$* -v --target start-pg_service_template
45+
cmake --build build_$* -v --target start-upastebin
4646

4747
# Cleanup data
4848
.PHONY: clean-debug clean-release
@@ -58,7 +58,7 @@ dist-clean:
5858
# Install
5959
.PHONY: install-debug install-release
6060
install-debug install-release: install-%: build-%
61-
cmake --install build_$* -v --component pg_service_template
61+
cmake --install build_$* -v --component upastebin
6262

6363
.PHONY: install
6464
install: install-release
@@ -75,19 +75,19 @@ export DB_CONNECTION := postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@servi
7575
# Internal hidden targets that are used only in docker environment
7676
--in-docker-start-debug --in-docker-start-release: --in-docker-start-%: install-%
7777
psql ${DB_CONNECTION} -f ./postgresql/data/initial_data.sql
78-
/home/user/.local/bin/pg_service_template \
79-
--config /home/user/.local/etc/pg_service_template/static_config.yaml \
80-
--config_vars /home/user/.local/etc/pg_service_template/config_vars.docker.yaml
78+
/home/user/.local/bin/upastebin \
79+
--config /home/user/.local/etc/upastebin/static_config.yaml \
80+
--config_vars /home/user/.local/etc/upastebin/config_vars.docker.yaml
8181

8282
# Build and run service in docker environment
8383
.PHONY: docker-start-service-debug docker-start-service-release
8484
docker-start-service-debug docker-start-service-release: docker-start-service-%:
85-
$(DOCKER_COMPOSE) run -p 8080:8080 --rm pg_service_template-container make -- --in-docker-start-$*
85+
$(DOCKER_COMPOSE) run -p 8080:8080 --rm upastebin-container make -- --in-docker-start-$*
8686

8787
# Start targets makefile in docker environment
8888
.PHONY: docker-cmake-debug docker-build-debug docker-test-debug docker-clean-debug docker-install-debug docker-cmake-release docker-build-release docker-test-release docker-clean-release docker-install-release
8989
docker-cmake-debug docker-build-debug docker-test-debug docker-clean-debug docker-install-debug docker-cmake-release docker-build-release docker-test-release docker-clean-release docker-install-release: docker-%:
90-
$(DOCKER_COMPOSE) run --rm pg_service_template-container make $*
90+
$(DOCKER_COMPOSE) run --rm upastebin-container make $*
9191

9292
# Stop docker container and remove PG data
9393
.PHONY: docker-clean-data

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pg_service_template
1+
# upastebin
22

33
Template of a C++ service that uses [userver framework](https://github.com/userver-framework/userver) with PostgreSQL.
44

@@ -9,8 +9,8 @@ To create your own userver-based service follow the following steps:
99

1010
1. Press the green "Use this template button" at the top of this github page
1111
2. Clone the service `git clone your-service-repo && cd your-service-repo`
12-
3. Give a propper name to your service and replace all the occurences of "pg_service_template" string with that name
13-
(could be done via `find . -not -path "./third_party/*" -not -path ".git/*" -not -path './build_*' -type f | xargs sed -i 's/pg_service_template/YOUR_SERVICE_NAME/g'`).
12+
3. Give a propper name to your service and replace all the occurences of "upastebin" string with that name
13+
(could be done via `find . -not -path "./third_party/*" -not -path ".git/*" -not -path './build_*' -type f | xargs sed -i 's/upastebin/YOUR_SERVICE_NAME/g'`).
1414
4. Feel free to tweak, adjust or fully rewrite the source code of your service.
1515

1616

configs/config_vars.testing.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ is-testing: true
66

77
server-port: 8080
88

9-
# pg_service_template_db_1 is the service name + _ + filename of the db_1.sql
10-
dbconnection: 'postgresql://testsuite@localhost:15433/pg_service_template_db_1'
9+
# upastebin_db_1 is the service name + _ + filename of the db_1.sql
10+
dbconnection: 'postgresql://testsuite@localhost:15433/upastebin_db_1'

configs/config_vars.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ is-testing: false
66

77
server-port: 8080
88

9-
dbconnection: 'postgresql://pg_service_template_user:password@localhost:5432/pg_service_template_db_1'
9+
dbconnection: 'postgresql://upastebin_user:password@localhost:5432/upastebin_db_1'

docker-compose.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
container_name: service-postgres
66
image: postgres:12
77
environment: &db_env
8-
POSTGRES_DB: pg_service_template_db_1
8+
POSTGRES_DB: upastebin_db_1
99
POSTGRES_USER: user
1010
POSTGRES_PASSWORD: password
1111
ports:
@@ -16,20 +16,20 @@ services:
1616
networks:
1717
- postgres
1818

19-
pg_service_template-container:
19+
upastebin-container:
2020
image: ghcr.io/userver-framework/ubuntu-22.04-userver-pg:latest
2121
privileged: true
2222
environment:
2323
<<: *db_env
2424
PREFIX: ${PREFIX:-~/.local}
25-
CCACHE_DIR: /pg_service_template/.ccache
25+
CCACHE_DIR: /upastebin/.ccache
2626
CORES_DIR: /cores
2727
volumes:
28-
- .:/pg_service_template:rw
28+
- .:/upastebin:rw
2929
- ${TC_CORES_DIR:-./.cores}:/cores:rw
3030
ports:
3131
- 8080:8080
32-
working_dir: /pg_service_template
32+
working_dir: /upastebin
3333
entrypoint:
3434
- ./tests/run_as_user.sh
3535
depends_on:

src/hello.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <userver/storages/postgres/component.hpp>
1010
#include <userver/utils/assert.hpp>
1111

12-
namespace pg_service_template {
12+
namespace upastebin {
1313

1414
namespace {
1515

@@ -45,7 +45,7 @@ class Hello final : public userver::server::handlers::HttpHandlerBase {
4545
}
4646
}
4747

48-
return pg_service_template::SayHelloTo(name, user_type);
48+
return upastebin::SayHelloTo(name, user_type);
4949
}
5050

5151
userver::storages::postgres::ClusterPtr pg_cluster_;
@@ -74,4 +74,4 @@ void AppendHello(userver::components::ComponentList& component_list) {
7474
component_list.Append<userver::clients::dns::Component>();
7575
}
7676

77-
} // namespace pg_service_template
77+
} // namespace upastebin

src/hello.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
#include <userver/components/component_list.hpp>
77

8-
namespace pg_service_template {
8+
namespace upastebin {
99

1010
enum class UserType { kFirstTime, kKnown };
1111
std::string SayHelloTo(std::string_view name, UserType type);
1212

1313
void AppendHello(userver::components::ComponentList& component_list);
1414

15-
} // namespace pg_service_template
15+
} // namespace upastebin

src/hello_benchmark.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ void HelloBenchmark(benchmark::State& state) {
1414

1515
for (auto _ : state) {
1616
const auto name = kNames[i++ % std::size(kNames)];
17-
auto result = pg_service_template::SayHelloTo(
18-
name, pg_service_template::UserType::kFirstTime);
17+
auto result = upastebin::SayHelloTo(
18+
name, upastebin::UserType::kFirstTime);
1919
benchmark::DoNotOptimize(result);
2020
}
2121
});

src/hello_test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <userver/utest/utest.hpp>
44

55
UTEST(SayHelloTo, Basic) {
6-
using pg_service_template::SayHelloTo;
7-
using pg_service_template::UserType;
6+
using upastebin::SayHelloTo;
7+
using upastebin::UserType;
88

99
EXPECT_EQ(SayHelloTo("Developer", UserType::kFirstTime),
1010
"Hello, Developer!\n");

src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int main(int argc, char* argv[]) {
1414
.Append<userver::components::HttpClient>()
1515
.Append<userver::server::handlers::TestsControl>();
1616

17-
pg_service_template::AppendHello(component_list);
17+
upastebin::AppendHello(component_list);
1818

1919
return userver::utils::DaemonMain(argc, argv, component_list);
2020
}

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def initial_data_path(service_source_dir):
2626
def pgsql_local(service_source_dir, pgsql_local_create):
2727
"""Create schemas databases for tests"""
2828
databases = discover.find_schemas(
29-
'pg_service_template', # service name that goes to the DB connection
29+
'upastebin', # service name that goes to the DB connection
3030
[service_source_dir.joinpath('postgresql/schemas')],
3131
)
3232
return pgsql_local_create(list(databases.values()))

0 commit comments

Comments
 (0)