Skip to content

Commit

Permalink
TP-c01_ci-cd: deleted nginx config from compose.yml, changed triggers…
Browse files Browse the repository at this point in the history
…, changed ports
  • Loading branch information
wonderf00l committed Dec 9, 2023
1 parent 7318fe6 commit eaa7ece
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 29 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Start pinspire CI

on:
workflow_dispatch:

workflow_dispatch: {}
push:
branches:
- TP-c01_ci-cd
- dev3
- dev4
pull_request:
types: [opened, edited, reopened]
branches: [main, dev4]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Get repository code
uses: actions/checkout@v4
- name: Test application
continue-on-error: true
run: go test ./...
lint:
runs-on: ubuntu-latest
Expand All @@ -19,7 +28,7 @@ jobs:
- name: Lint application
run: make lint
build:
runs-o: ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Get repository code
uses: actions/checkout@v4
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
name: Start Pinspire deployment

on:
workflow_dispatch:
workflow_dispatch: {}
push:
branches:
- TP-c01_ci-cd
- dev4
pull_request:
types: [opened, edited, reopened]
branches: [main, dev4]

jobs:
build_images:
Expand Down Expand Up @@ -39,7 +46,7 @@ jobs:
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ${{ secrets.PINSPIRE_BACKEND_PATH }}
sudo git switch dev3
sudo git switch TP-c01_ci-cd
sudo git pull
- name: deploy application
uses: appleboy/ssh-action@master
Expand All @@ -51,5 +58,5 @@ jobs:
cd ${{ secrets.PINSPIRE_BACKEND_PATH }}/deployments
sudo docker compose down main_service auth_service realtime_service messenger_service
sudo docker rmi pinspireapp/main:latest pinspireapp/auth:latest pinspireapp/realtime:latest pinspireapp/messenger:latest
docker compose -f docker-compose.yml -f compose.prod.yml up -d
sudo docker compose -f docker-compose.yml -f compose.prod.yml up -d
2 changes: 2 additions & 0 deletions cmd/realtime/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import (
grpcMetrics "github.com/go-park-mail-ru/2023_2_OND_team/internal/pkg/metrics/grpc"
"github.com/go-park-mail-ru/2023_2_OND_team/internal/pkg/middleware/grpc/interceptor"
"github.com/go-park-mail-ru/2023_2_OND_team/pkg/logger"
"github.com/joho/godotenv"
)

const _address = "0.0.0.0:8090"

func main() {
godotenv.Load()
log, err := logger.New()
if err != nil {
fmt.Println(err)
Expand Down
2 changes: 1 addition & 1 deletion configs/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ app:
server:
host: 0.0.0.0
port: 8080
https: false
https: true
certFile: /home/ond_team/cert/fullchain.pem
keyFile: /home/ond_team/cert/privkey.pem
4 changes: 0 additions & 4 deletions configs/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@
copy:
src: ../redis.conf
dest: /home/ond_team/go/src/github.com/go-park-mail-ru/ci-cd/redis.conf
- name: "Provide nginx config"
copy:
src: /etc/nginx/sites-available/pinspire.conf
dest: /etc/nginx/sites-available/pinspire.conf
2 changes: 1 addition & 1 deletion configs/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ global:
scrape_configs:
- job_name: 'api'
static_configs:
- targets: ['main_service:8080']
- targets: ['main_service:8079']

- job_name: 'auth'
static_configs:
Expand Down
20 changes: 5 additions & 15 deletions deployments/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ services:
- AUTH_SERVICE_HOST=auth_service
- MESSENGER_SERVICE_HOST=messenger_service
- REALTIME_SERVICE_HOST=realtime_service
volumes:
- '/home/ond_team/cert/fullchain.pem:/home/ond_team/cert/fullchain.pem:ro'
- '/home/ond_team/cert/privkey.pem:/home/ond_team/cert/privkey.pem:ro'
depends_on:
postgres:
condition: 'service_healthy'
Expand All @@ -56,7 +59,7 @@ services:
realtime_service:
condition: 'service_started'
ports:
- 8100:8080
- 8079:8080

auth_service:
build:
Expand Down Expand Up @@ -130,7 +133,7 @@ services:
- ALLOW_PLAINTEXT_LISTENER=yes
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
healthcheck:
test: |
curl localhost:9092
Expand Down Expand Up @@ -175,19 +178,6 @@ services:
ports:
- "9100:9100"

nginx:
image: nginx:latest
container_name: pinspireNginx
volumes:
- '/etc/nginx/sites-available/pinspire.conf:/etc/nginx/conf.d/pinspire.conf:ro'
network_mode: 'host'
depends_on:
main_service:
condition: 'service_started'
realtime_service:
condition: 'service_started'


volumes:
postgres_storage: {}
redis_storage: {}
Expand Down
1 change: 0 additions & 1 deletion internal/microservices/realtime/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Node struct {

func NewNode() (*Node, error) {
node := &Node{}

broker, err := NewKafkaBroker(node, KafkaConfig{
// Addres: []string{"localhost:9092"},
Addres: []string{os.Getenv("KAFKA_BROKER_ADDRESS") + ":" + os.Getenv("KAFKA_BROKER_PORT")},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/delivery/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func SetOriginPatterns(patterns []string) Option {

func New(log *log.Logger, mesCase usecase.Usecase, opts ...Option) *HandlerWebSocket {
// gRPCConn, err := grpc.Dial("localhost:8090", grpc.WithTransportCredentials(insecure.NewCredentials()))
gRPCConn, err := grpc.Dial(os.Getenv("REALTIME_SERVICE_HOST"+":"+os.Getenv("REALTIME_SERVICE_PORT")), grpc.WithTransportCredentials(insecure.NewCredentials()))
gRPCConn, err := grpc.Dial((os.Getenv("REALTIME_SERVICE_HOST") + ":" + os.Getenv("REALTIME_SERVICE_PORT")), grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Error(fmt.Errorf("grpc dial: %w", err).Error())
}
Expand Down

0 comments on commit eaa7ece

Please sign in to comment.