Skip to content

[DevOps] Deploy to Coolify #23

Description

@ejsadiarin

Coolify Project Deployment Steps

  • Log in to dash.dlsu-lscs.org with your account provided to you.
  • Go to Infrastructure Team > Projects > LSCS Applications > Choose production/development (for now you can choose production) environment
    • If your application/project assigned to you is an API, it will most likely require a database (see guide below)
  • Click New > Public Repository > Then add the github link of your repository > Check repository > Change Build Packs to Dockerfile > Continue
    • (OPTIONAL for API repositories) Add a database by going back to Projects > LSCS Databases > New > Choose database provider like Postgres, MySQL (consult with your project head for this)

Once here, you can see different tabs and configurations to do (you can explore all of these).

Note

The most important ones are: General, Environment Variables, Webhooks, Git Source

Application Configuration in Coolify:

In General tab:

  • Change Name to the repository name (ex. lscs-core-web, lscs-core-api)
  • Change domains (if you do not know what to put for project then consult with your project head or me)
  • Change Network Port to the appropriate port (check your .env.example or Dockerfile or the entrypoint of the project like index.ts or server.ts)
    • For Next.js Projects, usually just put 3000 (default port for Next.js)
    • For APIs, also 3000 but consult with the project head or backend devs of the project (see server.ts or .env.example to check if PORT is configured there)

In Environment Variables tab:

Note

For API projects (or if your project connects to a database created in Coolify, MAKE SURE to create a database then expose it publicly (see below)

  • Ask the project head or developers of the project for the actual .env file for the environment variables
  • Once you have the .env, go to Developer View > Copy and paste these variables > Save all environment variables

Other tabs:

  • In Git Source, just check the branch - if you want to create a dev environment, use the development (or equivalent) branch of the repository. Usually projects have development branches so you should do this.
  • In Webhooks, get the URL (Deploy Webhook (auth required)) for the COOLIFY_WEBHOOK > Copy this and save for later for deployment CD configuration
  • Start the application by pressing Start

Creating a Database in Coolify

  • Follow the steps above normally
    • Make sure the database project is in LSCS Databases
    • The appropriate database provider is correct (PostgreSQL or MySQL or MongoDB, etc.)
  • Create > Name to <Project> Database > Start (this is needed to be done first before exposing this to the public)
  • Expose a Public Endpoint for the database
    • General tab > Proxy > Check Make it publicly available > Configure public port (should be a number from 10000-65535, to avoid collision)

For this PR, complete the following tasks below after you've done the tasks above:

  • Add deployment workflow for CD (Github Actions) in .github/workflows/ directory
  • Configure COOLIFY_TOKEN and COOLIFY_WEBHOOK in Settings > Secrets and Variables > Actions > New repository secret
    • See #devops-reminders channel in Discord for the COOLIFY_TOKEN
    • Paste the copied Webhook here as a repository secret and name it COOLIFY_WEBHOOK (or what name you put in your deployment CD workflow)

Once done mention me @ejsadiarin for reviews and questions

Assigned to @ig21xn-dlsu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions