Skip to content

Commit

Permalink
ci: Simplify deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Nov 24, 2024
1 parent 2515509 commit d3e02d7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
1 change: 0 additions & 1 deletion deploy/.env.local

This file was deleted.

2 changes: 0 additions & 2 deletions deploy/.env.production

This file was deleted.

10 changes: 7 additions & 3 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ services:
ports:
- 3001:3001
env_file:
- .env.production
- .env.production # for N8N_SHORTLINK_SENTRY_DSN
environment:
- N8N_SHORTLINK_HOST=0.0.0.0
- N8N_SHORTLINK_ENVIRONMENT=production
volumes:
- ${HOME}/.n8n-shortlink:/root/.n8n-shortlink
restart: unless-stopped
Expand All @@ -20,8 +23,9 @@ services:
profiles: ["local"]
ports:
- 3001:3001
env_file:
- .env.local
environment:
- N8N_SHORTLINK_HOST=0.0.0.0
- N8N_SHORTLINK_ENVIRONMENT=development
volumes:
- ${HOME}/.n8n-shortlink:/root/.n8n-shortlink
restart: unless-stopped
Expand Down
9 changes: 5 additions & 4 deletions docs/02-configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ This guide explains how to configure the VPS for the app and set up backups.

```sh
brew install ansible
ansible --version # >= 2.18
cd infrastructure/02-configure
ansible all -m ping
```

2. Check that Ansible can connect to the server:
2. Install Ansible collection for Docker network management:

```sh
cd infrastructure/02-configure
ansible all -m ping
ansible-galaxy collection install community.docker
ansible-galaxy collection list | grep community.docker
```

3. In your DNS provider, add A records for the `domain.com` and `grafana.domain.com` pointing to the server's IP address, specified in `02-configure/hosts`.
Expand Down
7 changes: 7 additions & 0 deletions infrastructure/02-configure/03-tooling-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@
dest: /usr/bin/docker-compose
state: link

# Set up a shared network for app and monitoring containers to communicate.
# Requires Ansible collection `community.docker`.
- name: Create Docker network for n8n-shortlink
community.docker.docker_network:
name: n8n-shortlink-network
state: present

# ==================================
# sqlite3
# ==================================
Expand Down
10 changes: 10 additions & 0 deletions infrastructure/02-configure/04-app-dir-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
vars:
app_dir: "{{ ansible_user_dir }}/.n8n-shortlink"
app_db: "{{ app_dir }}/n8n-shortlink.sqlite"
vars_prompt:
- name: sentry_dsn
prompt: Enter Sentry DSN
private: no

tasks:
- name: Create app dir
Expand All @@ -16,3 +20,9 @@
shell: "sqlite3 {{ app_db }} ''"
args:
creates: "{{ app_db }}" # run `shell` _if and only if_ this file does not yet exist

- name: Create .env.production file with Sentry DSN
copy:
dest: "{{ app_dir }}/.env.production"
content: "N8N_SHORTLINK_SENTRY_DSN={{ sentry_dsn }}"
mode: "0600"

0 comments on commit d3e02d7

Please sign in to comment.