Compare commits

11 Commits

Author SHA1 Message Date
Carlos Sousa
a3727d7baf added wordpress homage to docker-stack 2023-03-12 15:21:31 +01:00
Carlos Sousa
83ca0e8e36 added dokuwiki to docker-stack 2023-03-12 15:21:20 +01:00
Carlos Sousa
a744755a15 added nginx proxy manager 2023-03-11 13:31:45 +01:00
Carlos Sousa
ef95dee3d9 added basic dashboard in docker stack 2023-03-10 17:38:15 +01:00
Carlos Sousa
ec3539cb6e Merge remote-tracking branch 'refs/remotes/origin/dev-cloud' into dev-cloud 2023-03-10 16:00:54 +01:00
Carlos Sousa
218adb3412 added placeholder for docker stacks 2023-03-10 15:43:23 +01:00
Carlos Sousa
d9d4a350f9 set fail2ban and sshd to be enabled 2023-03-10 14:40:53 +01:00
Carlos Sousa
2d981c2f82 added apt update, upgrade & clean 2023-03-10 00:50:26 +01:00
Carlos Sousa
4f641e6902 added locale gen 2023-03-10 00:43:33 +01:00
Carlos Sousa
0c7f5cc0e1 added fail2ban configuration 2023-03-10 00:19:00 +01:00
Carlos Sousa
410b618908 added basic cloud instance deployment via ansible 2023-03-09 23:50:48 +01:00
25 changed files with 519 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Ignore .env files
**/.env

View File

@@ -0,0 +1,13 @@
# Apt Cache Time
# Default: 43200 (12 hours)
apt_cache_valid_time: 43200
# Timezone
server_timezone: Europe/Berlin
# Locale
server_locale: en_US.UTF-8
server_locale_language: en_US
server_locale_time: de_DE.UTF-8
server_locale_numeric: de_DE.UTF-8
server_locale_monetary: de_DE.UTF-8

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDW0ryhGvQwtXEQvP2+RV4PanS+TahMTj98WQqH0Dpe8 contabo-vps-m-me@carlosousa.tech

View File

@@ -0,0 +1,4 @@
[DEFAULT]
bantime = 24h
findtime = 24h
maxretry = 10

View File

@@ -0,0 +1,29 @@
- hosts: localhost
connection: local
become: true
vars_files:
- external_vars.yml
tasks:
- name: Import Software Tasks
include_tasks: "{{ item }}"
loop:
- tasks/software/package-manager.yml
- tasks/software/package-utilities.yml
- name: Import Users Tasks
include_tasks: tasks/users/docker-user.yml
- name: Import Systems Tasks
include_tasks: "{{ item }}"
loop:
- tasks/system/sshd.yml
- tasks/system/fail2ban.yml
- tasks/system/locale.yml
- tasks/system/clock.yml
- tasks/system/directories.yml
- name: Import Service Tasks
include_tasks: tasks/system/services.yml

View File

@@ -0,0 +1,8 @@
- name: system setup | package manager | update, upgrade and clean
apt:
name: "*"
state: latest
update_cache: yes
cache_valid_time: "{{ apt_cache_valid_time }}"
autoclean: yes
autoremove: yes

View File

@@ -0,0 +1,15 @@
- name: system setup | utilities | install utility packages
tags: packages,system,settings
package:
state: latest
name:
- tmux
- docker
- docker-compose
- fail2ban
- btop
- curl
- neofetch
- ncdu
- rsync
- wget

View File

@@ -0,0 +1,4 @@
- name: system setup | clock | set time zone
tags: ntp,timezone,system setup
timezone:
name: "{{ server_timezone }}"

View File

@@ -0,0 +1,7 @@
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /opt/docker-stack
state: directory
mode: '0740'
owner: docker-user
group: docker

View File

@@ -0,0 +1,7 @@
- name: fail2ban > copy jail.local to jail.d
copy:
src: ../../files/jail.local
dest: /etc/fail2ban/jail.d/jail.local
owner: root
group: root
mode: '0644'

View File

@@ -0,0 +1,25 @@
- name: system setup | locale | add local
tags: locale,system,setup
locale_gen:
name: "{{ server_locale }}"
state: present
- name: system setup | locale | set lang
tags: locale,system,setup
command: "localectl set-locale LANG={{ server_locale }}"
- name: system setup | locale | set language
tags: locale,system,setup
command: "localectl set-locale LANGUAGE={{ server_locale_language }}"
- name: system setup | locale | set time
tags: locale,system,setup
command: "localectl set-locale LC_TIME={{ server_locale_time }}"
- name: system setup | locale | set numeric
tags: locale,system,setup
command: "localectl set-locale LC_NUMERIC={{ server_locale_numeric }}"
- name: system setup | locale | set monetary
tags: locale,system,setup
command: "localectl set-locale LC_MONETARY={{ server_locale_monetary }}"

View File

@@ -0,0 +1,11 @@
- name: Set fail2ban to enabled and restart
service:
name: fail2ban
enabled: true
state: restarted
- name: Restart sshd serviece
service:
name: sshd
enabled: true
state: restarted

