diff --git a/Dockerfile b/Dockerfile index a5085cf..ff67237 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ WORKDIR /$APP_NAME COPY . . # Budild application -RUN CGO_ENABLED=0 go build -mod=vendor -v -o $APP_NAME . +RUN CGO_ENABLED=0 go build -mod=mod -v -o $APP_NAME . # Run Stage diff --git a/config.yml b/config.yml index 9bbb25e..35fa4cb 100644 --- a/config.yml +++ b/config.yml @@ -9,7 +9,7 @@ http_server: mysql: port: 3306 - host: niki-database + host: niki-mariadb db_name: niki_db username: niki password: nikiappt0lk2o20 diff --git a/deploy/production/.gitkeep b/deploy/production/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/deploy/stage/app/docker-compose.yml b/deploy/stage/app/docker-compose.yml new file mode 100644 index 0000000..4945183 --- /dev/null +++ b/deploy/stage/app/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.7' + +services: + niki_app_stage: + image: niki:${STAGE_NIKI_IMAGE_VERSION} + container_name: niki_app_stage + restart: always + ports: + - '127.0.0.1:8198:1313' + networks: + - niki-stage + volumes: + - './config.yml:/config.yml' + +networks: + niki-stage: + external: true + +# STAGE_NIKI_IMAGE_VERSION=770f31ea docker compose -p niki_app_stage up -d \ No newline at end of file diff --git a/deploy/stage/config.yml b/deploy/stage/config.yml new file mode 100644 index 0000000..df4939e --- /dev/null +++ b/deploy/stage/config.yml @@ -0,0 +1,36 @@ +--- +type: yml + +auth: + sign_key: jwt_secret_stage_nik + +http_server: + port: 1313 + +mysql: + port: 3306 + host: niki_stage_mariadb + db_name: niki_db + username: niki + password: n0ki2agd23 + +redis: + port: 6379 + host: niki_stage_redis + password: "" + db: 0 + +sms_provider: + host: localhost + port: 443 + +benefactor_service: + length_of_otp_code: 5 + +kavenegar_sms_provider: + api_key: insert_your_api_key + otp_template_new_user: ebhomeverify + otp_template_registered_user: ebhomeverify + +admin_auth: + sign_key: admin-jwt_secret_test_nik \ No newline at end of file diff --git a/deploy/stage/mariadb/docker-compose.yml b/deploy/stage/mariadb/docker-compose.yml new file mode 100644 index 0000000..c33656a --- /dev/null +++ b/deploy/stage/mariadb/docker-compose.yml @@ -0,0 +1,37 @@ +version: '3.1' + +services: + niki_stage_mariadb: + image: docker.io/bitnami/mariadb:11.1 + container_name: niki_stage_mariadb + restart: always + ports: + - '127.0.0.1:3429:3306' + networks: + - niki-stage + volumes: + - 'niki_stage_mariadb_data:/bitnami/mariadb' + environment: + - MARIADB_USER=niki + - MARIADB_PASSWORD=${NIKI_STAGE_MARIADB_UR_PASSWORD} + - MARIADB_DATABASE=niki_db + - MARIADB_ROOT_PASSWORD=${NIKI_STAGE_MARIADB_RT_PASSWORD} + - ALLOW_EMPTY_PASSWORD=no + healthcheck: + test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] + interval: 15s + timeout: 5s + retries: 6 + deploy: + resources: + limits: + cpus: '1' + memory: 2048M + +volumes: + niki_stage_mariadb_data: + driver: local + +networks: + niki-stage: + external: true \ No newline at end of file diff --git a/deploy/stage/redis/docker-compose.yml b/deploy/stage/redis/docker-compose.yml new file mode 100644 index 0000000..685483f --- /dev/null +++ b/deploy/stage/redis/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.1' + +services: + niki_stage_redis: + image: bitnami/redis:6.2 + container_name: niki_stage_redis + restart: always + ports: + - '127.0.0.1:6380:6379' + # TODO - remove `--save "" --appendonly no` from command to persist data + command: redis-server --loglevel warning --protected-mode no --save "" --appendonly no + environment: + - ALLOW_EMPTY_PASSWORD=yes + networks: + - core + volumes: + - niki__stage_redis_data:/data + +volumes: + niki__stage_redis_data: + driver: local + +networks: + niki-stage: + external: true \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index f71682b..f698007 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,29 +13,27 @@ services: ports: - "1313:1313" links: - - "niki-mysql" + - "niki-mariadb" depends_on: - - "niki-mysql" + - "niki-mariadb" - "niki-redis" - - - niki-mysql: - image: mysql:8.0 + niki-mariadb: + image: docker.io/bitnami/mariadb:11.1 + container_name: niki-mariadb + restart: always ports: - - "3306:3306" - container_name: niki-database - volumes: - - dbdata:/var/lib/mysql + - '127.0.0.1:3306:3306' networks: - core - restart: always - command: [ 'mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci' ] + volumes: + - 'niki-mariadb-data:/bitnami/mariadb' environment: - MYSQL_ROOT_PASSWORD: nikiRoo7t0lk2o20 - MYSQL_DATABASE: niki_db - MYSQL_USER: niki - MYSQL_PASSWORD: nikiappt0lk2o20 + MARIADB_USER: niki + MARIADB_PASSWORD: ${NIKI_STAGE_MARIADB_UR_PASSWORD} + MARIADB_DATABASE: niki_db + MARIADB_ROOT_PASSWORD: ${NIKI_STAGE_MARIADB_RT_PASSWORD} + ALLOW_EMPTY_PASSWORD: no niki-redis: image: bitnami/redis:6.2 @@ -54,7 +52,7 @@ services: volumes: - dbdata: + niki-mariadb-data: niki-redis-data: networks: