summaryrefslogtreecommitdiff
path: root/installation
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-07-14 19:34:59 +0300
committerDawid Rycerz <dawid@rycerz.xyz>2025-07-14 19:34:59 +0300
commit50ce8cb96b2b218751c2fc2a6b19372f51846acc (patch)
treee2c634d2ce856062d527667d47815a05a53361c8 /installation
parent0ab2e5ba2b0631b28b5b1405559237b3913c878f (diff)
feat: rewrite in rust
Diffstat (limited to 'installation')
-rw-r--r--installation/docker-compose.deploy.yml67
-rw-r--r--installation/setup_db.sql19
-rw-r--r--installation/silmataivas.nginx81
-rw-r--r--installation/silmataivas.service48
4 files changed, 0 insertions, 215 deletions
diff --git a/installation/docker-compose.deploy.yml b/installation/docker-compose.deploy.yml
deleted file mode 100644
index 125db4b..0000000
--- a/installation/docker-compose.deploy.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-services:
- # Silmataivas application
- app:
- image: ${DOCKER_IMAGE}
- restart: unless-stopped
- ports:
- - "4000:4000"
- environment:
- - PHX_HOST=${PHX_HOST:-localhost}
- - SECRET_KEY_BASE=${SECRET_KEY_BASE}
- - DB_ADAPTER=${DB_ADAPTER:-sqlite}
- - DATABASE_URL=${DATABASE_URL:-/app/data/silmataivas.db}
- - OPENWEATHERMAP_API_KEY=${OPENWEATHERMAP_API_KEY}
- - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
- - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
- volumes:
- - silmataivas_data:/app/data
- # Command to run on container start - will run database migrations before starting the application
- command: sh -c "/app/bin/silmataivas eval 'Silmataivas.Release.setup()' && /app/bin/silmataivas start"
- networks:
- - silmataivas_network
- # Uncomment the following lines if using PostgreSQL
- # depends_on:
- # db:
- # condition: service_started
- # required: false
- healthcheck:
- test: ["CMD", "curl", "-f", "http://localhost:4000/health"]
- interval: 30s
- timeout: 5s
- retries: 3
- start_period: 10s
-
- # PostgreSQL database
- # To enable PostgreSQL:
- # 1. Uncomment this section
- # 2. Set DB_ADAPTER=postgres in your environment
- # 3. Set DATABASE_URL to your PostgreSQL connection string
- #db:
- # image: postgres:16-alpine
- # restart: unless-stopped
- # ports:
- # - "5432:5432"
- # environment:
- # - POSTGRES_USER=${PGUSER:-postgres}
- # - POSTGRES_PASSWORD=${PGPASSWORD:-postgres}
- # - POSTGRES_DB=${PGDATABASE:-silmataivas_prod}
- # volumes:
- # - postgres_data:/var/lib/postgresql/data
- # networks:
- # - silmataivas_network
- # # Only start PostgreSQL if DB_ADAPTER is set to postgres
- # profiles:
- # - postgres
- # healthcheck:
- # test: ["CMD-SHELL", "pg_isready -U postgres"]
- # interval: 10s
- # timeout: 5s
- # retries: 5
-
-volumes:
- silmataivas_data:
- # postgres_data:
-
-networks:
- silmataivas_network:
- driver: bridge
diff --git a/installation/setup_db.sql b/installation/setup_db.sql
deleted file mode 100644
index 3014dc0..0000000
--- a/installation/setup_db.sql
+++ /dev/null
@@ -1,19 +0,0 @@
--- setup_db.sql
-
--- Create user (if it doesn't exist)
-DO
-$$
-BEGIN
- IF NOT EXISTS (
- SELECT FROM pg_catalog.pg_roles WHERE rolname = 'silmataivas'
- ) THEN
- CREATE ROLE silmataivas LOGIN PASSWORD 'silmataivas';
- END IF;
-END
-$$;
-
--- Create database owned by the user
-CREATE DATABASE silmataivas OWNER silmataivas;
-
--- Optional: grant all privileges explicitly
-GRANT ALL PRIVILEGES ON DATABASE silmataivas TO silmataivas; \ No newline at end of file
diff --git a/installation/silmataivas.nginx b/installation/silmataivas.nginx
deleted file mode 100644
index 5b58a89..0000000
--- a/installation/silmataivas.nginx
+++ /dev/null
@@ -1,81 +0,0 @@
-# default nginx site config for Silmataivas
-#
-# Simple installation instructions:
-# 1. Install your TLS certificate, possibly using Let's Encrypt.
-# 2. Replace 'example.tld' with your instance's domain wherever it appears.
-# 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it
-# in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx.
-
-# this is explicitly IPv4 since Silmataivas.Web.Endpoint binds on IPv4 only
-# and `localhost.` resolves to [::0] on some systems: see issue #930
-upstream phoenix {
- server 127.0.0.1:4000 max_fails=5 fail_timeout=60s;
-}
-
-server {
- server_name example.tld;
-
- listen 80;
- listen [::]:80;
-
- # Uncomment this if you need to use the 'webroot' method with certbot. Make sure
- # that the directory exists and that it is accessible by the webserver. If you followed
- # the guide, you already ran 'mkdir -p /var/lib/letsencrypt' to create the folder.
- # You may need to load this file with the ssl server block commented out, run certbot
- # to get the certificate, and then uncomment it.
- #
- # location ~ /\.well-known/acme-challenge {
- # root /var/lib/letsencrypt/;
- # }
- location / {
- return 301 https://$server_name$request_uri;
- }
-}
-
-# Enable SSL session caching for improved performance
-ssl_session_cache shared:ssl_session_cache:10m;
-
-server {
- server_name example.tld;
-
- listen 443 ssl;
- listen [::]:443 ssl;
- http2 on;
- ssl_session_timeout 1d;
- ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
- ssl_session_tickets off;
-
- ssl_trusted_certificate /etc/letsencrypt/live/example.tld/chain.pem;
- ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
-
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
- ssl_prefer_server_ciphers off;
- # In case of an old server with an OpenSSL version of 1.0.2 or below,
- # leave only prime256v1 or comment out the following line.
- ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
- ssl_stapling on;
- ssl_stapling_verify on;
-
- gzip_vary on;
- gzip_proxied any;
- gzip_comp_level 6;
- gzip_buffers 16 8k;
- gzip_http_version 1.1;
- gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
-
- # the nginx default is 1m, not enough for large media uploads
- client_max_body_size 16m;
- ignore_invalid_headers off;
-
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $http_host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- location / {
- proxy_pass http://phoenix;
- }
-}
diff --git a/installation/silmataivas.service b/installation/silmataivas.service
deleted file mode 100644
index 811415d..0000000
--- a/installation/silmataivas.service
+++ /dev/null
@@ -1,48 +0,0 @@
-[Unit]
-Description=Silmataivas weather monitoring
-After=network.target postgresql.service
-
-[Service]
-KillMode=process
-Restart=on-failure
-RestartSec=5
-KillSignal=SIGTERM
-
-; Name of the user that runs the silmataivas service.
-User=silmataivas
-; Declares that silmataivas runs in production mode.
-Environment="MIX_ENV=prod"
-Environment=LANG=en_US.UTF-8
-Environment=LC_ALL=en_US.UTF-8
-
-;Read secrets for config
-EnvironmentFile=/etc/silmataivas/env
-
-; Make sure that all paths fit your installation.
-; Path to the home directory of the user running the Silmataivas service.
-Environment="HOME=/var/lib/silmataivas"
-; Path to the folder containing the Silmataivas installation.
-WorkingDirectory=/opt/silmataivas
-; Path to the Mix binary.
-ExecStart=/opt/silmataivas/bin/silmataivas start
-ExecStop=/opt/silmataivas/bin/silmataivas stop
-ExecReload=/opt/silmataivas/bin/silmataivas restart
-ExecStartPre=/opt/silmataivas/bin/silmataivas eval 'Silmataivas.Release.migrate()'
-
-; Some security directives.
-; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops.
-PrivateTmp=true
-; The /home, /root, and /run/user folders can not be accessed by this service anymore. If your Silmataivas user has its home folder in one of the restricted places, or use one of these folders as its working directory, you have to set this to false.
-ProtectHome=true
-; Mount /usr, /boot, and /etc as read-only for processes invoked by this service.
-ProtectSystem=full
-; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi.
-PrivateDevices=false
-; Drops the sysadmin capability from the daemon.
-CapabilityBoundingSet=~CAP_SYS_ADMIN
-
-StandardOutput=journal
-StandardError=journal
-
-[Install]
-WantedBy=multi-user.target