View File

@@ -0,0 +1,25 @@
- name: sshd_config > set PasswordAuthentication = no
lineinfile:
dest: /etc/ssh/sshd_config
regex: ^(# *)?PasswordAuthentication
line: PasswordAuthentication no
backrefs: yes
- name: sshd_config > set PermitRootLogin = no
lineinfile:
dest: /etc/ssh/sshd_config
regex: ^(# *)?PermitRootLogin
line: PermitRootLogin no
backrefs: yes
- name: sshd_config > remove PermitRootLogin yes
lineinfile:
path: "/etc/ssh/sshd_config"
line: "PermitRootLogin yes"
state: absent
- name: sshd_config > remove PasswordAuthentication yes
lineinfile:
path: "/etc/ssh/sshd_config"
line: "PasswordAuthentication yes"
state: absent

View File

@@ -0,0 +1,14 @@
- name: docker-user is present
user:
name: docker-user
state: present
groups: sudo, docker
shell: /bin/bash
- name: copy ssh public key
authorized_key:
user: docker-user
state: present
key: '{{ item }}'
with_file:
- ../../files/contabo-vps-m-me@carlossousa.tech.pub

View File

@@ -0,0 +1,4 @@
DASHBOARD_NAME=carlossousa.tech-dashboard
DASHBOARD_HOSTNAME=carlossousa.tech
DASHBOARD_PORT=8080
DASHBOARD_STORAGE=/opt/docker-stack/dashboard/data

View File

@@ -0,0 +1,53 @@
{
"categories": [
{
"name": "Online Hosted Stuff",
"items": [
{
"name": "Website",
"displayURL": "me.carlossousa.tech",
"url": "https://me.carlossousa.tech",
"icon": "web"
},
{
"name": "Wiki",
"displayURL": "wiki.carlossousa.tec",
"url": "https://wiki.carlossousa.tech",
"icon": "tips_and_updates"
}
]
},
{
"name": "Online Presence",
"items": [
{
"name": "GitHub",
"displayURL": "github.com/zebrajr/",
"url": "https://github.com/zebrajr/",
"icon": "code"
},
{
"name": "Steam",
"url": "https://steamcommunity.com/id/csousa90/",
"icon": "sports_esports"
},
{
"name": "LastFm",
"url": "https://www.last.fm/user/zebrajr",
"icon": "graphic_eq"
}
]
},
{
"name": "Useful Links",
"items": [
{
"name": "Torn Player Indexer",
"displayURL": "torn.carlossousa.tech",
"url": "https://torn.carlossousa.tech",
"icon": "list"
}
]
}
]
}

View File

@@ -0,0 +1,50 @@
{
"greeter": {
"months": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"days": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"greetings": [
{
"greeting": "Good night!",
"start": 0,
"end": 6
},
{
"greeting": "Good morning!",
"start": 6,
"end": 12
},
{
"greeting": "Good afternoon!",
"start": 12,
"end": 18
},
{
"greeting": "Good evening!",
"start": 18,
"end": 24
}
],
"dateformat": "%wd, %m %d%e %y"
}
}

View File

@@ -0,0 +1,109 @@
{
"themes": [
{
"label": "Espresso",
"value": 0,
"mainColor": "#d1b59a",
"accentColor": "#4e4e4e",
"backgroundColor": "#21211f"
},
{
"label": "Dark",
"value": 1,
"mainColor": "#ffffff",
"accentColor": "#999999",
"backgroundColor": "#000000"
},
{
"label": "Raw",
"value": 2,
"mainColor": "",
"accentColor": "",
"backgroundColor": "#ffffff"
},
{
"label": "Blackboard",
"value": 3,
"mainColor": "#fffdea",
"accentColor": "#5c5c5c",
"backgroundColor": "#1a1a1a"
},
{
"label": "Gazette",
"value": 4,
"mainColor": "#000000",
"accentColor": "#5c5c5c",
"backgroundColor": "#F2F7FF"
},
{
"label": "Classic",
"value": 5,
"mainColor": "#000000",
"accentColor": "#1e272e",
"backgroundColor": "#ffffff"
},
{
"label": "Cab",
"value": 6,
"mainColor": "#1f1f1f",
"accentColor": "#424242",
"backgroundColor": "#f6d305"
},
{
"label": "Cloud",
"value": 7,
"mainColor": "#35342f",
"accentColor": "#37bbe4",
"backgroundColor": "#f1f2f0"
},
{
"label": "Lime",
"value": 8,
"mainColor": "#aabbc3",
"accentColor": "#aeea00",
"backgroundColor": "#263238"
},
{
"label": "White",
"value": 9,
"mainColor": "#222222",
"accentColor": "#dddddd",
"backgroundColor": "#ffffff"
},
{
"label": "Tron",
"value": 10,
"mainColor": "#effbff",
"accentColor": "#6ee2ff",
"backgroundColor": "#242b33"
},
{
"label": "Blues",
"value": 11,
"mainColor": "#eff1fc",
"accentColor": "#6677eb",
"backgroundColor": "#2b2c56"
},
{
"label": "Passion",
"value": 12,
"mainColor": "#12005e",
"accentColor": "#8e24aa",
"backgroundColor": "#f5f5f5"
},
{
"label": "Chalk",
"value": 13,
"mainColor": "#aabbc3",
"accentColor": "#ff869a",
"backgroundColor": "#263238"
},
{
"label": "Paper",
"value": 14,
"mainColor": "#4c432e",
"accentColor": "#aa9a73",
"backgroundColor": "#f8f6f1"
}
]
}

View File

@@ -0,0 +1,21 @@
version: "3"
services:
dashboard:
container_name: ${DASHBOARD_NAME}
image: phntxx/dashboard:latest
restart: unless-stopped
#user: 1000:1000
expose:
- 8080
#ports:
# - 8080:8080
networks:
- reverse_proxy_network
volumes:
- ${DASHBOARD_STORAGE}:/app/data
networks:
reverse_proxy_network:
name: reverse_proxy_network
external: true

View File

@@ -0,0 +1,10 @@
# Container Configuration
APP_NAME=dokuwiki-carlossousa-tech
RESTART_POLICY=unless-stopped
# Volumes Configuration
DOKUWIKI_DATA=/opt/docker-stack/dokuwiki/data/data
DOKUWIKI_CONF=/opt/docker-stack/dokuwiki/data/conf
DOKUWIKI_LIB_TPL=/opt/docker-stack/dokuwiki/data/tpl
DOKUWIKI_LIB_PLUGINS=/opt/docker-stack/dokuwiki/data/plugins
DOKUWIKI_LOGS=/opt/docker-stack/dokuwiki/data/logs

View File

@@ -0,0 +1,22 @@
version: "3.7"
services:
dokuwiki:
image: 'mprasil/dokuwiki:stable'
container_name: ${APP_NAME}
restart: ${RESTART_POLICY}
networks:
- reverse_proxy_network
expose:
- 80
volumes:
- ${DOKUWIKI_DATA}:/dokuwiki/data
- ${DOKUWIKI_CONF}:/dokuwiki/conf
- ${DOKUWIKI_LIB_PLUGINS}:/dokuwiki/lib/plugins
- ${DOKUWIKI_LIB_TPL}:/dokuwiki/lib/tpl
- ${DOKUWIKI_LOGS}:/var/log
networks:
reverse_proxy_network:
name: reverse_proxy_network
external: true

View File

@@ -0,0 +1,6 @@
# Containers Configuration
PROXY_NAME=nginx-reverse-proxy
# Volumes Configuration
PROXY_DATA_STORAGE=/opt/docker-stack/reverse-proxy/data/data
PROXY_SSL_STORAGE=/opt/docker-stack/reverse-proxy/data/letsencrypt

View File

@@ -0,0 +1,21 @@
version: '3'
services:
app:
container_name: ${PROXY_NAME}
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ${PROXY_DATA_STORAGE}:/data
- ${PROXY_SSL_STORAGE}:/etc/letsencrypt
networks:
- reverse_proxy_network
networks:
reverse_proxy_network:
name: reverse_proxy_network
external: true

View File

@@ -0,0 +1,13 @@
# Container Configuration
HOMEPAGE_APP_NAME=wordpress-carlossousa-tech
HOMEPAGE_APP_DB_NAME=wordpress-carlossousa-tech-db
# Database Configuration
HOMEPAGE_DB_NAME=exampledb
HOMEPAGE_DB_USER=exampleuser
HOMEPAGE_DB_PWD=examplepass
# Volumes Configuration
WORDPRESS_STORAGE=/opt/docker-stack/wordpress-homepage/data/wordpress
DB_STORAGE=/opt/docker-stack/wordpress-homepage/data/mysql

View File

@@ -0,0 +1,45 @@
version: '3.1'
services:
wordpress:
container_name: ${HOMEPAGE_APP_NAME}
image: wordpress:latest
restart: unless-stopped
#ports:
# - 80:80
expose:
- 80
working_dir: /var/www/html
environment:
WORDPRESS_DB_HOST: ${HOMEPAGE_DB_NAME}
WORDPRESS_DB_USER: ${HOMEPAGE_DB_USER}
WORDPRESS_DB_PASSWORD: ${HOMEPAGE_DB_PWD}
WORDPRESS_DB_NAME: ${HOMEPAGE_DB_NAME}
volumes:
- ${WORDPRESS_STORAGE}:/var/www/html
networks:
- reverse_proxy_network
- wordpress_network
depends_on:
- db
db:
image: mysql:5.7
container_name: ${HOMEPAGE_APP_DB_NAME}
restart: unless-stopped
environment:
MYSQL_DATABASE: ${HOMEPAGE_DB_NAME}
MYSQL_USER: ${HOMEPAGE_DB_USER}
MYSQL_PASSWORD: ${HOMEPAGE_DB_PWD}
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- ${DB_STORAGE}:/var/lib/mysql
networks:
- wordpress_network
networks:
reverse_proxy_network:
name: reverse_proxy_network
external: true
wordpress_network:
name: wordpress_homepage_network