GithubHelp home page GithubHelp logo

server's People

Contributors

rektdeckard avatar dependabot[bot] avatar

Stargazers

 avatar Nero Blackstone​ avatar

Watchers

 avatar

server's Issues

Database Error: relation "icons" does not exist on self-hosted setup

Hello Phosphor Icons team,

I am trying to self-host the Phosphor Icons server in a closed network environment where access to external CDNs is not possible. I believe the phosphor-icons/server repository is the perfect solution for this.

Steps to Reproduce

  1. I cloned the repository with submodules:
git clone --recurse-submodules [email protected]:phosphor-icons/server.git phosphor-icons-server
  1. I created a .env file with the following content to configure the server:
DATABASE_URL=postgresql://appuser:apppassword@localhost:5432/appdb
HOST=0.0.0.0
PORT=8080
  1. I started the server using the provided script:
sh start.sh

Expected Behavior

The server should start correctly, and the API endpoint http://localhost:8080/v1/icons should return a list of icons.

Current Behavior

The server starts, and the API documentation is available at http://localhost:8080/docs. However, when I make a request to http://localhost:8080/v1/icons, the application panics and returns an error.

The server log shows the following database error:

ERROR phosphor_server::icons: Failed to fetch icons for query: Query(SqlxError(Database(PgDatabaseError { severity: Error, code: "42P01", message: "relation \"icons\" does not exist", ... })))

This suggests that the database schema, specifically the icons table, has not been created. I suspect there is a database migration step that I might have missed in the documentation.

To provide more context, I am running a PostgreSQL 17 database instance using Docker. Here is my Dockerfile:

FROM postgres:17

ENV POSTGRES_USER=appuser
ENV POSTGRES_PASSWORD=apppassword
ENV POSTGRES_DB=appdb

EXPOSE 5432

I built and ran this container with the following commands:

docker build -t my-postgres17 .
docker run -d \
  --name my-postgres17-container \
  -p 5432:5432 \
  my-postgres17

I then attempted to run the database migrations from my local machine (not inside the Docker container) by executing the following commands, but it did not resolve the issue:

# This was an attempt to run migrations, but it had no effect
cd migration && cargo run && cargo run -- up && cd ../

The error relation "icons" does not exist persists, which makes sense as the migration commands I tried seem incorrect and were not the standard sqlx-cli commands.

I am documenting my attempt to containerize this setup in my forked repository here: https://github.com/eckeriaue/phosphor-icons-server/tree/feat/use-docker

Could you please provide guidance on the correct procedure to initialize the database and run the necessary migrations?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.