Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ temp/

# No need to send lock file
poetry.lock

deploy/hosts
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ build:


run:
@docker-compose up --force-recreate -d

@docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --force-recreate -d

restart:
@docker-compose restart -t 0
@docker-compose -f docker-compose.yml -f docker-compose.dev.yml restart -t 0


stop:
@docker-compose down -t 0
@docker-compose -f docker-compose.yml -f docker-compose.dev.yml down -t 0


logs:
@docker-compose logs -f

@docker-compose -f docker-compose.yml -f docker-compose.dev.yml logs -f
8 changes: 8 additions & 0 deletions deploy/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See: https://docs.ansible.com/ansible/intro_configuration.html
[privilege_escalation]
become = True
# See: https://docs.ansible.com/ansible/latest/plugins/callback.html#callback-plugins
[defaults]
stdout_callback = yaml
retry_files_enabled = False
nocows = 1
81 changes: 81 additions & 0 deletions deploy/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
- hosts: do
remote_user: root
vars:
ansible_python_interpreter: /usr/bin/python3
project_root: /project
# wtd_srv_docker_compose_package_state: latest
# ## Service Management
# wtd_srv_docker_service: "docker"
# # State can be started|stopped
# wtd_srv_docker_service_state: "started"
# wtd_srv_docker_service_enabled: true

# roles:
# - while_true_do.srv_docker
tasks:

- name: Disable SELinux
selinux:
state: disabled

- name: Ensure base requirements are installed
package:
name:
- git
- postgresql
- nginx
- dnf-plugins-core
state: present
retries: 5
register: result
until: result is succeeded

# TODO: trocar pelo modulo correto
- name: Add docker-ce repo
command: dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

- name: Install docker
package:
name:
- docker-ce
- docker-ce-cli
- containerd.io

- name: Install Pip requirements
pip:
name:
- docker-compose

- name: Start service docker, if not started
service:
name: docker
state: started

- name: Git Repo
git:
repo: https://github.com/flask-extensions/flaskextensions.com
dest: "{{ project_root }}"

- name: Set variables on .variables.env (ansible vault)
copy:
src: ../.variables.env
dest: "{{ project_root }}/.variables.env"

- name: Tear down existing services
docker_compose:
project_src: "{{ project_root }}"
state: absent

- name: Create and start services
docker_compose:
project_src: "{{ project_root }}"
build: yes
register: output

- debug:
var: output

- name: Setup NGINX
debug:
msg: "setup nginx"
6 changes: 6 additions & 0 deletions deploy/hosts.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[do]
0.0.0.0

[do:vars]
ansible_ssh_user=root
ansible_ssh_private_key_file=~/.ssh/do_private_key
18 changes: 18 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
version: "3"

services:

fexui:
build:
context: .
dockerfile: ./docker/ui/Dockerfile
restart: always
environment:
- PORT=5500
depends_on:
- "fexapi"
volumes:
- ./fexui:/fexui
ports:
- "5500:5500"
14 changes: 0 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ services:
volumes:
- ./fexservice:/fexservice

fexui:
build:
context: .
dockerfile: ./docker/ui/Dockerfile
restart: always
environment:
- PORT=5500
depends_on:
- "fexapi"
volumes:
- ./fexui:/fexui
ports:
- "5500:5500"

db:
image: postgres:12.1
restart: always
Expand Down
1 change: 0 additions & 1 deletion fexui/js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const instance = axios.create({
baseURL: `//${window.location.hostname}:8000/`,
// baseURL: "http://161.35.57.225:8000/",
});

new Vue({
Expand Down