Giter VIP home page Giter VIP logo

Comments (8)

jonra1993 avatar jonra1993 commented on August 18, 2024 1

Hello @jymchng you make sure that you set your custom domain in environment variables. or use you public IP

image

EXT_ENDPOINT1=mycustomwebsite.com so that I can get access with both mycustomwebsite.com or fastapi.mycustomwebsite.com
EXT_ENDPOINT1=172.10.10.10 so that I can get access to 172.10.10.10. Subdomains do not work with IP addresses, so I recommend you get a custom domain on servers.

from fastapi-alembic-sqlmodel-async.

jonra1993 avatar jonra1993 commented on August 18, 2024 1

Hello @jymchng this can be helpful. The project uses Caddy as reverse proxy which automatically creates SSL certificates
#59 (comment)

Another option could be using cloudflare and providing a certificate using its free https proxy

from fastapi-alembic-sqlmodel-async.

jymchng avatar jymchng commented on August 18, 2024 1

Thank you for your response @jonra1993, I wish I can give you more stars than what you have now!

from fastapi-alembic-sqlmodel-async.

jymchng avatar jymchng commented on August 18, 2024

@jonra1993 Thank you for your reply. Just another follow up question, how can I get from HTTP to HTTPS? Thank you.

from fastapi-alembic-sqlmodel-async.

jymchng avatar jymchng commented on August 18, 2024

Hello @jonra1993, thank you for your helpful reply!

I have another question.

Let's say I have a Project table, shown below:

from sqlmodel import SQLModel

class Project(SQLModel, table=True):
    featured: bool = False

If I have an API that sets the Project.featured = True but I want it to be set to False 3 days later. What suggestions do you have to achieve this?

Thank you.

from fastapi-alembic-sqlmodel-async.

jonra1993 avatar jonra1993 commented on August 18, 2024

Hello @jymchng I think that is a crontab task you can use celery beats and create a celery task after someone changes featured to True. Something like this
https://github.com/jonra1993/fastapi-alembic-sqlmodel-async/blob/main/backend/app/app/api/v1/endpoints/periodic_tasks.py

on crontab you calculate 3 days after right now

periodic_task.crontab = CrontabSchedule(
        hour=22, minute=14, day_of_month=29, month_of_year=3, timezone="UTC"
    )

from fastapi-alembic-sqlmodel-async.

jymchng avatar jymchng commented on August 18, 2024

Hi @jonra1993, thank you for this awesome template.

After I tried to deploy with your Caddyfile, attempting to enable HTTPS, this is the error I got:

caddy_reverse_proxy  | {"level":"error","ts":1680712202.3448455,"logger":"http.acme_client","msg":"validating authorization","identifier":"static.mycustomdomain.com","problem":{"type":"urn:ietf:params:acme:error:dns","title":"","detail":"DNS problem: NXDOMAIN looking up A for static.mycustomdomain.com - check that a DNS record exists for this domain; DNS problem: NXDOMAIN looking up AAAA for static.mycustomdomain.com - check that a DNS record 
exists for this domain","instance":"","subproblems":[]},"order":"https://acme-staging-v02.api.letsencrypt.org/acme/order/96894614/8124165414","attempt":2,"max_attempts":3}

I am running docker-compose-dev.yml for testing on my local machine. What should I do?

from fastapi-alembic-sqlmodel-async.

jonra1993 avatar jonra1993 commented on August 18, 2024

Hello @jymchng you can not use SSL perfectly locally because you will require a public static IP also your local router should allow public connections and a DNS server which points A record to your PC public IP.

The error says that mycustomdomain.com is not in your local namespace and Cady can not generate a SSL certificate.

For development, I recommend you use HTTP. If you want to use SSL which is for production better use a remote server and connect a custom domain using a DNS server like Cloudflare which points the custom domain to your remote server. In such a situation, it is going to work perfectly. something like this

I hope it can help.

from fastapi-alembic-sqlmodel-async.

Related Issues (20)

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.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • 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.