diff --git a/solidtime_docker_setup.yml b/solidtime_docker_setup.yml new file mode 100644 index 0000000..4d31d3e --- /dev/null +++ b/solidtime_docker_setup.yml @@ -0,0 +1,142 @@ +--- +- name: Setup Solidtime Configuration Files + hosts: all + become: yes + vars_prompt: + - name: install_dir + prompt: "Where should Solidtime be installed?" + default: "/opt/solidtime" + private: no + + - name: app_url + prompt: "What is the App URL? (e.g., https://time.example.com or http://localhost:8000)" + default: "http://localhost:8000" + private: no + + - name: db_host + prompt: "PostgreSQL Host (leave as 'db' if using the included containerized database)" + default: "db" + private: no + + - name: db_port + prompt: "PostgreSQL Port (leave as '5432' if using the included containerized database)" + default: "5432" + private: no + + - name: db_name + prompt: "PostgreSQL Database Name" + default: "solidtime" + private: no + + - name: db_user + prompt: "PostgreSQL Database User" + default: "solidtimeuser" + private: no + + - name: db_password + prompt: "PostgreSQL Database Password" + private: yes + confirm: yes + + - name: app_key + prompt: "Laravel APP_KEY (leave blank to generate later via CLI)" + default: "" + private: no + + tasks: + - name: Ensure installation directory exists + file: + path: "{{ install_dir }}" + state: directory + mode: '0755' + + - name: Create docker-compose.yml + copy: + dest: "{{ install_dir }}/docker-compose.yml" + mode: '0644' + content: | + version: "3.8" + + services: + app: + image: ghcr.io/solidtime-io/solidtime:latest + container_name: solidtime-app + restart: unless-stopped + ports: + - "8000:8000" # Change the left port if you are putting this behind a reverse proxy + env_file: + - .env + environment: + - CONTAINER_MODE=http + - AUTO_DB_MIGRATE=true + depends_on: + db: + condition: service_healthy + + scheduler: + image: ghcr.io/solidtime-io/solidtime:latest + container_name: solidtime-scheduler + restart: unless-stopped + env_file: + - .env + environment: + - CONTAINER_MODE=scheduler + depends_on: + db: + condition: service_healthy + + worker: + image: ghcr.io/solidtime-io/solidtime:latest + container_name: solidtime-worker + restart: unless-stopped + env_file: + - .env + environment: + - CONTAINER_MODE=worker + + volumes: + solidtime_db_data: + + - name: Create .env file + copy: + dest: "{{ install_dir }}/.env" + mode: '0600' + content: | + # Solidtime Environment Variables + APP_NAME="Solidtime" + APP_ENV=production + APP_URL={{ app_url }} + APP_KEY={{ app_key }} + + # Database Configuration + DB_CONNECTION=pgsql + DB_HOST=db + DB_PORT=5432 + DB_DATABASE={{ db_name }} + DB_USERNAME={{ db_user }} + DB_PASSWORD={{ db_password }} + + # Enable User Registration (set to true to allow open signups) + APP_ENABLE_REGISTRATION=false + + # Queue and Cache + QUEUE_CONNECTION=database + CACHE_STORE=database + + # Mail Configuration (Adjust once an SMTP server is available) + MAIL_MAILER=log + MAIL_HOST=127.0.0.1 + MAIL_PORT=1025 + MAIL_USERNAME=null + MAIL_PASSWORD=null + MAIL_ENCRYPTION=null + MAIL_FROM_ADDRESS="hello@example.com" + MAIL_FROM_NAME="${APP_NAME}" + + - name: Display post-installation instructions + debug: + msg: + - "Success! Solidtime configuration files have been staged at {{ install_dir }}" + - "To generate your APP_KEY and Passport keys (if you left APP_KEY blank), CD into the directory and run:" + - " docker compose run --rm scheduler php artisan self-host:generate-keys" + - "Copy the outputs into your .env file, then you can safely run 'docker compose up -d'." \ No newline at end of file