-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from go-park-mail-ru/dev
Dev
- Loading branch information
Showing
81 changed files
with
9,596 additions
and
665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/go-park-mail-ru/2024_2_VKatuny/internal/configs" | ||
"github.com/go-park-mail-ru/2024_2_VKatuny/internal/logger" | ||
"github.com/go-park-mail-ru/2024_2_VKatuny/internal/utils" | ||
"github.com/go-park-mail-ru/2024_2_VKatuny/microservices/auth" | ||
grpc_auth "github.com/go-park-mail-ru/2024_2_VKatuny/microservices/auth/gen" | ||
"github.com/gomodule/redigo/redis" | ||
"google.golang.org/grpc" | ||
|
||
_ "github.com/jackc/pgx/v5/stdlib" | ||
) | ||
|
||
func main() { | ||
conf := configs.ReadConfig("./configs/conf.yml") | ||
logger := logger.NewLogrusLogger() | ||
|
||
pgSQLConn, err := utils.GetDBConnection(conf.DataBase.GetDSN()) | ||
if err != nil { | ||
logger.Fatal(err.Error()) | ||
} | ||
logger.Info("Successfully connected to postgres") | ||
defer pgSQLConn.Close() | ||
|
||
redisConn, err := redis.Dial("tcp", conf.AuthMicroservice.Database.GetDSN()) | ||
if err != nil { | ||
logger.Fatal(err.Error()) | ||
} | ||
defer redisConn.Close() | ||
|
||
if _, err := redisConn.Do("AUTH", conf.AuthMicroservice.Database.Password); err != nil { | ||
logger.Fatal(err.Error()) | ||
} | ||
logger.Info("Successfully connected to redis") | ||
|
||
lister, err := net.Listen("tcp", conf.AuthMicroservice.Server.GetAddress()) | ||
if err != nil { | ||
logger.Fatalf("failed to listen port: %s", err) | ||
} | ||
|
||
server := grpc.NewServer() | ||
|
||
grpc_auth.RegisterAuthorizationServer(server, auth.NewAuthorization(pgSQLConn, redisConn, logger)) | ||
|
||
logger.Infof("Starting gRPC server on %s", conf.AuthMicroservice.Server.GetAddress()) | ||
server.Serve(lister) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net" | ||
|
||
"github.com/go-park-mail-ru/2024_2_VKatuny/internal/configs" | ||
"github.com/go-park-mail-ru/2024_2_VKatuny/internal/logger" | ||
compressdelivery "github.com/go-park-mail-ru/2024_2_VKatuny/microservices/compress/compress/delivery" | ||
compressrepository "github.com/go-park-mail-ru/2024_2_VKatuny/microservices/compress/compress/repository" | ||
compressusecase "github.com/go-park-mail-ru/2024_2_VKatuny/microservices/compress/compress/usecase" | ||
compress_api "github.com/go-park-mail-ru/2024_2_VKatuny/microservices/compress/generated" | ||
|
||
"google.golang.org/grpc" | ||
) | ||
|
||
func main() { | ||
conf := configs.ReadConfig("./configs/conf.yml") | ||
logger := logger.NewLogrusLogger() | ||
|
||
lis, err := net.Listen("tcp", conf.CompressMicroservice.Server.GetAddress()) | ||
if err != nil { | ||
log.Fatalln("can't listen port", err) | ||
} | ||
repository := compressrepository.NewCompressRepository(conf.CompressMicroservice.CompressedMediaDir, logger) | ||
usecase := compressusecase.NewCompressUsecase(repository, logger) | ||
server := grpc.NewServer() | ||
compress_api.RegisterCompressServiceServer(server, compressdelivery.NewCompressManager(usecase, logger)) | ||
|
||
logger.Infof("Compress starting server at %s", conf.CompressMicroservice.Server.GetAddress()) | ||
server.Serve(lis) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
# configurations | ||
|
||
server: | ||
scheme: "http" | ||
host: "0.0.0.0" | ||
port: 8080 | ||
frontURI: "http://172.28.166.156:8080/" | ||
mediadir: "media/" | ||
host: "192.168.77.130" | ||
port: 8090 | ||
frontURI: "http://192.168.77.130:8000" | ||
mediadir: "media/UnCompressed/" | ||
|
||
|
||
database: | ||
host: "127.0.0.1" | ||
port: 8008 | ||
host: "192.168.77.130" | ||
port: 5432 | ||
user: "postgres" | ||
password: "most_secure_password" | ||
password: "passIMO" | ||
schema: "public" | ||
db_name: "postgres" | ||
ssl_mode: "disable" | ||
# conn_timeout: 60s | ||
|
||
auth_microservice: | ||
server: | ||
scheme: "http" | ||
host: "192.168.77.130" | ||
port: 8091 | ||
database: | ||
host: "192.168.77.130" | ||
port: 6379 | ||
password: "passIMO" | ||
|
||
compress_microservice: | ||
server: | ||
scheme: "http" | ||
host: "192.168.77.130" | ||
port: 8071 | ||
CompressedMediaDir: "media/Compressed/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
port 6379 | ||
|
||
# задать хост | ||
bind 127.0.0.1 | ||
|
||
# в винде не работает | ||
# protected-mode yes | ||
|
||
# задать пароль | ||
requirepass "pass" | ||
|
||
# maxmemory 32mb | ||
|
||
loglevel notice | ||
logfile "redis.log" | ||
|
||
save 900 1 | ||
save 300 10 | ||
save 60 10000 | ||
|
||
maxclients 10000 | ||
|
||
timeout 0 | ||
|
||
echo "bind 0.0.0.0" > /usr/local/etc/redis/redis.conf && | ||
echo "requirepass $REDIS_PASSWORD" >> /usr/local/etc/redis/redis.conf |
Oops, something went wrong.