Use the GeoServer SQL view feature, and SQL's ST_Project like,
SELECT id,
ST_SetSRID(ST_MakeLine(
ST_MakePoint(lon,lat),
ST_Project(
ST_SetSRID(ST_MakePoint(lon,lat),4326)::geography,
distance,
pi()*azimuth/180.0)::geometry
),4326) AS geom
FROM mytable;
If you have long lines and want to plot them as great circles on a flat map, you might want to densify them with ST_Segmentize in geographic space to show them as great circles.
SELECT id,
ST_Segmentize(ST_SetSRID(ST_MakeLine(
ST_MakePoint(lon,lat),
ST_Project(
ST_SetSRID(ST_MakePoint(lon,lat),4326)::geography,
distance,
pi()*azimuth/180.0)::geometry
),4326)::geography,100000)::geometry AS geom
FROM mytable;
Added
SELECT id,
ST_SetSRID(ST_MakeLine(
ST_SetSRID(ST_MakePoint(lon,lat),4326),
ST_Project(
ST_SetSRID(ST_MakePoint(lon,lat),4326)::geography,
distance,
pi()*azimuth/180.0)::geometry
),4326) AS geom
FROM mytable